Convert Secret registry to use update/create strategy, allow filtering by Type

This commit is contained in:
Jordan Liggitt
2015-04-27 23:50:56 -04:00
parent c2a78483b4
commit ac67fff1cf
14 changed files with 391 additions and 524 deletions

View File

@@ -20,6 +20,16 @@ import (
"bytes"
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"mime"
"net/http"
"net/url"
"path"
"strconv"
"strings"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/metrics"
@@ -31,15 +41,6 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
watchjson "github.com/GoogleCloudPlatform/kubernetes/pkg/watch/json"
"github.com/golang/glog"
"io"
"io/ioutil"
"mime"
"net/http"
"net/url"
"path"
"strconv"
"strings"
"time"
)
// specialParams lists parameters that are handled specially and which users of Request
@@ -253,6 +254,7 @@ const (
NodeUnschedulable = "spec.unschedulable"
ObjectNameField = "metadata.name"
PodHost = "spec.host"
SecretType = "type"
)
type clientFieldNameToAPIVersionFieldName map[string]string
@@ -305,6 +307,9 @@ var fieldMappings = versionToResourceToFieldMapping{
"pods": clientFieldNameToAPIVersionFieldName{
PodHost: "DesiredState.Host",
},
"secrets": clientFieldNameToAPIVersionFieldName{
SecretType: "type",
},
},
"v1beta2": resourceTypeToFieldMapping{
"nodes": clientFieldNameToAPIVersionFieldName{
@@ -318,6 +323,9 @@ var fieldMappings = versionToResourceToFieldMapping{
"pods": clientFieldNameToAPIVersionFieldName{
PodHost: "DesiredState.Host",
},
"secrets": clientFieldNameToAPIVersionFieldName{
SecretType: "type",
},
},
"v1beta3": resourceTypeToFieldMapping{
"nodes": clientFieldNameToAPIVersionFieldName{
@@ -331,6 +339,9 @@ var fieldMappings = versionToResourceToFieldMapping{
"pods": clientFieldNameToAPIVersionFieldName{
PodHost: "spec.host",
},
"secrets": clientFieldNameToAPIVersionFieldName{
SecretType: "type",
},
},
}