experimental. -> extensions.
This commit is contained in:
parent
2816eb0f8a
commit
7c9f4cc42f
@ -98,7 +98,7 @@ func (s *ProxyServerConfig) AddFlags(fs *pflag.FlagSet) {
|
|||||||
const (
|
const (
|
||||||
proxyModeUserspace = "userspace"
|
proxyModeUserspace = "userspace"
|
||||||
proxyModeIptables = "iptables"
|
proxyModeIptables = "iptables"
|
||||||
experimentalProxyModeAnnotation = "net.experimental.kubernetes.io/proxy-mode"
|
experimentalProxyModeAnnotation = "net.extensions.kubernetes.io/proxy-mode"
|
||||||
)
|
)
|
||||||
|
|
||||||
func checkKnownProxyMode(proxyMode string) bool {
|
func checkKnownProxyMode(proxyMode string) bool {
|
||||||
|
@ -40,15 +40,15 @@ func Test_mayTryIptablesProxy(t *testing.T) {
|
|||||||
{"userspace", "", "", false},
|
{"userspace", "", "", false},
|
||||||
{"iptables", "", "", true},
|
{"iptables", "", "", true},
|
||||||
{"", "", "", false},
|
{"", "", "", false},
|
||||||
{"", "net.experimental.kubernetes.io/proxy-mode", "userspace", false},
|
{"", "net.extensions.kubernetes.io/proxy-mode", "userspace", false},
|
||||||
{"", "net.experimental.kubernetes.io/proxy-mode", "iptables", true},
|
{"", "net.extensions.kubernetes.io/proxy-mode", "iptables", true},
|
||||||
{"", "net.experimental.kubernetes.io/proxy-mode", "other", false},
|
{"", "net.extensions.kubernetes.io/proxy-mode", "other", false},
|
||||||
{"", "net.experimental.kubernetes.io/proxy-mode", "", false},
|
{"", "net.extensions.kubernetes.io/proxy-mode", "", false},
|
||||||
{"", "proxy-mode", "iptables", false},
|
{"", "proxy-mode", "iptables", false},
|
||||||
{"userspace", "net.experimental.kubernetes.io/proxy-mode", "userspace", false},
|
{"userspace", "net.extensions.kubernetes.io/proxy-mode", "userspace", false},
|
||||||
{"userspace", "net.experimental.kubernetes.io/proxy-mode", "iptables", false},
|
{"userspace", "net.extensions.kubernetes.io/proxy-mode", "iptables", false},
|
||||||
{"iptables", "net.experimental.kubernetes.io/proxy-mode", "userspace", true},
|
{"iptables", "net.extensions.kubernetes.io/proxy-mode", "userspace", true},
|
||||||
{"iptables", "net.experimental.kubernetes.io/proxy-mode", "iptables", true},
|
{"iptables", "net.extensions.kubernetes.io/proxy-mode", "iptables", true},
|
||||||
}
|
}
|
||||||
for i, c := range cases {
|
for i, c := range cases {
|
||||||
getter := &fakeNodeInterface{}
|
getter := &fakeNodeInterface{}
|
||||||
|
@ -101,17 +101,17 @@ func validateObject(obj runtime.Object) (errors []error) {
|
|||||||
t.Namespace = api.NamespaceDefault
|
t.Namespace = api.NamespaceDefault
|
||||||
}
|
}
|
||||||
errors = validation.ValidateResourceQuota(t)
|
errors = validation.ValidateResourceQuota(t)
|
||||||
case *experimental.Deployment:
|
case *extensions.Deployment:
|
||||||
if t.Namespace == "" {
|
if t.Namespace == "" {
|
||||||
t.Namespace = api.NamespaceDefault
|
t.Namespace = api.NamespaceDefault
|
||||||
}
|
}
|
||||||
errors = expValidation.ValidateDeployment(t)
|
errors = expValidation.ValidateDeployment(t)
|
||||||
case *experimental.Job:
|
case *extensions.Job:
|
||||||
if t.Namespace == "" {
|
if t.Namespace == "" {
|
||||||
t.Namespace = api.NamespaceDefault
|
t.Namespace = api.NamespaceDefault
|
||||||
}
|
}
|
||||||
errors = expValidation.ValidateJob(t)
|
errors = expValidation.ValidateJob(t)
|
||||||
case *experimental.DaemonSet:
|
case *extensions.DaemonSet:
|
||||||
if t.Namespace == "" {
|
if t.Namespace == "" {
|
||||||
t.Namespace = api.NamespaceDefault
|
t.Namespace = api.NamespaceDefault
|
||||||
}
|
}
|
||||||
@ -221,10 +221,10 @@ func TestExampleObjectSchemas(t *testing.T) {
|
|||||||
"multi-pod": nil,
|
"multi-pod": nil,
|
||||||
"pod": &api.Pod{},
|
"pod": &api.Pod{},
|
||||||
"replication": &api.ReplicationController{},
|
"replication": &api.ReplicationController{},
|
||||||
"job": &experimental.Job{},
|
"job": &extensions.Job{},
|
||||||
},
|
},
|
||||||
"../docs/admin": {
|
"../docs/admin": {
|
||||||
"daemon": &experimental.DaemonSet{},
|
"daemon": &extensions.DaemonSet{},
|
||||||
},
|
},
|
||||||
"../examples": {
|
"../examples": {
|
||||||
"scheduler-policy-config": &schedulerapi.Policy{},
|
"scheduler-policy-config": &schedulerapi.Policy{},
|
||||||
@ -364,7 +364,7 @@ func TestExampleObjectSchemas(t *testing.T) {
|
|||||||
"fc": &api.Pod{},
|
"fc": &api.Pod{},
|
||||||
},
|
},
|
||||||
"../examples/experimental": {
|
"../examples/experimental": {
|
||||||
"deployment": &experimental.Deployment{},
|
"deployment": &extensions.Deployment{},
|
||||||
},
|
},
|
||||||
"../examples/javaweb-tomcat-sidecar": {
|
"../examples/javaweb-tomcat-sidecar": {
|
||||||
"javaweb": &api.Pod{},
|
"javaweb": &api.Pod{},
|
||||||
|
@ -126,15 +126,15 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
|||||||
c.FuzzNoCustom(j) // fuzz self without calling this function again
|
c.FuzzNoCustom(j) // fuzz self without calling this function again
|
||||||
//j.TemplateRef = nil // this is required for round trip
|
//j.TemplateRef = nil // this is required for round trip
|
||||||
},
|
},
|
||||||
func(j *experimental.DeploymentStrategy, c fuzz.Continue) {
|
func(j *extensions.DeploymentStrategy, c fuzz.Continue) {
|
||||||
c.FuzzNoCustom(j) // fuzz self without calling this function again
|
c.FuzzNoCustom(j) // fuzz self without calling this function again
|
||||||
// Ensure that strategyType is one of valid values.
|
// Ensure that strategyType is one of valid values.
|
||||||
strategyTypes := []experimental.DeploymentStrategyType{experimental.RecreateDeploymentStrategyType, experimental.RollingUpdateDeploymentStrategyType}
|
strategyTypes := []extensions.DeploymentStrategyType{extensions.RecreateDeploymentStrategyType, extensions.RollingUpdateDeploymentStrategyType}
|
||||||
j.Type = strategyTypes[c.Rand.Intn(len(strategyTypes))]
|
j.Type = strategyTypes[c.Rand.Intn(len(strategyTypes))]
|
||||||
if j.Type != experimental.RollingUpdateDeploymentStrategyType {
|
if j.Type != extensions.RollingUpdateDeploymentStrategyType {
|
||||||
j.RollingUpdate = nil
|
j.RollingUpdate = nil
|
||||||
} else {
|
} else {
|
||||||
rollingUpdate := experimental.RollingUpdateDeployment{}
|
rollingUpdate := extensions.RollingUpdateDeployment{}
|
||||||
if c.RandBool() {
|
if c.RandBool() {
|
||||||
rollingUpdate.MaxUnavailable = util.NewIntOrStringFromInt(int(c.RandUint64()))
|
rollingUpdate.MaxUnavailable = util.NewIntOrStringFromInt(int(c.RandUint64()))
|
||||||
rollingUpdate.MaxSurge = util.NewIntOrStringFromInt(int(c.RandUint64()))
|
rollingUpdate.MaxSurge = util.NewIntOrStringFromInt(int(c.RandUint64()))
|
||||||
@ -144,7 +144,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
|||||||
j.RollingUpdate = &rollingUpdate
|
j.RollingUpdate = &rollingUpdate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
func(j *experimental.JobSpec, c fuzz.Continue) {
|
func(j *extensions.JobSpec, c fuzz.Continue) {
|
||||||
c.FuzzNoCustom(j) // fuzz self without calling this function again
|
c.FuzzNoCustom(j) // fuzz self without calling this function again
|
||||||
completions := c.Rand.Int()
|
completions := c.Rand.Int()
|
||||||
parallelism := c.Rand.Int()
|
parallelism := c.Rand.Int()
|
||||||
@ -363,7 +363,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
|||||||
c.FuzzNoCustom(n)
|
c.FuzzNoCustom(n)
|
||||||
n.Spec.ExternalID = "external"
|
n.Spec.ExternalID = "external"
|
||||||
},
|
},
|
||||||
func(s *experimental.APIVersion, c fuzz.Continue) {
|
func(s *extensions.APIVersion, c fuzz.Continue) {
|
||||||
// We can't use c.RandString() here because it may generate empty
|
// We can't use c.RandString() here because it may generate empty
|
||||||
// string, which will cause tests failure.
|
// string, which will cause tests failure.
|
||||||
s.APIGroup = "something"
|
s.APIGroup = "something"
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestResourceVersioner(t *testing.T) {
|
func TestResourceVersioner(t *testing.T) {
|
||||||
daemonSet := experimental.DaemonSet{ObjectMeta: api.ObjectMeta{ResourceVersion: "10"}}
|
daemonSet := extensions.DaemonSet{ObjectMeta: api.ObjectMeta{ResourceVersion: "10"}}
|
||||||
version, err := accessor.ResourceVersion(&daemonSet)
|
version, err := accessor.ResourceVersion(&daemonSet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
@ -36,7 +36,7 @@ func TestResourceVersioner(t *testing.T) {
|
|||||||
t.Errorf("unexpected version %v", version)
|
t.Errorf("unexpected version %v", version)
|
||||||
}
|
}
|
||||||
|
|
||||||
daemonSetList := experimental.DaemonSetList{ListMeta: unversioned.ListMeta{ResourceVersion: "10"}}
|
daemonSetList := extensions.DaemonSetList{ListMeta: unversioned.ListMeta{ResourceVersion: "10"}}
|
||||||
version, err = accessor.ResourceVersion(&daemonSetList)
|
version, err = accessor.ResourceVersion(&daemonSetList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
@ -47,14 +47,14 @@ func TestResourceVersioner(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCodec(t *testing.T) {
|
func TestCodec(t *testing.T) {
|
||||||
daemonSet := experimental.DaemonSet{}
|
daemonSet := extensions.DaemonSet{}
|
||||||
// We do want to use package latest rather than testapi here, because we
|
// We do want to use package latest rather than testapi here, because we
|
||||||
// want to test if the package install and package latest work as expected.
|
// want to test if the package install and package latest work as expected.
|
||||||
data, err := latest.GroupOrDie("extensions").Codec.Encode(&daemonSet)
|
data, err := latest.GroupOrDie("extensions").Codec.Encode(&daemonSet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
other := experimental.DaemonSet{}
|
other := extensions.DaemonSet{}
|
||||||
if err := json.Unmarshal(data, &other); err != nil {
|
if err := json.Unmarshal(data, &other); err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ func TestRESTMapper(t *testing.T) {
|
|||||||
t.Errorf("unexpected codec: %#v, expected: %#v", mapping, interfaces)
|
t.Errorf("unexpected codec: %#v, expected: %#v", mapping, interfaces)
|
||||||
}
|
}
|
||||||
|
|
||||||
rc := &experimental.HorizontalPodAutoscaler{ObjectMeta: api.ObjectMeta{Name: "foo"}}
|
rc := &extensions.HorizontalPodAutoscaler{ObjectMeta: api.ObjectMeta{Name: "foo"}}
|
||||||
name, err := mapping.MetadataAccessor.Name(rc)
|
name, err := mapping.MetadataAccessor.Name(rc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
|
@ -51,7 +51,7 @@ func ValidateHorizontalPodAutoscalerName(name string, prefix bool) (bool, string
|
|||||||
return apivalidation.ValidateReplicationControllerName(name, prefix)
|
return apivalidation.ValidateReplicationControllerName(name, prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateHorizontalPodAutoscalerSpec(autoscaler experimental.HorizontalPodAutoscalerSpec) errs.ValidationErrorList {
|
func validateHorizontalPodAutoscalerSpec(autoscaler extensions.HorizontalPodAutoscalerSpec) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if autoscaler.MinReplicas < 0 {
|
if autoscaler.MinReplicas < 0 {
|
||||||
allErrs = append(allErrs, errs.NewFieldInvalid("minReplicas", autoscaler.MinReplicas, isNegativeErrorMsg))
|
allErrs = append(allErrs, errs.NewFieldInvalid("minReplicas", autoscaler.MinReplicas, isNegativeErrorMsg))
|
||||||
@ -73,25 +73,25 @@ func validateHorizontalPodAutoscalerSpec(autoscaler experimental.HorizontalPodAu
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateHorizontalPodAutoscaler(autoscaler *experimental.HorizontalPodAutoscaler) errs.ValidationErrorList {
|
func ValidateHorizontalPodAutoscaler(autoscaler *extensions.HorizontalPodAutoscaler) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&autoscaler.ObjectMeta, true, ValidateHorizontalPodAutoscalerName).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&autoscaler.ObjectMeta, true, ValidateHorizontalPodAutoscalerName).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(autoscaler.Spec)...)
|
allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(autoscaler.Spec)...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateHorizontalPodAutoscalerUpdate(newAutoscler, oldAutoscaler *experimental.HorizontalPodAutoscaler) errs.ValidationErrorList {
|
func ValidateHorizontalPodAutoscalerUpdate(newAutoscler, oldAutoscaler *extensions.HorizontalPodAutoscaler) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&newAutoscler.ObjectMeta, &oldAutoscaler.ObjectMeta).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&newAutoscler.ObjectMeta, &oldAutoscaler.ObjectMeta).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(newAutoscler.Spec)...)
|
allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(newAutoscler.Spec)...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateThirdPartyResourceUpdate(old, update *experimental.ThirdPartyResource) errs.ValidationErrorList {
|
func ValidateThirdPartyResourceUpdate(old, update *extensions.ThirdPartyResource) errs.ValidationErrorList {
|
||||||
return ValidateThirdPartyResource(update)
|
return ValidateThirdPartyResource(update)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateThirdPartyResource(obj *experimental.ThirdPartyResource) errs.ValidationErrorList {
|
func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if len(obj.Name) == 0 {
|
if len(obj.Name) == 0 {
|
||||||
allErrs = append(allErrs, errs.NewFieldInvalid("name", obj.Name, "name must be non-empty"))
|
allErrs = append(allErrs, errs.NewFieldInvalid("name", obj.Name, "name must be non-empty"))
|
||||||
@ -111,7 +111,7 @@ func ValidateThirdPartyResource(obj *experimental.ThirdPartyResource) errs.Valid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDaemonSet tests if required fields in the DaemonSet are set.
|
// ValidateDaemonSet tests if required fields in the DaemonSet are set.
|
||||||
func ValidateDaemonSet(controller *experimental.DaemonSet) errs.ValidationErrorList {
|
func ValidateDaemonSet(controller *extensions.DaemonSet) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&controller.ObjectMeta, true, apivalidation.ValidateReplicationControllerName).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&controller.ObjectMeta, true, apivalidation.ValidateReplicationControllerName).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec).Prefix("spec")...)
|
allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec).Prefix("spec")...)
|
||||||
@ -119,7 +119,7 @@ func ValidateDaemonSet(controller *experimental.DaemonSet) errs.ValidationErrorL
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDaemonSetUpdate tests if required fields in the DaemonSet are set.
|
// ValidateDaemonSetUpdate tests if required fields in the DaemonSet are set.
|
||||||
func ValidateDaemonSetUpdate(oldController, controller *experimental.DaemonSet) errs.ValidationErrorList {
|
func ValidateDaemonSetUpdate(oldController, controller *extensions.DaemonSet) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec).Prefix("spec")...)
|
allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec).Prefix("spec")...)
|
||||||
@ -128,7 +128,7 @@ func ValidateDaemonSetUpdate(oldController, controller *experimental.DaemonSet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validateDaemonSetStatus validates a DaemonSetStatus
|
// validateDaemonSetStatus validates a DaemonSetStatus
|
||||||
func validateDaemonSetStatus(status *experimental.DaemonSetStatus) errs.ValidationErrorList {
|
func validateDaemonSetStatus(status *extensions.DaemonSetStatus) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.CurrentNumberScheduled), "currentNumberScheduled")...)
|
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.CurrentNumberScheduled), "currentNumberScheduled")...)
|
||||||
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.NumberMisscheduled), "numberMisscheduled")...)
|
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.NumberMisscheduled), "numberMisscheduled")...)
|
||||||
@ -137,7 +137,7 @@ func validateDaemonSetStatus(status *experimental.DaemonSetStatus) errs.Validati
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDaemonSetStatus validates tests if required fields in the DaemonSet Status section
|
// ValidateDaemonSetStatus validates tests if required fields in the DaemonSet Status section
|
||||||
func ValidateDaemonSetStatusUpdate(controller, oldController *experimental.DaemonSet) errs.ValidationErrorList {
|
func ValidateDaemonSetStatusUpdate(controller, oldController *extensions.DaemonSet) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, validateDaemonSetStatus(&controller.Status)...)
|
allErrs = append(allErrs, validateDaemonSetStatus(&controller.Status)...)
|
||||||
@ -160,7 +160,7 @@ func ValidateDaemonSetTemplateUpdate(oldPodTemplate, podTemplate *api.PodTemplat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDaemonSetSpec tests if required fields in the DaemonSetSpec are set.
|
// ValidateDaemonSetSpec tests if required fields in the DaemonSetSpec are set.
|
||||||
func ValidateDaemonSetSpec(spec *experimental.DaemonSetSpec) errs.ValidationErrorList {
|
func ValidateDaemonSetSpec(spec *extensions.DaemonSetSpec) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
|
|
||||||
selector := labels.Set(spec.Selector).AsSelector()
|
selector := labels.Set(spec.Selector).AsSelector()
|
||||||
@ -237,7 +237,7 @@ func IsNotMoreThan100Percent(intOrStringValue util.IntOrString, fieldName string
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateRollingUpdateDeployment(rollingUpdate *experimental.RollingUpdateDeployment, fieldName string) errs.ValidationErrorList {
|
func ValidateRollingUpdateDeployment(rollingUpdate *extensions.RollingUpdateDeployment, fieldName string) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxUnavailable, fieldName+"maxUnavailable")...)
|
allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxUnavailable, fieldName+"maxUnavailable")...)
|
||||||
allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxSurge, fieldName+".maxSurge")...)
|
allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxSurge, fieldName+".maxSurge")...)
|
||||||
@ -251,22 +251,22 @@ func ValidateRollingUpdateDeployment(rollingUpdate *experimental.RollingUpdateDe
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateDeploymentStrategy(strategy *experimental.DeploymentStrategy, fieldName string) errs.ValidationErrorList {
|
func ValidateDeploymentStrategy(strategy *extensions.DeploymentStrategy, fieldName string) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if strategy.RollingUpdate == nil {
|
if strategy.RollingUpdate == nil {
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
switch strategy.Type {
|
switch strategy.Type {
|
||||||
case experimental.RecreateDeploymentStrategyType:
|
case extensions.RecreateDeploymentStrategyType:
|
||||||
allErrs = append(allErrs, errs.NewFieldForbidden("rollingUpdate", "rollingUpdate should be nil when strategy type is "+experimental.RecreateDeploymentStrategyType))
|
allErrs = append(allErrs, errs.NewFieldForbidden("rollingUpdate", "rollingUpdate should be nil when strategy type is "+extensions.RecreateDeploymentStrategyType))
|
||||||
case experimental.RollingUpdateDeploymentStrategyType:
|
case extensions.RollingUpdateDeploymentStrategyType:
|
||||||
allErrs = append(allErrs, ValidateRollingUpdateDeployment(strategy.RollingUpdate, "rollingUpdate")...)
|
allErrs = append(allErrs, ValidateRollingUpdateDeployment(strategy.RollingUpdate, "rollingUpdate")...)
|
||||||
}
|
}
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validates given deployment spec.
|
// Validates given deployment spec.
|
||||||
func ValidateDeploymentSpec(spec *experimental.DeploymentSpec) errs.ValidationErrorList {
|
func ValidateDeploymentSpec(spec *extensions.DeploymentSpec) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateNonEmptySelector(spec.Selector, "selector")...)
|
allErrs = append(allErrs, apivalidation.ValidateNonEmptySelector(spec.Selector, "selector")...)
|
||||||
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(spec.Replicas), "replicas")...)
|
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(spec.Replicas), "replicas")...)
|
||||||
@ -276,25 +276,25 @@ func ValidateDeploymentSpec(spec *experimental.DeploymentSpec) errs.ValidationEr
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateDeploymentUpdate(old, update *experimental.Deployment) errs.ValidationErrorList {
|
func ValidateDeploymentUpdate(old, update *extensions.Deployment) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, ValidateDeploymentSpec(&update.Spec).Prefix("spec")...)
|
allErrs = append(allErrs, ValidateDeploymentSpec(&update.Spec).Prefix("spec")...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateDeployment(obj *experimental.Deployment) errs.ValidationErrorList {
|
func ValidateDeployment(obj *extensions.Deployment) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, true, ValidateDeploymentName).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, true, ValidateDeploymentName).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, ValidateDeploymentSpec(&obj.Spec).Prefix("spec")...)
|
allErrs = append(allErrs, ValidateDeploymentSpec(&obj.Spec).Prefix("spec")...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateThirdPartyResourceDataUpdate(old, update *experimental.ThirdPartyResourceData) errs.ValidationErrorList {
|
func ValidateThirdPartyResourceDataUpdate(old, update *extensions.ThirdPartyResourceData) errs.ValidationErrorList {
|
||||||
return ValidateThirdPartyResourceData(update)
|
return ValidateThirdPartyResourceData(update)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateThirdPartyResourceData(obj *experimental.ThirdPartyResourceData) errs.ValidationErrorList {
|
func ValidateThirdPartyResourceData(obj *extensions.ThirdPartyResourceData) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if len(obj.Name) == 0 {
|
if len(obj.Name) == 0 {
|
||||||
allErrs = append(allErrs, errs.NewFieldInvalid("name", obj.Name, "name must be non-empty"))
|
allErrs = append(allErrs, errs.NewFieldInvalid("name", obj.Name, "name must be non-empty"))
|
||||||
@ -302,7 +302,7 @@ func ValidateThirdPartyResourceData(obj *experimental.ThirdPartyResourceData) er
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateJob(job *experimental.Job) errs.ValidationErrorList {
|
func ValidateJob(job *extensions.Job) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
// Jobs and rcs have the same name validation
|
// Jobs and rcs have the same name validation
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&job.ObjectMeta, true, apivalidation.ValidateReplicationControllerName).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&job.ObjectMeta, true, apivalidation.ValidateReplicationControllerName).Prefix("metadata")...)
|
||||||
@ -310,7 +310,7 @@ func ValidateJob(job *experimental.Job) errs.ValidationErrorList {
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateJobSpec(spec *experimental.JobSpec) errs.ValidationErrorList {
|
func ValidateJobSpec(spec *extensions.JobSpec) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
|
|
||||||
if spec.Parallelism != nil && *spec.Parallelism < 0 {
|
if spec.Parallelism != nil && *spec.Parallelism < 0 {
|
||||||
@ -342,7 +342,7 @@ func ValidateJobSpec(spec *experimental.JobSpec) errs.ValidationErrorList {
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateJobStatus(status *experimental.JobStatus) errs.ValidationErrorList {
|
func ValidateJobStatus(status *extensions.JobStatus) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Active), "active")...)
|
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Active), "active")...)
|
||||||
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Succeeded), "succeeded")...)
|
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Succeeded), "succeeded")...)
|
||||||
@ -350,21 +350,21 @@ func ValidateJobStatus(status *experimental.JobStatus) errs.ValidationErrorList
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateJobUpdate(oldJob, job *experimental.Job) errs.ValidationErrorList {
|
func ValidateJobUpdate(oldJob, job *extensions.Job) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, ValidateJobSpecUpdate(oldJob.Spec, job.Spec).Prefix("spec")...)
|
allErrs = append(allErrs, ValidateJobSpecUpdate(oldJob.Spec, job.Spec).Prefix("spec")...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateJobUpdateStatus(oldJob, job *experimental.Job) errs.ValidationErrorList {
|
func ValidateJobUpdateStatus(oldJob, job *extensions.Job) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, ValidateJobStatusUpdate(oldJob.Status, job.Status).Prefix("status")...)
|
allErrs = append(allErrs, ValidateJobStatusUpdate(oldJob.Status, job.Status).Prefix("status")...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateJobSpecUpdate(oldSpec, spec experimental.JobSpec) errs.ValidationErrorList {
|
func ValidateJobSpecUpdate(oldSpec, spec extensions.JobSpec) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, ValidateJobSpec(&spec)...)
|
allErrs = append(allErrs, ValidateJobSpec(&spec)...)
|
||||||
if !api.Semantic.DeepEqual(oldSpec.Completions, spec.Completions) {
|
if !api.Semantic.DeepEqual(oldSpec.Completions, spec.Completions) {
|
||||||
@ -379,14 +379,14 @@ func ValidateJobSpecUpdate(oldSpec, spec experimental.JobSpec) errs.ValidationEr
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateJobStatusUpdate(oldStatus, status experimental.JobStatus) errs.ValidationErrorList {
|
func ValidateJobStatusUpdate(oldStatus, status extensions.JobStatus) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, ValidateJobStatus(&status)...)
|
allErrs = append(allErrs, ValidateJobStatus(&status)...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateIngress tests if required fields in the Ingress are set.
|
// ValidateIngress tests if required fields in the Ingress are set.
|
||||||
func ValidateIngress(ingress *experimental.Ingress) errs.ValidationErrorList {
|
func ValidateIngress(ingress *extensions.Ingress) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&ingress.ObjectMeta, true, ValidateIngressName).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&ingress.ObjectMeta, true, ValidateIngressName).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec).Prefix("spec")...)
|
allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec).Prefix("spec")...)
|
||||||
@ -399,7 +399,7 @@ func ValidateIngressName(name string, prefix bool) (bool, string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateIngressSpec tests if required fields in the IngressSpec are set.
|
// ValidateIngressSpec tests if required fields in the IngressSpec are set.
|
||||||
func ValidateIngressSpec(spec *experimental.IngressSpec) errs.ValidationErrorList {
|
func ValidateIngressSpec(spec *extensions.IngressSpec) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
// TODO: Is a default backend mandatory?
|
// TODO: Is a default backend mandatory?
|
||||||
if spec.Backend != nil {
|
if spec.Backend != nil {
|
||||||
@ -414,14 +414,14 @@ func ValidateIngressSpec(spec *experimental.IngressSpec) errs.ValidationErrorLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateIngressUpdate tests if required fields in the Ingress are set.
|
// ValidateIngressUpdate tests if required fields in the Ingress are set.
|
||||||
func ValidateIngressUpdate(oldIngress, ingress *experimental.Ingress) errs.ValidationErrorList {
|
func ValidateIngressUpdate(oldIngress, ingress *extensions.Ingress) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&ingress.ObjectMeta, &oldIngress.ObjectMeta).Prefix("metadata")...)
|
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&ingress.ObjectMeta, &oldIngress.ObjectMeta).Prefix("metadata")...)
|
||||||
allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec).Prefix("spec")...)
|
allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec).Prefix("spec")...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateIngressRules(IngressRules []experimental.IngressRule) errs.ValidationErrorList {
|
func validateIngressRules(IngressRules []extensions.IngressRule) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if len(IngressRules) == 0 {
|
if len(IngressRules) == 0 {
|
||||||
return append(allErrs, errs.NewFieldRequired("IngressRules"))
|
return append(allErrs, errs.NewFieldRequired("IngressRules"))
|
||||||
@ -442,7 +442,7 @@ func validateIngressRules(IngressRules []experimental.IngressRule) errs.Validati
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateIngressRuleValue(ingressRule *experimental.IngressRuleValue) errs.ValidationErrorList {
|
func validateIngressRuleValue(ingressRule *extensions.IngressRuleValue) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if ingressRule.HTTP != nil {
|
if ingressRule.HTTP != nil {
|
||||||
allErrs = append(allErrs, validateHTTPIngressRuleValue(ingressRule.HTTP).Prefix("http")...)
|
allErrs = append(allErrs, validateHTTPIngressRuleValue(ingressRule.HTTP).Prefix("http")...)
|
||||||
@ -450,7 +450,7 @@ func validateIngressRuleValue(ingressRule *experimental.IngressRuleValue) errs.V
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateHTTPIngressRuleValue(httpIngressRuleValue *experimental.HTTPIngressRuleValue) errs.ValidationErrorList {
|
func validateHTTPIngressRuleValue(httpIngressRuleValue *extensions.HTTPIngressRuleValue) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if len(httpIngressRuleValue.Paths) == 0 {
|
if len(httpIngressRuleValue.Paths) == 0 {
|
||||||
allErrs = append(allErrs, errs.NewFieldRequired("paths"))
|
allErrs = append(allErrs, errs.NewFieldRequired("paths"))
|
||||||
@ -480,7 +480,7 @@ func validateHTTPIngressRuleValue(httpIngressRuleValue *experimental.HTTPIngress
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validateIngressBackend tests if a given backend is valid.
|
// validateIngressBackend tests if a given backend is valid.
|
||||||
func validateIngressBackend(backend *experimental.IngressBackend) errs.ValidationErrorList {
|
func validateIngressBackend(backend *extensions.IngressBackend) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
|
|
||||||
// All backends must reference a single local service by name, and a single service port by name or number.
|
// All backends must reference a single local service by name, and a single service port by name or number.
|
||||||
@ -502,7 +502,7 @@ func validateIngressBackend(backend *experimental.IngressBackend) errs.Validatio
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateClusterAutoscalerSpec(spec experimental.ClusterAutoscalerSpec) errs.ValidationErrorList {
|
func validateClusterAutoscalerSpec(spec extensions.ClusterAutoscalerSpec) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if spec.MinNodes < 0 {
|
if spec.MinNodes < 0 {
|
||||||
allErrs = append(allErrs, errs.NewFieldInvalid("minNodes", spec.MinNodes, `must be non-negative`))
|
allErrs = append(allErrs, errs.NewFieldInvalid("minNodes", spec.MinNodes, `must be non-negative`))
|
||||||
@ -527,7 +527,7 @@ func validateClusterAutoscalerSpec(spec experimental.ClusterAutoscalerSpec) errs
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateClusterAutoscaler(autoscaler *experimental.ClusterAutoscaler) errs.ValidationErrorList {
|
func ValidateClusterAutoscaler(autoscaler *extensions.ClusterAutoscaler) errs.ValidationErrorList {
|
||||||
allErrs := errs.ValidationErrorList{}
|
allErrs := errs.ValidationErrorList{}
|
||||||
if autoscaler.Name != "ClusterAutoscaler" {
|
if autoscaler.Name != "ClusterAutoscaler" {
|
||||||
allErrs = append(allErrs, errs.NewFieldInvalid("name", autoscaler.Name, `name must be ClusterAutoscaler`))
|
allErrs = append(allErrs, errs.NewFieldInvalid("name", autoscaler.Name, `name must be ClusterAutoscaler`))
|
||||||
|
@ -29,19 +29,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||||
successCases := []experimental.HorizontalPodAutoscaler{
|
successCases := []extensions.HorizontalPodAutoscaler{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "myautoscaler",
|
Name: "myautoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Subresource: "scale",
|
Subresource: "scale",
|
||||||
},
|
},
|
||||||
MinReplicas: 1,
|
MinReplicas: 1,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -51,19 +51,19 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
errorCases := map[string]experimental.HorizontalPodAutoscaler{
|
errorCases := map[string]extensions.HorizontalPodAutoscaler{
|
||||||
"must be non-negative": {
|
"must be non-negative": {
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "myautoscaler",
|
Name: "myautoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Subresource: "scale",
|
Subresource: "scale",
|
||||||
},
|
},
|
||||||
MinReplicas: -1,
|
MinReplicas: -1,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"must be bigger or equal to minReplicas": {
|
"must be bigger or equal to minReplicas": {
|
||||||
@ -71,13 +71,13 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
|||||||
Name: "myautoscaler",
|
Name: "myautoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Subresource: "scale",
|
Subresource: "scale",
|
||||||
},
|
},
|
||||||
MinReplicas: 7,
|
MinReplicas: 7,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"invalid value": {
|
"invalid value": {
|
||||||
@ -85,13 +85,13 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
|||||||
Name: "myautoscaler",
|
Name: "myautoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Subresource: "scale",
|
Subresource: "scale",
|
||||||
},
|
},
|
||||||
MinReplicas: 1,
|
MinReplicas: 1,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("-0.8")},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("-0.8")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"resource not supported": {
|
"resource not supported": {
|
||||||
@ -99,13 +99,13 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
|||||||
Name: "myautoscaler",
|
Name: "myautoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Subresource: "scale",
|
Subresource: "scale",
|
||||||
},
|
},
|
||||||
MinReplicas: 1,
|
MinReplicas: 1,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceName("NotSupportedResource"), Quantity: resource.MustParse("0.8")},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceName("NotSupportedResource"), Quantity: resource.MustParse("0.8")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"required value": {
|
"required value": {
|
||||||
@ -113,10 +113,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
|||||||
Name: "myautoscaler",
|
Name: "myautoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
MinReplicas: 1,
|
MinReplicas: 1,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -133,23 +133,23 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
|||||||
|
|
||||||
func TestValidateDaemonSetStatusUpdate(t *testing.T) {
|
func TestValidateDaemonSetStatusUpdate(t *testing.T) {
|
||||||
type dsUpdateTest struct {
|
type dsUpdateTest struct {
|
||||||
old experimental.DaemonSet
|
old extensions.DaemonSet
|
||||||
update experimental.DaemonSet
|
update extensions.DaemonSet
|
||||||
}
|
}
|
||||||
|
|
||||||
successCases := []dsUpdateTest{
|
successCases := []dsUpdateTest{
|
||||||
{
|
{
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Status: experimental.DaemonSetStatus{
|
Status: extensions.DaemonSetStatus{
|
||||||
CurrentNumberScheduled: 1,
|
CurrentNumberScheduled: 1,
|
||||||
NumberMisscheduled: 2,
|
NumberMisscheduled: 2,
|
||||||
DesiredNumberScheduled: 3,
|
DesiredNumberScheduled: 3,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Status: experimental.DaemonSetStatus{
|
Status: extensions.DaemonSetStatus{
|
||||||
CurrentNumberScheduled: 1,
|
CurrentNumberScheduled: 1,
|
||||||
NumberMisscheduled: 1,
|
NumberMisscheduled: 1,
|
||||||
DesiredNumberScheduled: 3,
|
DesiredNumberScheduled: 3,
|
||||||
@ -168,17 +168,17 @@ func TestValidateDaemonSetStatusUpdate(t *testing.T) {
|
|||||||
|
|
||||||
errorCases := map[string]dsUpdateTest{
|
errorCases := map[string]dsUpdateTest{
|
||||||
"negative values": {
|
"negative values": {
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Status: experimental.DaemonSetStatus{
|
Status: extensions.DaemonSetStatus{
|
||||||
CurrentNumberScheduled: 1,
|
CurrentNumberScheduled: 1,
|
||||||
NumberMisscheduled: 2,
|
NumberMisscheduled: 2,
|
||||||
DesiredNumberScheduled: 3,
|
DesiredNumberScheduled: 3,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Status: experimental.DaemonSetStatus{
|
Status: extensions.DaemonSetStatus{
|
||||||
CurrentNumberScheduled: -1,
|
CurrentNumberScheduled: -1,
|
||||||
NumberMisscheduled: -1,
|
NumberMisscheduled: -1,
|
||||||
DesiredNumberScheduled: -3,
|
DesiredNumberScheduled: -3,
|
||||||
@ -277,53 +277,53 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type dsUpdateTest struct {
|
type dsUpdateTest struct {
|
||||||
old experimental.DaemonSet
|
old extensions.DaemonSet
|
||||||
update experimental.DaemonSet
|
update extensions.DaemonSet
|
||||||
}
|
}
|
||||||
successCases := []dsUpdateTest{
|
successCases := []dsUpdateTest{
|
||||||
{
|
{
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector2,
|
Selector: validSelector2,
|
||||||
Template: &validPodTemplateAbc2.Template,
|
Template: &validPodTemplateAbc2.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateNodeSelector.Template,
|
Template: &validPodTemplateNodeSelector.Template,
|
||||||
},
|
},
|
||||||
@ -339,80 +339,80 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
errorCases := map[string]dsUpdateTest{
|
errorCases := map[string]dsUpdateTest{
|
||||||
"change daemon name": {
|
"change daemon name": {
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"invalid selector": {
|
"invalid selector": {
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: invalidSelector,
|
Selector: invalidSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"invalid pod": {
|
"invalid pod": {
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &invalidPodTemplate.Template,
|
Template: &invalidPodTemplate.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"change container image": {
|
"change container image": {
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateDef.Template,
|
Template: &validPodTemplateDef.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"read-write volume": {
|
"read-write volume": {
|
||||||
old: experimental.DaemonSet{
|
old: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateAbc.Template,
|
Template: &validPodTemplateAbc.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: experimental.DaemonSet{
|
update: extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &readWriteVolumePodTemplate.Template,
|
Template: &readWriteVolumePodTemplate.Template,
|
||||||
},
|
},
|
||||||
@ -452,17 +452,17 @@ func TestValidateDaemonSet(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
successCases := []experimental.DaemonSet{
|
successCases := []extensions.DaemonSet{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplate.Template,
|
Template: &validPodTemplate.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc-123", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc-123", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplate.Template,
|
Template: &validPodTemplate.Template,
|
||||||
},
|
},
|
||||||
@ -474,37 +474,37 @@ func TestValidateDaemonSet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
errorCases := map[string]experimental.DaemonSet{
|
errorCases := map[string]extensions.DaemonSet{
|
||||||
"zero-length ID": {
|
"zero-length ID": {
|
||||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplate.Template,
|
Template: &validPodTemplate.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"missing-namespace": {
|
"missing-namespace": {
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc-123"},
|
ObjectMeta: api.ObjectMeta{Name: "abc-123"},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplate.Template,
|
Template: &validPodTemplate.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"empty selector": {
|
"empty selector": {
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Template: &validPodTemplate.Template,
|
Template: &validPodTemplate.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"selector_doesnt_match": {
|
"selector_doesnt_match": {
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: map[string]string{"foo": "bar"},
|
Selector: map[string]string{"foo": "bar"},
|
||||||
Template: &validPodTemplate.Template,
|
Template: &validPodTemplate.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"invalid manifest": {
|
"invalid manifest": {
|
||||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -516,7 +516,7 @@ func TestValidateDaemonSet(t *testing.T) {
|
|||||||
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplate.Template,
|
Template: &validPodTemplate.Template,
|
||||||
},
|
},
|
||||||
@ -529,7 +529,7 @@ func TestValidateDaemonSet(t *testing.T) {
|
|||||||
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Template: &invalidPodTemplate.Template,
|
Template: &invalidPodTemplate.Template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -541,7 +541,7 @@ func TestValidateDaemonSet(t *testing.T) {
|
|||||||
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplate.Template,
|
Template: &validPodTemplate.Template,
|
||||||
},
|
},
|
||||||
@ -551,7 +551,7 @@ func TestValidateDaemonSet(t *testing.T) {
|
|||||||
Name: "abc-123",
|
Name: "abc-123",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
@ -570,7 +570,7 @@ func TestValidateDaemonSet(t *testing.T) {
|
|||||||
Name: "abc-123",
|
Name: "abc-123",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
@ -607,13 +607,13 @@ func TestValidateDaemonSet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func validDeployment() *experimental.Deployment {
|
func validDeployment() *extensions.Deployment {
|
||||||
return &experimental.Deployment{
|
return &extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Selector: map[string]string{
|
Selector: map[string]string{
|
||||||
"name": "abc",
|
"name": "abc",
|
||||||
},
|
},
|
||||||
@ -643,7 +643,7 @@ func validDeployment() *experimental.Deployment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateDeployment(t *testing.T) {
|
func TestValidateDeployment(t *testing.T) {
|
||||||
successCases := []*experimental.Deployment{
|
successCases := []*extensions.Deployment{
|
||||||
validDeployment(),
|
validDeployment(),
|
||||||
}
|
}
|
||||||
for _, successCase := range successCases {
|
for _, successCase := range successCases {
|
||||||
@ -652,8 +652,8 @@ func TestValidateDeployment(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
errorCases := map[string]*experimental.Deployment{}
|
errorCases := map[string]*extensions.Deployment{}
|
||||||
errorCases["metadata.name: required value"] = &experimental.Deployment{
|
errorCases["metadata.name: required value"] = &extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
@ -677,17 +677,17 @@ func TestValidateDeployment(t *testing.T) {
|
|||||||
|
|
||||||
// rollingUpdate should be nil for recreate.
|
// rollingUpdate should be nil for recreate.
|
||||||
invalidRecreateDeployment := validDeployment()
|
invalidRecreateDeployment := validDeployment()
|
||||||
invalidRecreateDeployment.Spec.Strategy = experimental.DeploymentStrategy{
|
invalidRecreateDeployment.Spec.Strategy = extensions.DeploymentStrategy{
|
||||||
Type: experimental.RecreateDeploymentStrategyType,
|
Type: extensions.RecreateDeploymentStrategyType,
|
||||||
RollingUpdate: &experimental.RollingUpdateDeployment{},
|
RollingUpdate: &extensions.RollingUpdateDeployment{},
|
||||||
}
|
}
|
||||||
errorCases["rollingUpdate should be nil when strategy type is Recreate"] = invalidRecreateDeployment
|
errorCases["rollingUpdate should be nil when strategy type is Recreate"] = invalidRecreateDeployment
|
||||||
|
|
||||||
// MaxSurge should be in the form of 20%.
|
// MaxSurge should be in the form of 20%.
|
||||||
invalidMaxSurgeDeployment := validDeployment()
|
invalidMaxSurgeDeployment := validDeployment()
|
||||||
invalidMaxSurgeDeployment.Spec.Strategy = experimental.DeploymentStrategy{
|
invalidMaxSurgeDeployment.Spec.Strategy = extensions.DeploymentStrategy{
|
||||||
Type: experimental.RollingUpdateDeploymentStrategyType,
|
Type: extensions.RollingUpdateDeploymentStrategyType,
|
||||||
RollingUpdate: &experimental.RollingUpdateDeployment{
|
RollingUpdate: &extensions.RollingUpdateDeployment{
|
||||||
MaxSurge: util.NewIntOrStringFromString("20Percent"),
|
MaxSurge: util.NewIntOrStringFromString("20Percent"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -695,9 +695,9 @@ func TestValidateDeployment(t *testing.T) {
|
|||||||
|
|
||||||
// MaxSurge and MaxUnavailable cannot both be zero.
|
// MaxSurge and MaxUnavailable cannot both be zero.
|
||||||
invalidRollingUpdateDeployment := validDeployment()
|
invalidRollingUpdateDeployment := validDeployment()
|
||||||
invalidRollingUpdateDeployment.Spec.Strategy = experimental.DeploymentStrategy{
|
invalidRollingUpdateDeployment.Spec.Strategy = extensions.DeploymentStrategy{
|
||||||
Type: experimental.RollingUpdateDeploymentStrategyType,
|
Type: extensions.RollingUpdateDeploymentStrategyType,
|
||||||
RollingUpdate: &experimental.RollingUpdateDeployment{
|
RollingUpdate: &extensions.RollingUpdateDeployment{
|
||||||
MaxSurge: util.NewIntOrStringFromString("0%"),
|
MaxSurge: util.NewIntOrStringFromString("0%"),
|
||||||
MaxUnavailable: util.NewIntOrStringFromInt(0),
|
MaxUnavailable: util.NewIntOrStringFromInt(0),
|
||||||
},
|
},
|
||||||
@ -706,9 +706,9 @@ func TestValidateDeployment(t *testing.T) {
|
|||||||
|
|
||||||
// MaxUnavailable should not be more than 100%.
|
// MaxUnavailable should not be more than 100%.
|
||||||
invalidMaxUnavailableDeployment := validDeployment()
|
invalidMaxUnavailableDeployment := validDeployment()
|
||||||
invalidMaxUnavailableDeployment.Spec.Strategy = experimental.DeploymentStrategy{
|
invalidMaxUnavailableDeployment.Spec.Strategy = extensions.DeploymentStrategy{
|
||||||
Type: experimental.RollingUpdateDeploymentStrategyType,
|
Type: extensions.RollingUpdateDeploymentStrategyType,
|
||||||
RollingUpdate: &experimental.RollingUpdateDeployment{
|
RollingUpdate: &extensions.RollingUpdateDeployment{
|
||||||
MaxUnavailable: util.NewIntOrStringFromString("110%"),
|
MaxUnavailable: util.NewIntOrStringFromString("110%"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -736,13 +736,13 @@ func TestValidateJob(t *testing.T) {
|
|||||||
Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}},
|
Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
successCases := []experimental.Job{
|
successCases := []extensions.Job{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateSpec,
|
Template: &validPodTemplateSpec,
|
||||||
},
|
},
|
||||||
@ -754,13 +754,13 @@ func TestValidateJob(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
negative := -1
|
negative := -1
|
||||||
errorCases := map[string]experimental.Job{
|
errorCases := map[string]extensions.Job{
|
||||||
"spec.parallelism:must be non-negative": {
|
"spec.parallelism:must be non-negative": {
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &negative,
|
Parallelism: &negative,
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateSpec,
|
Template: &validPodTemplateSpec,
|
||||||
@ -771,7 +771,7 @@ func TestValidateJob(t *testing.T) {
|
|||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Completions: &negative,
|
Completions: &negative,
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateSpec,
|
Template: &validPodTemplateSpec,
|
||||||
@ -782,7 +782,7 @@ func TestValidateJob(t *testing.T) {
|
|||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: map[string]string{},
|
Selector: map[string]string{},
|
||||||
Template: &validPodTemplateSpec,
|
Template: &validPodTemplateSpec,
|
||||||
},
|
},
|
||||||
@ -792,7 +792,7 @@ func TestValidateJob(t *testing.T) {
|
|||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -801,7 +801,7 @@ func TestValidateJob(t *testing.T) {
|
|||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -820,7 +820,7 @@ func TestValidateJob(t *testing.T) {
|
|||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -853,28 +853,28 @@ func TestValidateJob(t *testing.T) {
|
|||||||
type ingressRules map[string]string
|
type ingressRules map[string]string
|
||||||
|
|
||||||
func TestValidateIngress(t *testing.T) {
|
func TestValidateIngress(t *testing.T) {
|
||||||
defaultBackend := experimental.IngressBackend{
|
defaultBackend := extensions.IngressBackend{
|
||||||
ServiceName: "default-backend",
|
ServiceName: "default-backend",
|
||||||
ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80},
|
ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80},
|
||||||
}
|
}
|
||||||
|
|
||||||
newValid := func() experimental.Ingress {
|
newValid := func() extensions.Ingress {
|
||||||
return experimental.Ingress{
|
return extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.IngressSpec{
|
Spec: extensions.IngressSpec{
|
||||||
Backend: &experimental.IngressBackend{
|
Backend: &extensions.IngressBackend{
|
||||||
ServiceName: "default-backend",
|
ServiceName: "default-backend",
|
||||||
ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80},
|
ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80},
|
||||||
},
|
},
|
||||||
Rules: []experimental.IngressRule{
|
Rules: []extensions.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "foo.bar.com",
|
Host: "foo.bar.com",
|
||||||
IngressRuleValue: experimental.IngressRuleValue{
|
IngressRuleValue: extensions.IngressRuleValue{
|
||||||
HTTP: &experimental.HTTPIngressRuleValue{
|
HTTP: &extensions.HTTPIngressRuleValue{
|
||||||
Paths: []experimental.HTTPIngressPath{
|
Paths: []extensions.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Path: "/foo",
|
Path: "/foo",
|
||||||
Backend: defaultBackend,
|
Backend: defaultBackend,
|
||||||
@ -885,7 +885,7 @@ func TestValidateIngress(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Status: experimental.IngressStatus{
|
Status: extensions.IngressStatus{
|
||||||
LoadBalancer: api.LoadBalancerStatus{
|
LoadBalancer: api.LoadBalancerStatus{
|
||||||
Ingress: []api.LoadBalancerIngress{
|
Ingress: []api.LoadBalancerIngress{
|
||||||
{IP: "127.0.0.1"},
|
{IP: "127.0.0.1"},
|
||||||
@ -899,21 +899,21 @@ func TestValidateIngress(t *testing.T) {
|
|||||||
invalidNameBackend := newValid()
|
invalidNameBackend := newValid()
|
||||||
invalidNameBackend.Spec.Backend.ServiceName = "defaultBackend"
|
invalidNameBackend.Spec.Backend.ServiceName = "defaultBackend"
|
||||||
noPortBackend := newValid()
|
noPortBackend := newValid()
|
||||||
noPortBackend.Spec.Backend = &experimental.IngressBackend{ServiceName: defaultBackend.ServiceName}
|
noPortBackend.Spec.Backend = &extensions.IngressBackend{ServiceName: defaultBackend.ServiceName}
|
||||||
noForwardSlashPath := newValid()
|
noForwardSlashPath := newValid()
|
||||||
noForwardSlashPath.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []experimental.HTTPIngressPath{
|
noForwardSlashPath.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []extensions.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Path: "invalid",
|
Path: "invalid",
|
||||||
Backend: defaultBackend,
|
Backend: defaultBackend,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
noPaths := newValid()
|
noPaths := newValid()
|
||||||
noPaths.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []experimental.HTTPIngressPath{}
|
noPaths.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []extensions.HTTPIngressPath{}
|
||||||
badHost := newValid()
|
badHost := newValid()
|
||||||
badHost.Spec.Rules[0].Host = "foobar:80"
|
badHost.Spec.Rules[0].Host = "foobar:80"
|
||||||
badRegexPath := newValid()
|
badRegexPath := newValid()
|
||||||
badPathExpr := "/invalid["
|
badPathExpr := "/invalid["
|
||||||
badRegexPath.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []experimental.HTTPIngressPath{
|
badRegexPath.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []extensions.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Path: badPathExpr,
|
Path: badPathExpr,
|
||||||
Backend: defaultBackend,
|
Backend: defaultBackend,
|
||||||
@ -926,7 +926,7 @@ func TestValidateIngress(t *testing.T) {
|
|||||||
badHostIP.Spec.Rules[0].Host = hostIP
|
badHostIP.Spec.Rules[0].Host = hostIP
|
||||||
badHostIPErr := fmt.Sprintf("spec.rules.host: invalid value '%v'", hostIP)
|
badHostIPErr := fmt.Sprintf("spec.rules.host: invalid value '%v'", hostIP)
|
||||||
|
|
||||||
errorCases := map[string]experimental.Ingress{
|
errorCases := map[string]extensions.Ingress{
|
||||||
"spec.backend.serviceName: required value": servicelessBackend,
|
"spec.backend.serviceName: required value": servicelessBackend,
|
||||||
"spec.backend.serviceName: invalid value": invalidNameBackend,
|
"spec.backend.serviceName: invalid value": invalidNameBackend,
|
||||||
"spec.backend.servicePort: invalid value": noPortBackend,
|
"spec.backend.servicePort: invalid value": noPortBackend,
|
||||||
@ -952,18 +952,18 @@ func TestValidateIngress(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateClusterAutoscaler(t *testing.T) {
|
func TestValidateClusterAutoscaler(t *testing.T) {
|
||||||
successCases := []experimental.ClusterAutoscaler{
|
successCases := []extensions.ClusterAutoscaler{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "ClusterAutoscaler",
|
Name: "ClusterAutoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.ClusterAutoscalerSpec{
|
Spec: extensions.ClusterAutoscalerSpec{
|
||||||
MinNodes: 1,
|
MinNodes: 1,
|
||||||
MaxNodes: 5,
|
MaxNodes: 5,
|
||||||
TargetUtilization: []experimental.NodeUtilization{
|
TargetUtilization: []extensions.NodeUtilization{
|
||||||
{
|
{
|
||||||
Resource: experimental.CpuRequest,
|
Resource: extensions.CpuRequest,
|
||||||
Value: 0.7,
|
Value: 0.7,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -976,18 +976,18 @@ func TestValidateClusterAutoscaler(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
errorCases := map[string]experimental.ClusterAutoscaler{
|
errorCases := map[string]extensions.ClusterAutoscaler{
|
||||||
"name must be ClusterAutoscaler": {
|
"name must be ClusterAutoscaler": {
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "TestClusterAutoscaler",
|
Name: "TestClusterAutoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.ClusterAutoscalerSpec{
|
Spec: extensions.ClusterAutoscalerSpec{
|
||||||
MinNodes: 1,
|
MinNodes: 1,
|
||||||
MaxNodes: 5,
|
MaxNodes: 5,
|
||||||
TargetUtilization: []experimental.NodeUtilization{
|
TargetUtilization: []extensions.NodeUtilization{
|
||||||
{
|
{
|
||||||
Resource: experimental.CpuRequest,
|
Resource: extensions.CpuRequest,
|
||||||
Value: 0.7,
|
Value: 0.7,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -998,12 +998,12 @@ func TestValidateClusterAutoscaler(t *testing.T) {
|
|||||||
Name: "ClusterAutoscaler",
|
Name: "ClusterAutoscaler",
|
||||||
Namespace: "test",
|
Namespace: "test",
|
||||||
},
|
},
|
||||||
Spec: experimental.ClusterAutoscalerSpec{
|
Spec: extensions.ClusterAutoscalerSpec{
|
||||||
MinNodes: 1,
|
MinNodes: 1,
|
||||||
MaxNodes: 5,
|
MaxNodes: 5,
|
||||||
TargetUtilization: []experimental.NodeUtilization{
|
TargetUtilization: []extensions.NodeUtilization{
|
||||||
{
|
{
|
||||||
Resource: experimental.CpuRequest,
|
Resource: extensions.CpuRequest,
|
||||||
Value: 0.7,
|
Value: 0.7,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1015,12 +1015,12 @@ func TestValidateClusterAutoscaler(t *testing.T) {
|
|||||||
Name: "ClusterAutoscaler",
|
Name: "ClusterAutoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.ClusterAutoscalerSpec{
|
Spec: extensions.ClusterAutoscalerSpec{
|
||||||
MinNodes: -1,
|
MinNodes: -1,
|
||||||
MaxNodes: 5,
|
MaxNodes: 5,
|
||||||
TargetUtilization: []experimental.NodeUtilization{
|
TargetUtilization: []extensions.NodeUtilization{
|
||||||
{
|
{
|
||||||
Resource: experimental.CpuRequest,
|
Resource: extensions.CpuRequest,
|
||||||
Value: 0.7,
|
Value: 0.7,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1031,12 +1031,12 @@ func TestValidateClusterAutoscaler(t *testing.T) {
|
|||||||
Name: "ClusterAutoscaler",
|
Name: "ClusterAutoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.ClusterAutoscalerSpec{
|
Spec: extensions.ClusterAutoscalerSpec{
|
||||||
MinNodes: 10,
|
MinNodes: 10,
|
||||||
MaxNodes: 5,
|
MaxNodes: 5,
|
||||||
TargetUtilization: []experimental.NodeUtilization{
|
TargetUtilization: []extensions.NodeUtilization{
|
||||||
{
|
{
|
||||||
Resource: experimental.CpuRequest,
|
Resource: extensions.CpuRequest,
|
||||||
Value: 0.7,
|
Value: 0.7,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1047,10 +1047,10 @@ func TestValidateClusterAutoscaler(t *testing.T) {
|
|||||||
Name: "ClusterAutoscaler",
|
Name: "ClusterAutoscaler",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.ClusterAutoscalerSpec{
|
Spec: extensions.ClusterAutoscalerSpec{
|
||||||
MinNodes: 1,
|
MinNodes: 1,
|
||||||
MaxNodes: 5,
|
MaxNodes: 5,
|
||||||
TargetUtilization: []experimental.NodeUtilization{},
|
TargetUtilization: []extensions.NodeUtilization{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
24
pkg/client/cache/listers.go
vendored
24
pkg/client/cache/listers.go
vendored
@ -232,7 +232,7 @@ type StoreToDaemonSetLister struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exists checks if the given daemon set exists in the store.
|
// Exists checks if the given daemon set exists in the store.
|
||||||
func (s *StoreToDaemonSetLister) Exists(ds *experimental.DaemonSet) (bool, error) {
|
func (s *StoreToDaemonSetLister) Exists(ds *extensions.DaemonSet) (bool, error) {
|
||||||
_, exists, err := s.Store.Get(ds)
|
_, exists, err := s.Store.Get(ds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -242,18 +242,18 @@ func (s *StoreToDaemonSetLister) Exists(ds *experimental.DaemonSet) (bool, error
|
|||||||
|
|
||||||
// List lists all daemon sets in the store.
|
// List lists all daemon sets in the store.
|
||||||
// TODO: converge on the interface in pkg/client
|
// TODO: converge on the interface in pkg/client
|
||||||
func (s *StoreToDaemonSetLister) List() (dss []experimental.DaemonSet, err error) {
|
func (s *StoreToDaemonSetLister) List() (dss []extensions.DaemonSet, err error) {
|
||||||
for _, c := range s.Store.List() {
|
for _, c := range s.Store.List() {
|
||||||
dss = append(dss, *(c.(*experimental.DaemonSet)))
|
dss = append(dss, *(c.(*extensions.DaemonSet)))
|
||||||
}
|
}
|
||||||
return dss, nil
|
return dss, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPodDaemonSets returns a list of daemon sets managing a pod.
|
// GetPodDaemonSets returns a list of daemon sets managing a pod.
|
||||||
// Returns an error if and only if no matching daemon sets are found.
|
// Returns an error if and only if no matching daemon sets are found.
|
||||||
func (s *StoreToDaemonSetLister) GetPodDaemonSets(pod *api.Pod) (daemonSets []experimental.DaemonSet, err error) {
|
func (s *StoreToDaemonSetLister) GetPodDaemonSets(pod *api.Pod) (daemonSets []extensions.DaemonSet, err error) {
|
||||||
var selector labels.Selector
|
var selector labels.Selector
|
||||||
var daemonSet experimental.DaemonSet
|
var daemonSet extensions.DaemonSet
|
||||||
|
|
||||||
if len(pod.Labels) == 0 {
|
if len(pod.Labels) == 0 {
|
||||||
err = fmt.Errorf("No daemon sets found for pod %v because it has no labels", pod.Name)
|
err = fmt.Errorf("No daemon sets found for pod %v because it has no labels", pod.Name)
|
||||||
@ -261,7 +261,7 @@ func (s *StoreToDaemonSetLister) GetPodDaemonSets(pod *api.Pod) (daemonSets []ex
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, m := range s.Store.List() {
|
for _, m := range s.Store.List() {
|
||||||
daemonSet = *m.(*experimental.DaemonSet)
|
daemonSet = *m.(*extensions.DaemonSet)
|
||||||
if daemonSet.Namespace != pod.Namespace {
|
if daemonSet.Namespace != pod.Namespace {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -351,7 +351,7 @@ type StoreToJobLister struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exists checks if the given job exists in the store.
|
// Exists checks if the given job exists in the store.
|
||||||
func (s *StoreToJobLister) Exists(job *experimental.Job) (bool, error) {
|
func (s *StoreToJobLister) Exists(job *extensions.Job) (bool, error) {
|
||||||
_, exists, err := s.Store.Get(job)
|
_, exists, err := s.Store.Get(job)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -360,17 +360,17 @@ func (s *StoreToJobLister) Exists(job *experimental.Job) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StoreToJobLister lists all jobs in the store.
|
// StoreToJobLister lists all jobs in the store.
|
||||||
func (s *StoreToJobLister) List() (jobs []experimental.Job, err error) {
|
func (s *StoreToJobLister) List() (jobs []extensions.Job, err error) {
|
||||||
for _, c := range s.Store.List() {
|
for _, c := range s.Store.List() {
|
||||||
jobs = append(jobs, *(c.(*experimental.Job)))
|
jobs = append(jobs, *(c.(*extensions.Job)))
|
||||||
}
|
}
|
||||||
return jobs, nil
|
return jobs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPodControllers returns a list of jobs managing a pod. Returns an error only if no matching jobs are found.
|
// GetPodControllers returns a list of jobs managing a pod. Returns an error only if no matching jobs are found.
|
||||||
func (s *StoreToJobLister) GetPodJobs(pod *api.Pod) (jobs []experimental.Job, err error) {
|
func (s *StoreToJobLister) GetPodJobs(pod *api.Pod) (jobs []extensions.Job, err error) {
|
||||||
var selector labels.Selector
|
var selector labels.Selector
|
||||||
var job experimental.Job
|
var job extensions.Job
|
||||||
|
|
||||||
if len(pod.Labels) == 0 {
|
if len(pod.Labels) == 0 {
|
||||||
err = fmt.Errorf("No jobs found for pod %v because it has no labels", pod.Name)
|
err = fmt.Errorf("No jobs found for pod %v because it has no labels", pod.Name)
|
||||||
@ -378,7 +378,7 @@ func (s *StoreToJobLister) GetPodJobs(pod *api.Pod) (jobs []experimental.Job, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, m := range s.Store.List() {
|
for _, m := range s.Store.List() {
|
||||||
job = *m.(*experimental.Job)
|
job = *m.(*extensions.Job)
|
||||||
if job.Namespace != pod.Namespace {
|
if job.Namespace != pod.Namespace {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
30
pkg/client/cache/listers_test.go
vendored
30
pkg/client/cache/listers_test.go
vendored
@ -160,44 +160,44 @@ func TestStoreToDaemonSetLister(t *testing.T) {
|
|||||||
store := NewStore(MetaNamespaceKeyFunc)
|
store := NewStore(MetaNamespaceKeyFunc)
|
||||||
lister := StoreToDaemonSetLister{store}
|
lister := StoreToDaemonSetLister{store}
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
inDSs []*experimental.DaemonSet
|
inDSs []*extensions.DaemonSet
|
||||||
list func() ([]experimental.DaemonSet, error)
|
list func() ([]extensions.DaemonSet, error)
|
||||||
outDaemonSetNames sets.String
|
outDaemonSetNames sets.String
|
||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
// Basic listing
|
// Basic listing
|
||||||
{
|
{
|
||||||
inDSs: []*experimental.DaemonSet{
|
inDSs: []*extensions.DaemonSet{
|
||||||
{ObjectMeta: api.ObjectMeta{Name: "basic"}},
|
{ObjectMeta: api.ObjectMeta{Name: "basic"}},
|
||||||
},
|
},
|
||||||
list: func() ([]experimental.DaemonSet, error) {
|
list: func() ([]extensions.DaemonSet, error) {
|
||||||
return lister.List()
|
return lister.List()
|
||||||
},
|
},
|
||||||
outDaemonSetNames: sets.NewString("basic"),
|
outDaemonSetNames: sets.NewString("basic"),
|
||||||
},
|
},
|
||||||
// Listing multiple daemon sets
|
// Listing multiple daemon sets
|
||||||
{
|
{
|
||||||
inDSs: []*experimental.DaemonSet{
|
inDSs: []*extensions.DaemonSet{
|
||||||
{ObjectMeta: api.ObjectMeta{Name: "basic"}},
|
{ObjectMeta: api.ObjectMeta{Name: "basic"}},
|
||||||
{ObjectMeta: api.ObjectMeta{Name: "complex"}},
|
{ObjectMeta: api.ObjectMeta{Name: "complex"}},
|
||||||
{ObjectMeta: api.ObjectMeta{Name: "complex2"}},
|
{ObjectMeta: api.ObjectMeta{Name: "complex2"}},
|
||||||
},
|
},
|
||||||
list: func() ([]experimental.DaemonSet, error) {
|
list: func() ([]extensions.DaemonSet, error) {
|
||||||
return lister.List()
|
return lister.List()
|
||||||
},
|
},
|
||||||
outDaemonSetNames: sets.NewString("basic", "complex", "complex2"),
|
outDaemonSetNames: sets.NewString("basic", "complex", "complex2"),
|
||||||
},
|
},
|
||||||
// No pod labels
|
// No pod labels
|
||||||
{
|
{
|
||||||
inDSs: []*experimental.DaemonSet{
|
inDSs: []*extensions.DaemonSet{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"},
|
ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: map[string]string{"foo": "baz"},
|
Selector: map[string]string{"foo": "baz"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
list: func() ([]experimental.DaemonSet, error) {
|
list: func() ([]extensions.DaemonSet, error) {
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "pod1", Namespace: "ns"},
|
ObjectMeta: api.ObjectMeta{Name: "pod1", Namespace: "ns"},
|
||||||
}
|
}
|
||||||
@ -208,12 +208,12 @@ func TestStoreToDaemonSetLister(t *testing.T) {
|
|||||||
},
|
},
|
||||||
// No DS selectors
|
// No DS selectors
|
||||||
{
|
{
|
||||||
inDSs: []*experimental.DaemonSet{
|
inDSs: []*extensions.DaemonSet{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"},
|
ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
list: func() ([]experimental.DaemonSet, error) {
|
list: func() ([]extensions.DaemonSet, error) {
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "pod1",
|
Name: "pod1",
|
||||||
@ -228,21 +228,21 @@ func TestStoreToDaemonSetLister(t *testing.T) {
|
|||||||
},
|
},
|
||||||
// Matching labels to selectors and namespace
|
// Matching labels to selectors and namespace
|
||||||
{
|
{
|
||||||
inDSs: []*experimental.DaemonSet{
|
inDSs: []*extensions.DaemonSet{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: map[string]string{"foo": "bar"},
|
Selector: map[string]string{"foo": "bar"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"},
|
ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: map[string]string{"foo": "bar"},
|
Selector: map[string]string{"foo": "bar"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
list: func() ([]experimental.DaemonSet, error) {
|
list: func() ([]extensions.DaemonSet, error) {
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "pod1",
|
Name: "pod1",
|
||||||
|
@ -45,7 +45,7 @@ func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationContro
|
|||||||
|
|
||||||
// JobHasDesiredParallelism returns a condition that will be true if the desired parallelism count
|
// JobHasDesiredParallelism returns a condition that will be true if the desired parallelism count
|
||||||
// for a job equals the current active counts or is less by an appropriate successful/unsuccessful count.
|
// for a job equals the current active counts or is less by an appropriate successful/unsuccessful count.
|
||||||
func JobHasDesiredParallelism(c Interface, job *experimental.Job) wait.ConditionFunc {
|
func JobHasDesiredParallelism(c Interface, job *extensions.Job) wait.ConditionFunc {
|
||||||
|
|
||||||
return func() (bool, error) {
|
return func() (bool, error) {
|
||||||
job, err := c.Experimental().Jobs(job.Namespace).Get(job.Name)
|
job, err := c.Experimental().Jobs(job.Namespace).Get(job.Name)
|
||||||
|
@ -29,11 +29,11 @@ type DaemonSetsNamespacer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DaemonSetInterface interface {
|
type DaemonSetInterface interface {
|
||||||
List(selector labels.Selector) (*experimental.DaemonSetList, error)
|
List(selector labels.Selector) (*extensions.DaemonSetList, error)
|
||||||
Get(name string) (*experimental.DaemonSet, error)
|
Get(name string) (*extensions.DaemonSet, error)
|
||||||
Create(ctrl *experimental.DaemonSet) (*experimental.DaemonSet, error)
|
Create(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
|
||||||
Update(ctrl *experimental.DaemonSet) (*experimental.DaemonSet, error)
|
Update(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
|
||||||
UpdateStatus(ctrl *experimental.DaemonSet) (*experimental.DaemonSet, error)
|
UpdateStatus(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
|
||||||
Delete(name string) error
|
Delete(name string) error
|
||||||
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||||
}
|
}
|
||||||
@ -51,36 +51,36 @@ func newDaemonSets(c *ExperimentalClient, namespace string) *daemonSets {
|
|||||||
// Ensure statically that daemonSets implements DaemonSetsInterface.
|
// Ensure statically that daemonSets implements DaemonSetsInterface.
|
||||||
var _ DaemonSetInterface = &daemonSets{}
|
var _ DaemonSetInterface = &daemonSets{}
|
||||||
|
|
||||||
func (c *daemonSets) List(selector labels.Selector) (result *experimental.DaemonSetList, err error) {
|
func (c *daemonSets) List(selector labels.Selector) (result *extensions.DaemonSetList, err error) {
|
||||||
result = &experimental.DaemonSetList{}
|
result = &extensions.DaemonSetList{}
|
||||||
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").LabelsSelectorParam(selector).Do().Into(result)
|
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").LabelsSelectorParam(selector).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns information about a particular daemon set.
|
// Get returns information about a particular daemon set.
|
||||||
func (c *daemonSets) Get(name string) (result *experimental.DaemonSet, err error) {
|
func (c *daemonSets) Get(name string) (result *extensions.DaemonSet, err error) {
|
||||||
result = &experimental.DaemonSet{}
|
result = &extensions.DaemonSet{}
|
||||||
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").Name(name).Do().Into(result)
|
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").Name(name).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a new daemon set.
|
// Create creates a new daemon set.
|
||||||
func (c *daemonSets) Create(daemon *experimental.DaemonSet) (result *experimental.DaemonSet, err error) {
|
func (c *daemonSets) Create(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
|
||||||
result = &experimental.DaemonSet{}
|
result = &extensions.DaemonSet{}
|
||||||
err = c.r.Post().Namespace(c.ns).Resource("daemonsets").Body(daemon).Do().Into(result)
|
err = c.r.Post().Namespace(c.ns).Resource("daemonsets").Body(daemon).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates an existing daemon set.
|
// Update updates an existing daemon set.
|
||||||
func (c *daemonSets) Update(daemon *experimental.DaemonSet) (result *experimental.DaemonSet, err error) {
|
func (c *daemonSets) Update(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
|
||||||
result = &experimental.DaemonSet{}
|
result = &extensions.DaemonSet{}
|
||||||
err = c.r.Put().Namespace(c.ns).Resource("daemonsets").Name(daemon.Name).Body(daemon).Do().Into(result)
|
err = c.r.Put().Namespace(c.ns).Resource("daemonsets").Name(daemon.Name).Body(daemon).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateStatus updates an existing daemon set status
|
// UpdateStatus updates an existing daemon set status
|
||||||
func (c *daemonSets) UpdateStatus(daemon *experimental.DaemonSet) (result *experimental.DaemonSet, err error) {
|
func (c *daemonSets) UpdateStatus(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
|
||||||
result = &experimental.DaemonSet{}
|
result = &extensions.DaemonSet{}
|
||||||
err = c.r.Put().Namespace(c.ns).Resource("daemonsets").Name(daemon.Name).SubResource("status").Body(daemon).Do().Into(result)
|
err = c.r.Put().Namespace(c.ns).Resource("daemonsets").Name(daemon.Name).SubResource("status").Body(daemon).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ func TestListDaemonSets(t *testing.T) {
|
|||||||
Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""),
|
Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""),
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200,
|
Response: Response{StatusCode: 200,
|
||||||
Body: &experimental.DaemonSetList{
|
Body: &extensions.DaemonSetList{
|
||||||
Items: []experimental.DaemonSet{
|
Items: []extensions.DaemonSet{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
@ -47,7 +47,7 @@ func TestListDaemonSets(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -66,7 +66,7 @@ func TestGetDaemonSet(t *testing.T) {
|
|||||||
Request: testRequest{Method: "GET", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
|
Request: testRequest{Method: "GET", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.DaemonSet{
|
Body: &extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -74,7 +74,7 @@ func TestGetDaemonSet(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -97,14 +97,14 @@ func TestGetDaemonSetWithNoName(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateDaemonSet(t *testing.T) {
|
func TestUpdateDaemonSet(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
requestDaemonSet := &experimental.DaemonSet{
|
requestDaemonSet := &extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
|
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.DaemonSet{
|
Body: &extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -112,7 +112,7 @@ func TestUpdateDaemonSet(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -124,14 +124,14 @@ func TestUpdateDaemonSet(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateDaemonSetUpdateStatus(t *testing.T) {
|
func TestUpdateDaemonSetUpdateStatus(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
requestDaemonSet := &experimental.DaemonSet{
|
requestDaemonSet := &extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
|
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo") + "/status", Query: buildQueryValues(nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo") + "/status", Query: buildQueryValues(nil)},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.DaemonSet{
|
Body: &extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -139,10 +139,10 @@ func TestUpdateDaemonSetUpdateStatus(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
Status: experimental.DaemonSetStatus{},
|
Status: extensions.DaemonSetStatus{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -162,14 +162,14 @@ func TestDeleteDaemon(t *testing.T) {
|
|||||||
|
|
||||||
func TestCreateDaemonSet(t *testing.T) {
|
func TestCreateDaemonSet(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
requestDaemonSet := &experimental.DaemonSet{
|
requestDaemonSet := &extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "POST", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""), Body: requestDaemonSet, Query: buildQueryValues(nil)},
|
Request: testRequest{Method: "POST", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""), Body: requestDaemonSet, Query: buildQueryValues(nil)},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.DaemonSet{
|
Body: &extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -177,7 +177,7 @@ func TestCreateDaemonSet(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -31,11 +31,11 @@ type DeploymentsNamespacer interface {
|
|||||||
|
|
||||||
// DeploymentInterface has methods to work with Deployment resources.
|
// DeploymentInterface has methods to work with Deployment resources.
|
||||||
type DeploymentInterface interface {
|
type DeploymentInterface interface {
|
||||||
List(label labels.Selector, field fields.Selector) (*experimental.DeploymentList, error)
|
List(label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error)
|
||||||
Get(name string) (*experimental.Deployment, error)
|
Get(name string) (*extensions.Deployment, error)
|
||||||
Delete(name string, options *api.DeleteOptions) error
|
Delete(name string, options *api.DeleteOptions) error
|
||||||
Create(Deployment *experimental.Deployment) (*experimental.Deployment, error)
|
Create(Deployment *extensions.Deployment) (*extensions.Deployment, error)
|
||||||
Update(Deployment *experimental.Deployment) (*experimental.Deployment, error)
|
Update(Deployment *extensions.Deployment) (*extensions.Deployment, error)
|
||||||
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,15 +54,15 @@ func newDeployments(c *ExperimentalClient, namespace string) *deployments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
|
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
|
||||||
func (c *deployments) List(label labels.Selector, field fields.Selector) (result *experimental.DeploymentList, err error) {
|
func (c *deployments) List(label labels.Selector, field fields.Selector) (result *extensions.DeploymentList, err error) {
|
||||||
result = &experimental.DeploymentList{}
|
result = &extensions.DeploymentList{}
|
||||||
err = c.client.Get().Namespace(c.ns).Resource("deployments").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
|
err = c.client.Get().Namespace(c.ns).Resource("deployments").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
|
// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
|
||||||
func (c *deployments) Get(name string) (result *experimental.Deployment, err error) {
|
func (c *deployments) Get(name string) (result *extensions.Deployment, err error) {
|
||||||
result = &experimental.Deployment{}
|
result = &extensions.Deployment{}
|
||||||
err = c.client.Get().Namespace(c.ns).Resource("deployments").Name(name).Do().Into(result)
|
err = c.client.Get().Namespace(c.ns).Resource("deployments").Name(name).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -80,15 +80,15 @@ func (c *deployments) Delete(name string, options *api.DeleteOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
|
// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
|
||||||
func (c *deployments) Create(deployment *experimental.Deployment) (result *experimental.Deployment, err error) {
|
func (c *deployments) Create(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
|
||||||
result = &experimental.Deployment{}
|
result = &extensions.Deployment{}
|
||||||
err = c.client.Post().Namespace(c.ns).Resource("deployments").Body(deployment).Do().Into(result)
|
err = c.client.Post().Namespace(c.ns).Resource("deployments").Body(deployment).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
|
// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
|
||||||
func (c *deployments) Update(deployment *experimental.Deployment) (result *experimental.Deployment, err error) {
|
func (c *deployments) Update(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
|
||||||
result = &experimental.Deployment{}
|
result = &extensions.Deployment{}
|
||||||
err = c.client.Put().Namespace(c.ns).Resource("deployments").Name(deployment.Name).Body(deployment).Do().Into(result)
|
err = c.client.Put().Namespace(c.ns).Resource("deployments").Name(deployment.Name).Body(deployment).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ func getDeploymentsResoureName() string {
|
|||||||
|
|
||||||
func TestDeploymentCreate(t *testing.T) {
|
func TestDeploymentCreate(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
deployment := experimental.Deployment{
|
deployment := extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -58,7 +58,7 @@ func TestDeploymentCreate(t *testing.T) {
|
|||||||
|
|
||||||
func TestDeploymentGet(t *testing.T) {
|
func TestDeploymentGet(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
deployment := &experimental.Deployment{
|
deployment := &extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -80,8 +80,8 @@ func TestDeploymentGet(t *testing.T) {
|
|||||||
|
|
||||||
func TestDeploymentList(t *testing.T) {
|
func TestDeploymentList(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
deploymentList := &experimental.DeploymentList{
|
deploymentList := &extensions.DeploymentList{
|
||||||
Items: []experimental.Deployment{
|
Items: []extensions.Deployment{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
@ -105,7 +105,7 @@ func TestDeploymentList(t *testing.T) {
|
|||||||
|
|
||||||
func TestDeploymentUpdate(t *testing.T) {
|
func TestDeploymentUpdate(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
deployment := &experimental.Deployment{
|
deployment := &extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
|
@ -31,11 +31,11 @@ type HorizontalPodAutoscalersNamespacer interface {
|
|||||||
|
|
||||||
// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources.
|
// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources.
|
||||||
type HorizontalPodAutoscalerInterface interface {
|
type HorizontalPodAutoscalerInterface interface {
|
||||||
List(label labels.Selector, field fields.Selector) (*experimental.HorizontalPodAutoscalerList, error)
|
List(label labels.Selector, field fields.Selector) (*extensions.HorizontalPodAutoscalerList, error)
|
||||||
Get(name string) (*experimental.HorizontalPodAutoscaler, error)
|
Get(name string) (*extensions.HorizontalPodAutoscaler, error)
|
||||||
Delete(name string, options *api.DeleteOptions) error
|
Delete(name string, options *api.DeleteOptions) error
|
||||||
Create(horizontalPodAutoscaler *experimental.HorizontalPodAutoscaler) (*experimental.HorizontalPodAutoscaler, error)
|
Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error)
|
||||||
Update(horizontalPodAutoscaler *experimental.HorizontalPodAutoscaler) (*experimental.HorizontalPodAutoscaler, error)
|
Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error)
|
||||||
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,15 +54,15 @@ func newHorizontalPodAutoscalers(c *ExperimentalClient, namespace string) *horiz
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of horizontalPodAutoscalers that match those selectors.
|
// List takes label and field selectors, and returns the list of horizontalPodAutoscalers that match those selectors.
|
||||||
func (c *horizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (result *experimental.HorizontalPodAutoscalerList, err error) {
|
func (c *horizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (result *extensions.HorizontalPodAutoscalerList, err error) {
|
||||||
result = &experimental.HorizontalPodAutoscalerList{}
|
result = &extensions.HorizontalPodAutoscalerList{}
|
||||||
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
|
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get takes the name of the horizontalPodAutoscaler, and returns the corresponding HorizontalPodAutoscaler object, and an error if it occurs
|
// Get takes the name of the horizontalPodAutoscaler, and returns the corresponding HorizontalPodAutoscaler object, and an error if it occurs
|
||||||
func (c *horizontalPodAutoscalers) Get(name string) (result *experimental.HorizontalPodAutoscaler, err error) {
|
func (c *horizontalPodAutoscalers) Get(name string) (result *extensions.HorizontalPodAutoscaler, err error) {
|
||||||
result = &experimental.HorizontalPodAutoscaler{}
|
result = &extensions.HorizontalPodAutoscaler{}
|
||||||
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Do().Into(result)
|
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -81,15 +81,15 @@ func (c *horizontalPodAutoscalers) Delete(name string, options *api.DeleteOption
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs.
|
// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs.
|
||||||
func (c *horizontalPodAutoscalers) Create(horizontalPodAutoscaler *experimental.HorizontalPodAutoscaler) (result *experimental.HorizontalPodAutoscaler, err error) {
|
func (c *horizontalPodAutoscalers) Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) {
|
||||||
result = &experimental.HorizontalPodAutoscaler{}
|
result = &extensions.HorizontalPodAutoscaler{}
|
||||||
err = c.client.Post().Namespace(c.ns).Resource("horizontalPodAutoscalers").Body(horizontalPodAutoscaler).Do().Into(result)
|
err = c.client.Post().Namespace(c.ns).Resource("horizontalPodAutoscalers").Body(horizontalPodAutoscaler).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs.
|
// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs.
|
||||||
func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *experimental.HorizontalPodAutoscaler) (result *experimental.HorizontalPodAutoscaler, err error) {
|
func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) {
|
||||||
result = &experimental.HorizontalPodAutoscaler{}
|
result = &extensions.HorizontalPodAutoscaler{}
|
||||||
err = c.client.Put().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(horizontalPodAutoscaler.Name).Body(horizontalPodAutoscaler).Do().Into(result)
|
err = c.client.Put().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(horizontalPodAutoscaler.Name).Body(horizontalPodAutoscaler).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ func getHorizontalPodAutoscalersResoureName() string {
|
|||||||
|
|
||||||
func TestHorizontalPodAutoscalerCreate(t *testing.T) {
|
func TestHorizontalPodAutoscalerCreate(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
horizontalPodAutoscaler := experimental.HorizontalPodAutoscaler{
|
horizontalPodAutoscaler := extensions.HorizontalPodAutoscaler{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -58,7 +58,7 @@ func TestHorizontalPodAutoscalerCreate(t *testing.T) {
|
|||||||
|
|
||||||
func TestHorizontalPodAutoscalerGet(t *testing.T) {
|
func TestHorizontalPodAutoscalerGet(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
horizontalPodAutoscaler := &experimental.HorizontalPodAutoscaler{
|
horizontalPodAutoscaler := &extensions.HorizontalPodAutoscaler{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -80,8 +80,8 @@ func TestHorizontalPodAutoscalerGet(t *testing.T) {
|
|||||||
|
|
||||||
func TestHorizontalPodAutoscalerList(t *testing.T) {
|
func TestHorizontalPodAutoscalerList(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
horizontalPodAutoscalerList := &experimental.HorizontalPodAutoscalerList{
|
horizontalPodAutoscalerList := &extensions.HorizontalPodAutoscalerList{
|
||||||
Items: []experimental.HorizontalPodAutoscaler{
|
Items: []extensions.HorizontalPodAutoscaler{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
@ -105,7 +105,7 @@ func TestHorizontalPodAutoscalerList(t *testing.T) {
|
|||||||
|
|
||||||
func TestHorizontalPodAutoscalerUpdate(t *testing.T) {
|
func TestHorizontalPodAutoscalerUpdate(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
horizontalPodAutoscaler := &experimental.HorizontalPodAutoscaler{
|
horizontalPodAutoscaler := &extensions.HorizontalPodAutoscaler{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
|
@ -31,13 +31,13 @@ type IngressNamespacer interface {
|
|||||||
|
|
||||||
// IngressInterface exposes methods to work on Ingress resources.
|
// IngressInterface exposes methods to work on Ingress resources.
|
||||||
type IngressInterface interface {
|
type IngressInterface interface {
|
||||||
List(label labels.Selector, field fields.Selector) (*experimental.IngressList, error)
|
List(label labels.Selector, field fields.Selector) (*extensions.IngressList, error)
|
||||||
Get(name string) (*experimental.Ingress, error)
|
Get(name string) (*extensions.Ingress, error)
|
||||||
Create(ingress *experimental.Ingress) (*experimental.Ingress, error)
|
Create(ingress *extensions.Ingress) (*extensions.Ingress, error)
|
||||||
Update(ingress *experimental.Ingress) (*experimental.Ingress, error)
|
Update(ingress *extensions.Ingress) (*extensions.Ingress, error)
|
||||||
Delete(name string, options *api.DeleteOptions) error
|
Delete(name string, options *api.DeleteOptions) error
|
||||||
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||||
UpdateStatus(ingress *experimental.Ingress) (*experimental.Ingress, error)
|
UpdateStatus(ingress *extensions.Ingress) (*extensions.Ingress, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ingress implements IngressNamespacer interface
|
// ingress implements IngressNamespacer interface
|
||||||
@ -52,29 +52,29 @@ func newIngress(c *ExperimentalClient, namespace string) *ingress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List returns a list of ingress that match the label and field selectors.
|
// List returns a list of ingress that match the label and field selectors.
|
||||||
func (c *ingress) List(label labels.Selector, field fields.Selector) (result *experimental.IngressList, err error) {
|
func (c *ingress) List(label labels.Selector, field fields.Selector) (result *extensions.IngressList, err error) {
|
||||||
result = &experimental.IngressList{}
|
result = &extensions.IngressList{}
|
||||||
err = c.r.Get().Namespace(c.ns).Resource("ingress").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
|
err = c.r.Get().Namespace(c.ns).Resource("ingress").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns information about a particular ingress.
|
// Get returns information about a particular ingress.
|
||||||
func (c *ingress) Get(name string) (result *experimental.Ingress, err error) {
|
func (c *ingress) Get(name string) (result *extensions.Ingress, err error) {
|
||||||
result = &experimental.Ingress{}
|
result = &extensions.Ingress{}
|
||||||
err = c.r.Get().Namespace(c.ns).Resource("ingress").Name(name).Do().Into(result)
|
err = c.r.Get().Namespace(c.ns).Resource("ingress").Name(name).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a new ingress.
|
// Create creates a new ingress.
|
||||||
func (c *ingress) Create(ingress *experimental.Ingress) (result *experimental.Ingress, err error) {
|
func (c *ingress) Create(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
|
||||||
result = &experimental.Ingress{}
|
result = &extensions.Ingress{}
|
||||||
err = c.r.Post().Namespace(c.ns).Resource("ingress").Body(ingress).Do().Into(result)
|
err = c.r.Post().Namespace(c.ns).Resource("ingress").Body(ingress).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates an existing ingress.
|
// Update updates an existing ingress.
|
||||||
func (c *ingress) Update(ingress *experimental.Ingress) (result *experimental.Ingress, err error) {
|
func (c *ingress) Update(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
|
||||||
result = &experimental.Ingress{}
|
result = &extensions.Ingress{}
|
||||||
err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).Body(ingress).Do().Into(result)
|
err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).Body(ingress).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -105,8 +105,8 @@ func (c *ingress) Watch(label labels.Selector, field fields.Selector, resourceVe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UpdateStatus takes the name of the ingress and the new status. Returns the server's representation of the ingress, and an error, if it occurs.
|
// UpdateStatus takes the name of the ingress and the new status. Returns the server's representation of the ingress, and an error, if it occurs.
|
||||||
func (c *ingress) UpdateStatus(ingress *experimental.Ingress) (result *experimental.Ingress, err error) {
|
func (c *ingress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
|
||||||
result = &experimental.Ingress{}
|
result = &extensions.Ingress{}
|
||||||
err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).SubResource("status").Body(ingress).Do().Into(result)
|
err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).SubResource("status").Body(ingress).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ func TestListIngress(t *testing.T) {
|
|||||||
Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, ""),
|
Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, ""),
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200,
|
Response: Response{StatusCode: 200,
|
||||||
Body: &experimental.IngressList{
|
Body: &extensions.IngressList{
|
||||||
Items: []experimental.Ingress{
|
Items: []extensions.Ingress{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
@ -48,8 +48,8 @@ func TestListIngress(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.IngressSpec{
|
Spec: extensions.IngressSpec{
|
||||||
Rules: []experimental.IngressRule{},
|
Rules: []extensions.IngressRule{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -70,7 +70,7 @@ func TestGetIngress(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.Ingress{
|
Body: &extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -78,8 +78,8 @@ func TestGetIngress(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.IngressSpec{
|
Spec: extensions.IngressSpec{
|
||||||
Rules: []experimental.IngressRule{},
|
Rules: []extensions.IngressRule{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -101,7 +101,7 @@ func TestGetIngressWithNoName(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateIngress(t *testing.T) {
|
func TestUpdateIngress(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
requestIngress := &experimental.Ingress{
|
requestIngress := &extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -116,7 +116,7 @@ func TestUpdateIngress(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.Ingress{
|
Body: &extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -124,8 +124,8 @@ func TestUpdateIngress(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.IngressSpec{
|
Spec: extensions.IngressSpec{
|
||||||
Rules: []experimental.IngressRule{},
|
Rules: []extensions.IngressRule{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -141,13 +141,13 @@ func TestUpdateIngressStatus(t *testing.T) {
|
|||||||
{IP: "127.0.0.1"},
|
{IP: "127.0.0.1"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
requestIngress := &experimental.Ingress{
|
requestIngress := &extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
ResourceVersion: "1",
|
ResourceVersion: "1",
|
||||||
},
|
},
|
||||||
Status: experimental.IngressStatus{
|
Status: extensions.IngressStatus{
|
||||||
LoadBalancer: lbStatus,
|
LoadBalancer: lbStatus,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ func TestUpdateIngressStatus(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.Ingress{
|
Body: &extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -167,10 +167,10 @@ func TestUpdateIngressStatus(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.IngressSpec{
|
Spec: extensions.IngressSpec{
|
||||||
Rules: []experimental.IngressRule{},
|
Rules: []extensions.IngressRule{},
|
||||||
},
|
},
|
||||||
Status: experimental.IngressStatus{
|
Status: extensions.IngressStatus{
|
||||||
LoadBalancer: lbStatus,
|
LoadBalancer: lbStatus,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -196,7 +196,7 @@ func TestDeleteIngress(t *testing.T) {
|
|||||||
|
|
||||||
func TestCreateIngress(t *testing.T) {
|
func TestCreateIngress(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
requestIngress := &experimental.Ingress{
|
requestIngress := &extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -211,7 +211,7 @@ func TestCreateIngress(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.Ingress{
|
Body: &extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -219,8 +219,8 @@ func TestCreateIngress(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.IngressSpec{
|
Spec: extensions.IngressSpec{
|
||||||
Rules: []experimental.IngressRule{},
|
Rules: []extensions.IngressRule{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -32,13 +32,13 @@ type JobsNamespacer interface {
|
|||||||
|
|
||||||
// JobInterface exposes methods to work on Job resources.
|
// JobInterface exposes methods to work on Job resources.
|
||||||
type JobInterface interface {
|
type JobInterface interface {
|
||||||
List(label labels.Selector, field fields.Selector) (*experimental.JobList, error)
|
List(label labels.Selector, field fields.Selector) (*extensions.JobList, error)
|
||||||
Get(name string) (*experimental.Job, error)
|
Get(name string) (*extensions.Job, error)
|
||||||
Create(job *experimental.Job) (*experimental.Job, error)
|
Create(job *extensions.Job) (*extensions.Job, error)
|
||||||
Update(job *experimental.Job) (*experimental.Job, error)
|
Update(job *extensions.Job) (*extensions.Job, error)
|
||||||
Delete(name string, options *api.DeleteOptions) error
|
Delete(name string, options *api.DeleteOptions) error
|
||||||
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||||
UpdateStatus(job *experimental.Job) (*experimental.Job, error)
|
UpdateStatus(job *extensions.Job) (*extensions.Job, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// jobs implements JobsNamespacer interface
|
// jobs implements JobsNamespacer interface
|
||||||
@ -56,29 +56,29 @@ func newJobs(c *ExperimentalClient, namespace string) *jobs {
|
|||||||
var _ JobInterface = &jobs{}
|
var _ JobInterface = &jobs{}
|
||||||
|
|
||||||
// List returns a list of jobs that match the label and field selectors.
|
// List returns a list of jobs that match the label and field selectors.
|
||||||
func (c *jobs) List(label labels.Selector, field fields.Selector) (result *experimental.JobList, err error) {
|
func (c *jobs) List(label labels.Selector, field fields.Selector) (result *extensions.JobList, err error) {
|
||||||
result = &experimental.JobList{}
|
result = &extensions.JobList{}
|
||||||
err = c.r.Get().Namespace(c.ns).Resource("jobs").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
|
err = c.r.Get().Namespace(c.ns).Resource("jobs").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns information about a particular job.
|
// Get returns information about a particular job.
|
||||||
func (c *jobs) Get(name string) (result *experimental.Job, err error) {
|
func (c *jobs) Get(name string) (result *extensions.Job, err error) {
|
||||||
result = &experimental.Job{}
|
result = &extensions.Job{}
|
||||||
err = c.r.Get().Namespace(c.ns).Resource("jobs").Name(name).Do().Into(result)
|
err = c.r.Get().Namespace(c.ns).Resource("jobs").Name(name).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a new job.
|
// Create creates a new job.
|
||||||
func (c *jobs) Create(job *experimental.Job) (result *experimental.Job, err error) {
|
func (c *jobs) Create(job *extensions.Job) (result *extensions.Job, err error) {
|
||||||
result = &experimental.Job{}
|
result = &extensions.Job{}
|
||||||
err = c.r.Post().Namespace(c.ns).Resource("jobs").Body(job).Do().Into(result)
|
err = c.r.Post().Namespace(c.ns).Resource("jobs").Body(job).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates an existing job.
|
// Update updates an existing job.
|
||||||
func (c *jobs) Update(job *experimental.Job) (result *experimental.Job, err error) {
|
func (c *jobs) Update(job *extensions.Job) (result *extensions.Job, err error) {
|
||||||
result = &experimental.Job{}
|
result = &extensions.Job{}
|
||||||
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).Body(job).Do().Into(result)
|
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).Body(job).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -109,8 +109,8 @@ func (c *jobs) Watch(label labels.Selector, field fields.Selector, resourceVersi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UpdateStatus takes the name of the job and the new status. Returns the server's representation of the job, and an error, if it occurs.
|
// UpdateStatus takes the name of the job and the new status. Returns the server's representation of the job, and an error, if it occurs.
|
||||||
func (c *jobs) UpdateStatus(job *experimental.Job) (result *experimental.Job, err error) {
|
func (c *jobs) UpdateStatus(job *extensions.Job) (result *extensions.Job, err error) {
|
||||||
result = &experimental.Job{}
|
result = &extensions.Job{}
|
||||||
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).SubResource("status").Body(job).Do().Into(result)
|
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).SubResource("status").Body(job).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ func TestListJobs(t *testing.T) {
|
|||||||
Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, ""),
|
Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, ""),
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200,
|
Response: Response{StatusCode: 200,
|
||||||
Body: &experimental.JobList{
|
Body: &extensions.JobList{
|
||||||
Items: []experimental.Job{
|
Items: []extensions.Job{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
@ -48,7 +48,7 @@ func TestListJobs(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -70,7 +70,7 @@ func TestGetJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.Job{
|
Body: &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -78,7 +78,7 @@ func TestGetJob(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -101,7 +101,7 @@ func TestGetJobWithNoName(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateJob(t *testing.T) {
|
func TestUpdateJob(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
requestJob := &experimental.Job{
|
requestJob := &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -116,7 +116,7 @@ func TestUpdateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.Job{
|
Body: &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -124,7 +124,7 @@ func TestUpdateJob(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -136,7 +136,7 @@ func TestUpdateJob(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateJobStatus(t *testing.T) {
|
func TestUpdateJobStatus(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
requestJob := &experimental.Job{
|
requestJob := &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -151,7 +151,7 @@ func TestUpdateJobStatus(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.Job{
|
Body: &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -159,10 +159,10 @@ func TestUpdateJobStatus(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
Status: experimental.JobStatus{
|
Status: extensions.JobStatus{
|
||||||
Active: 1,
|
Active: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -188,7 +188,7 @@ func TestDeleteJob(t *testing.T) {
|
|||||||
|
|
||||||
func TestCreateJob(t *testing.T) {
|
func TestCreateJob(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
requestJob := &experimental.Job{
|
requestJob := &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
@ -203,7 +203,7 @@ func TestCreateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &experimental.Job{
|
Body: &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
@ -211,7 +211,7 @@ func TestCreateJob(t *testing.T) {
|
|||||||
"name": "baz",
|
"name": "baz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -27,8 +27,8 @@ type ScaleNamespacer interface {
|
|||||||
|
|
||||||
// ScaleInterface has methods to work with Scale (sub)resources.
|
// ScaleInterface has methods to work with Scale (sub)resources.
|
||||||
type ScaleInterface interface {
|
type ScaleInterface interface {
|
||||||
Get(string, string) (*experimental.Scale, error)
|
Get(string, string) (*extensions.Scale, error)
|
||||||
Update(string, *experimental.Scale) (*experimental.Scale, error)
|
Update(string, *extensions.Scale) (*extensions.Scale, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
|
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
|
||||||
@ -46,15 +46,15 @@ func newScales(c *ExperimentalClient, namespace string) *scales {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get takes the reference to scale subresource and returns the subresource or error, if one occurs.
|
// Get takes the reference to scale subresource and returns the subresource or error, if one occurs.
|
||||||
func (c *scales) Get(kind string, name string) (result *experimental.Scale, err error) {
|
func (c *scales) Get(kind string, name string) (result *extensions.Scale, err error) {
|
||||||
result = &experimental.Scale{}
|
result = &extensions.Scale{}
|
||||||
resource, _ := meta.KindToResource(kind, false)
|
resource, _ := meta.KindToResource(kind, false)
|
||||||
err = c.client.Get().Namespace(c.ns).Resource(resource).Name(name).SubResource("scale").Do().Into(result)
|
err = c.client.Get().Namespace(c.ns).Resource(resource).Name(name).SubResource("scale").Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *scales) Update(kind string, scale *experimental.Scale) (result *experimental.Scale, err error) {
|
func (c *scales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||||
result = &experimental.Scale{}
|
result = &extensions.Scale{}
|
||||||
resource, _ := meta.KindToResource(kind, false)
|
resource, _ := meta.KindToResource(kind, false)
|
||||||
err = c.client.Put().
|
err = c.client.Put().
|
||||||
Namespace(scale.Namespace).
|
Namespace(scale.Namespace).
|
||||||
|
@ -34,48 +34,48 @@ type FakeDaemonSets struct {
|
|||||||
// Ensure statically that FakeDaemonSets implements DaemonInterface.
|
// Ensure statically that FakeDaemonSets implements DaemonInterface.
|
||||||
var _ kClientLib.DaemonSetInterface = &FakeDaemonSets{}
|
var _ kClientLib.DaemonSetInterface = &FakeDaemonSets{}
|
||||||
|
|
||||||
func (c *FakeDaemonSets) Get(name string) (*experimental.DaemonSet, error) {
|
func (c *FakeDaemonSets) Get(name string) (*extensions.DaemonSet, error) {
|
||||||
obj, err := c.Fake.Invokes(NewGetAction("daemonsets", c.Namespace, name), &experimental.DaemonSet{})
|
obj, err := c.Fake.Invokes(NewGetAction("daemonsets", c.Namespace, name), &extensions.DaemonSet{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.DaemonSet), err
|
return obj.(*extensions.DaemonSet), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDaemonSets) List(label labels.Selector) (*experimental.DaemonSetList, error) {
|
func (c *FakeDaemonSets) List(label labels.Selector) (*extensions.DaemonSetList, error) {
|
||||||
obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, label, nil), &experimental.DaemonSetList{})
|
obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, label, nil), &extensions.DaemonSetList{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.DaemonSetList), err
|
return obj.(*extensions.DaemonSetList), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDaemonSets) Create(daemon *experimental.DaemonSet) (*experimental.DaemonSet, error) {
|
func (c *FakeDaemonSets) Create(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
|
||||||
obj, err := c.Fake.Invokes(NewCreateAction("daemonsets", c.Namespace, daemon), &experimental.DaemonSet{})
|
obj, err := c.Fake.Invokes(NewCreateAction("daemonsets", c.Namespace, daemon), &extensions.DaemonSet{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.DaemonSet), err
|
return obj.(*extensions.DaemonSet), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDaemonSets) Update(daemon *experimental.DaemonSet) (*experimental.DaemonSet, error) {
|
func (c *FakeDaemonSets) Update(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
|
||||||
obj, err := c.Fake.Invokes(NewUpdateAction("daemonsets", c.Namespace, daemon), &experimental.DaemonSet{})
|
obj, err := c.Fake.Invokes(NewUpdateAction("daemonsets", c.Namespace, daemon), &extensions.DaemonSet{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.DaemonSet), err
|
return obj.(*extensions.DaemonSet), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDaemonSets) UpdateStatus(daemon *experimental.DaemonSet) (*experimental.DaemonSet, error) {
|
func (c *FakeDaemonSets) UpdateStatus(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
|
||||||
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("daemonsets", "status", c.Namespace, daemon), &experimental.DaemonSet{})
|
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("daemonsets", "status", c.Namespace, daemon), &extensions.DaemonSet{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.DaemonSet), err
|
return obj.(*extensions.DaemonSet), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDaemonSets) Delete(name string) error {
|
func (c *FakeDaemonSets) Delete(name string) error {
|
||||||
_, err := c.Fake.Invokes(NewDeleteAction("daemonsets", c.Namespace, name), &experimental.DaemonSet{})
|
_, err := c.Fake.Invokes(NewDeleteAction("daemonsets", c.Namespace, name), &extensions.DaemonSet{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,22 +31,22 @@ type FakeDeployments struct {
|
|||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDeployments) Get(name string) (*experimental.Deployment, error) {
|
func (c *FakeDeployments) Get(name string) (*extensions.Deployment, error) {
|
||||||
obj, err := c.Fake.Invokes(NewGetAction("deployments", c.Namespace, name), &experimental.Deployment{})
|
obj, err := c.Fake.Invokes(NewGetAction("deployments", c.Namespace, name), &extensions.Deployment{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Deployment), err
|
return obj.(*extensions.Deployment), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDeployments) List(label labels.Selector, field fields.Selector) (*experimental.DeploymentList, error) {
|
func (c *FakeDeployments) List(label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error) {
|
||||||
obj, err := c.Fake.Invokes(NewListAction("deployments", c.Namespace, label, field), &experimental.DeploymentList{})
|
obj, err := c.Fake.Invokes(NewListAction("deployments", c.Namespace, label, field), &extensions.DeploymentList{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
list := &experimental.DeploymentList{}
|
list := &extensions.DeploymentList{}
|
||||||
for _, deployment := range obj.(*experimental.DeploymentList).Items {
|
for _, deployment := range obj.(*extensions.DeploymentList).Items {
|
||||||
if label.Matches(labels.Set(deployment.Labels)) {
|
if label.Matches(labels.Set(deployment.Labels)) {
|
||||||
list.Items = append(list.Items, deployment)
|
list.Items = append(list.Items, deployment)
|
||||||
}
|
}
|
||||||
@ -54,26 +54,26 @@ func (c *FakeDeployments) List(label labels.Selector, field fields.Selector) (*e
|
|||||||
return list, err
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDeployments) Create(deployment *experimental.Deployment) (*experimental.Deployment, error) {
|
func (c *FakeDeployments) Create(deployment *extensions.Deployment) (*extensions.Deployment, error) {
|
||||||
obj, err := c.Fake.Invokes(NewCreateAction("deployments", c.Namespace, deployment), deployment)
|
obj, err := c.Fake.Invokes(NewCreateAction("deployments", c.Namespace, deployment), deployment)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Deployment), err
|
return obj.(*extensions.Deployment), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDeployments) Update(deployment *experimental.Deployment) (*experimental.Deployment, error) {
|
func (c *FakeDeployments) Update(deployment *extensions.Deployment) (*extensions.Deployment, error) {
|
||||||
obj, err := c.Fake.Invokes(NewUpdateAction("deployments", c.Namespace, deployment), deployment)
|
obj, err := c.Fake.Invokes(NewUpdateAction("deployments", c.Namespace, deployment), deployment)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Deployment), err
|
return obj.(*extensions.Deployment), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeDeployments) Delete(name string, options *api.DeleteOptions) error {
|
func (c *FakeDeployments) Delete(name string, options *api.DeleteOptions) error {
|
||||||
_, err := c.Fake.Invokes(NewDeleteAction("deployments", c.Namespace, name), &experimental.Deployment{})
|
_, err := c.Fake.Invokes(NewDeleteAction("deployments", c.Namespace, name), &extensions.Deployment{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,22 +31,22 @@ type FakeHorizontalPodAutoscalers struct {
|
|||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeHorizontalPodAutoscalers) Get(name string) (*experimental.HorizontalPodAutoscaler, error) {
|
func (c *FakeHorizontalPodAutoscalers) Get(name string) (*extensions.HorizontalPodAutoscaler, error) {
|
||||||
obj, err := c.Fake.Invokes(NewGetAction("horizontalpodautoscalers", c.Namespace, name), &experimental.HorizontalPodAutoscaler{})
|
obj, err := c.Fake.Invokes(NewGetAction("horizontalpodautoscalers", c.Namespace, name), &extensions.HorizontalPodAutoscaler{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.HorizontalPodAutoscaler), err
|
return obj.(*extensions.HorizontalPodAutoscaler), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeHorizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (*experimental.HorizontalPodAutoscalerList, error) {
|
func (c *FakeHorizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (*extensions.HorizontalPodAutoscalerList, error) {
|
||||||
obj, err := c.Fake.Invokes(NewListAction("horizontalpodautoscalers", c.Namespace, label, field), &experimental.HorizontalPodAutoscalerList{})
|
obj, err := c.Fake.Invokes(NewListAction("horizontalpodautoscalers", c.Namespace, label, field), &extensions.HorizontalPodAutoscalerList{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
list := &experimental.HorizontalPodAutoscalerList{}
|
list := &extensions.HorizontalPodAutoscalerList{}
|
||||||
for _, a := range obj.(*experimental.HorizontalPodAutoscalerList).Items {
|
for _, a := range obj.(*extensions.HorizontalPodAutoscalerList).Items {
|
||||||
if label.Matches(labels.Set(a.Labels)) {
|
if label.Matches(labels.Set(a.Labels)) {
|
||||||
list.Items = append(list.Items, a)
|
list.Items = append(list.Items, a)
|
||||||
}
|
}
|
||||||
@ -54,26 +54,26 @@ func (c *FakeHorizontalPodAutoscalers) List(label labels.Selector, field fields.
|
|||||||
return list, err
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeHorizontalPodAutoscalers) Create(a *experimental.HorizontalPodAutoscaler) (*experimental.HorizontalPodAutoscaler, error) {
|
func (c *FakeHorizontalPodAutoscalers) Create(a *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) {
|
||||||
obj, err := c.Fake.Invokes(NewCreateAction("horizontalpodautoscalers", c.Namespace, a), a)
|
obj, err := c.Fake.Invokes(NewCreateAction("horizontalpodautoscalers", c.Namespace, a), a)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.HorizontalPodAutoscaler), err
|
return obj.(*extensions.HorizontalPodAutoscaler), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeHorizontalPodAutoscalers) Update(a *experimental.HorizontalPodAutoscaler) (*experimental.HorizontalPodAutoscaler, error) {
|
func (c *FakeHorizontalPodAutoscalers) Update(a *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) {
|
||||||
obj, err := c.Fake.Invokes(NewUpdateAction("horizontalpodautoscalers", c.Namespace, a), a)
|
obj, err := c.Fake.Invokes(NewUpdateAction("horizontalpodautoscalers", c.Namespace, a), a)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.HorizontalPodAutoscaler), err
|
return obj.(*extensions.HorizontalPodAutoscaler), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *api.DeleteOptions) error {
|
func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *api.DeleteOptions) error {
|
||||||
_, err := c.Fake.Invokes(NewDeleteAction("horizontalpodautoscalers", c.Namespace, name), &experimental.HorizontalPodAutoscaler{})
|
_, err := c.Fake.Invokes(NewDeleteAction("horizontalpodautoscalers", c.Namespace, name), &extensions.HorizontalPodAutoscaler{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,44 +31,44 @@ type FakeIngress struct {
|
|||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeIngress) Get(name string) (*experimental.Ingress, error) {
|
func (c *FakeIngress) Get(name string) (*extensions.Ingress, error) {
|
||||||
obj, err := c.Fake.Invokes(NewGetAction("ingress", c.Namespace, name), &experimental.Ingress{})
|
obj, err := c.Fake.Invokes(NewGetAction("ingress", c.Namespace, name), &extensions.Ingress{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Ingress), err
|
return obj.(*extensions.Ingress), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeIngress) List(label labels.Selector, fields fields.Selector) (*experimental.IngressList, error) {
|
func (c *FakeIngress) List(label labels.Selector, fields fields.Selector) (*extensions.IngressList, error) {
|
||||||
obj, err := c.Fake.Invokes(NewListAction("ingress", c.Namespace, label, nil), &experimental.IngressList{})
|
obj, err := c.Fake.Invokes(NewListAction("ingress", c.Namespace, label, nil), &extensions.IngressList{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.IngressList), err
|
return obj.(*extensions.IngressList), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeIngress) Create(ingress *experimental.Ingress) (*experimental.Ingress, error) {
|
func (c *FakeIngress) Create(ingress *extensions.Ingress) (*extensions.Ingress, error) {
|
||||||
obj, err := c.Fake.Invokes(NewCreateAction("ingress", c.Namespace, ingress), ingress)
|
obj, err := c.Fake.Invokes(NewCreateAction("ingress", c.Namespace, ingress), ingress)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Ingress), err
|
return obj.(*extensions.Ingress), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeIngress) Update(ingress *experimental.Ingress) (*experimental.Ingress, error) {
|
func (c *FakeIngress) Update(ingress *extensions.Ingress) (*extensions.Ingress, error) {
|
||||||
obj, err := c.Fake.Invokes(NewUpdateAction("ingress", c.Namespace, ingress), ingress)
|
obj, err := c.Fake.Invokes(NewUpdateAction("ingress", c.Namespace, ingress), ingress)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Ingress), err
|
return obj.(*extensions.Ingress), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeIngress) Delete(name string, options *api.DeleteOptions) error {
|
func (c *FakeIngress) Delete(name string, options *api.DeleteOptions) error {
|
||||||
_, err := c.Fake.Invokes(NewDeleteAction("ingress", c.Namespace, name), &experimental.Ingress{})
|
_, err := c.Fake.Invokes(NewDeleteAction("ingress", c.Namespace, name), &extensions.Ingress{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,11 +76,11 @@ func (c *FakeIngress) Watch(label labels.Selector, field fields.Selector, resour
|
|||||||
return c.Fake.InvokesWatch(NewWatchAction("ingress", c.Namespace, label, field, resourceVersion))
|
return c.Fake.InvokesWatch(NewWatchAction("ingress", c.Namespace, label, field, resourceVersion))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeIngress) UpdateStatus(ingress *experimental.Ingress) (result *experimental.Ingress, err error) {
|
func (c *FakeIngress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
|
||||||
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("ingress", "status", c.Namespace, ingress), ingress)
|
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("ingress", "status", c.Namespace, ingress), ingress)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Ingress), err
|
return obj.(*extensions.Ingress), err
|
||||||
}
|
}
|
||||||
|
@ -31,44 +31,44 @@ type FakeJobs struct {
|
|||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeJobs) Get(name string) (*experimental.Job, error) {
|
func (c *FakeJobs) Get(name string) (*extensions.Job, error) {
|
||||||
obj, err := c.Fake.Invokes(NewGetAction("jobs", c.Namespace, name), &experimental.Job{})
|
obj, err := c.Fake.Invokes(NewGetAction("jobs", c.Namespace, name), &extensions.Job{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Job), err
|
return obj.(*extensions.Job), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeJobs) List(label labels.Selector, fields fields.Selector) (*experimental.JobList, error) {
|
func (c *FakeJobs) List(label labels.Selector, fields fields.Selector) (*extensions.JobList, error) {
|
||||||
obj, err := c.Fake.Invokes(NewListAction("jobs", c.Namespace, label, nil), &experimental.JobList{})
|
obj, err := c.Fake.Invokes(NewListAction("jobs", c.Namespace, label, nil), &extensions.JobList{})
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.JobList), err
|
return obj.(*extensions.JobList), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeJobs) Create(job *experimental.Job) (*experimental.Job, error) {
|
func (c *FakeJobs) Create(job *extensions.Job) (*extensions.Job, error) {
|
||||||
obj, err := c.Fake.Invokes(NewCreateAction("jobs", c.Namespace, job), job)
|
obj, err := c.Fake.Invokes(NewCreateAction("jobs", c.Namespace, job), job)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Job), err
|
return obj.(*extensions.Job), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeJobs) Update(job *experimental.Job) (*experimental.Job, error) {
|
func (c *FakeJobs) Update(job *extensions.Job) (*extensions.Job, error) {
|
||||||
obj, err := c.Fake.Invokes(NewUpdateAction("jobs", c.Namespace, job), job)
|
obj, err := c.Fake.Invokes(NewUpdateAction("jobs", c.Namespace, job), job)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Job), err
|
return obj.(*extensions.Job), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error {
|
func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error {
|
||||||
_, err := c.Fake.Invokes(NewDeleteAction("jobs", c.Namespace, name), &experimental.Job{})
|
_, err := c.Fake.Invokes(NewDeleteAction("jobs", c.Namespace, name), &extensions.Job{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,11 +76,11 @@ func (c *FakeJobs) Watch(label labels.Selector, field fields.Selector, resourceV
|
|||||||
return c.Fake.InvokesWatch(NewWatchAction("jobs", c.Namespace, label, field, resourceVersion))
|
return c.Fake.InvokesWatch(NewWatchAction("jobs", c.Namespace, label, field, resourceVersion))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeJobs) UpdateStatus(job *experimental.Job) (result *experimental.Job, err error) {
|
func (c *FakeJobs) UpdateStatus(job *extensions.Job) (result *extensions.Job, err error) {
|
||||||
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("jobs", "status", c.Namespace, job), job)
|
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("jobs", "status", c.Namespace, job), job)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(*experimental.Job), err
|
return obj.(*extensions.Job), err
|
||||||
}
|
}
|
||||||
|
@ -27,19 +27,19 @@ type FakeScales struct {
|
|||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeScales) Get(kind string, name string) (result *experimental.Scale, err error) {
|
func (c *FakeScales) Get(kind string, name string) (result *extensions.Scale, err error) {
|
||||||
action := GetActionImpl{}
|
action := GetActionImpl{}
|
||||||
action.Verb = "get"
|
action.Verb = "get"
|
||||||
action.Namespace = c.Namespace
|
action.Namespace = c.Namespace
|
||||||
action.Resource = kind
|
action.Resource = kind
|
||||||
action.Subresource = "scale"
|
action.Subresource = "scale"
|
||||||
action.Name = name
|
action.Name = name
|
||||||
obj, err := c.Fake.Invokes(action, &experimental.Scale{})
|
obj, err := c.Fake.Invokes(action, &extensions.Scale{})
|
||||||
result = obj.(*experimental.Scale)
|
result = obj.(*extensions.Scale)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeScales) Update(kind string, scale *experimental.Scale) (result *experimental.Scale, err error) {
|
func (c *FakeScales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||||
action := UpdateActionImpl{}
|
action := UpdateActionImpl{}
|
||||||
action.Verb = "update"
|
action.Verb = "update"
|
||||||
action.Namespace = c.Namespace
|
action.Namespace = c.Namespace
|
||||||
@ -47,6 +47,6 @@ func (c *FakeScales) Update(kind string, scale *experimental.Scale) (result *exp
|
|||||||
action.Subresource = "scale"
|
action.Subresource = "scale"
|
||||||
action.Object = scale
|
action.Object = scale
|
||||||
obj, err := c.Fake.Invokes(action, scale)
|
obj, err := c.Fake.Invokes(action, scale)
|
||||||
result = obj.(*experimental.Scale)
|
result = obj.(*extensions.Scale)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -103,22 +103,22 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
|
|||||||
return dsc.kubeClient.Experimental().DaemonSets(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
|
return dsc.kubeClient.Experimental().DaemonSets(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&experimental.DaemonSet{},
|
&extensions.DaemonSet{},
|
||||||
// TODO: Can we have much longer period here?
|
// TODO: Can we have much longer period here?
|
||||||
FullDaemonSetResyncPeriod,
|
FullDaemonSetResyncPeriod,
|
||||||
framework.ResourceEventHandlerFuncs{
|
framework.ResourceEventHandlerFuncs{
|
||||||
AddFunc: func(obj interface{}) {
|
AddFunc: func(obj interface{}) {
|
||||||
ds := obj.(*experimental.DaemonSet)
|
ds := obj.(*extensions.DaemonSet)
|
||||||
glog.V(4).Infof("Adding daemon set %s", ds.Name)
|
glog.V(4).Infof("Adding daemon set %s", ds.Name)
|
||||||
dsc.enqueueDaemonSet(obj)
|
dsc.enqueueDaemonSet(obj)
|
||||||
},
|
},
|
||||||
UpdateFunc: func(old, cur interface{}) {
|
UpdateFunc: func(old, cur interface{}) {
|
||||||
oldDS := old.(*experimental.DaemonSet)
|
oldDS := old.(*extensions.DaemonSet)
|
||||||
glog.V(4).Infof("Updating daemon set %s", oldDS.Name)
|
glog.V(4).Infof("Updating daemon set %s", oldDS.Name)
|
||||||
dsc.enqueueDaemonSet(cur)
|
dsc.enqueueDaemonSet(cur)
|
||||||
},
|
},
|
||||||
DeleteFunc: func(obj interface{}) {
|
DeleteFunc: func(obj interface{}) {
|
||||||
ds := obj.(*experimental.DaemonSet)
|
ds := obj.(*extensions.DaemonSet)
|
||||||
glog.V(4).Infof("Deleting daemon set %s", ds.Name)
|
glog.V(4).Infof("Deleting daemon set %s", ds.Name)
|
||||||
dsc.enqueueDaemonSet(obj)
|
dsc.enqueueDaemonSet(obj)
|
||||||
},
|
},
|
||||||
@ -218,7 +218,7 @@ func (dsc *DaemonSetsController) enqueueDaemonSet(obj interface{}) {
|
|||||||
dsc.queue.Add(key)
|
dsc.queue.Add(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dsc *DaemonSetsController) getPodDaemonSet(pod *api.Pod) *experimental.DaemonSet {
|
func (dsc *DaemonSetsController) getPodDaemonSet(pod *api.Pod) *extensions.DaemonSet {
|
||||||
sets, err := dsc.dsStore.GetPodDaemonSets(pod)
|
sets, err := dsc.dsStore.GetPodDaemonSets(pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(4).Infof("No daemon sets found for pod %v, daemon set controller will avoid syncing", pod.Name)
|
glog.V(4).Infof("No daemon sets found for pod %v, daemon set controller will avoid syncing", pod.Name)
|
||||||
@ -321,7 +321,7 @@ func (dsc *DaemonSetsController) updateNode(old, cur interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getNodesToDaemonSetPods returns a map from nodes to daemon pods (corresponding to ds) running on the nodes.
|
// getNodesToDaemonSetPods returns a map from nodes to daemon pods (corresponding to ds) running on the nodes.
|
||||||
func (dsc *DaemonSetsController) getNodesToDaemonPods(ds *experimental.DaemonSet) (map[string][]*api.Pod, error) {
|
func (dsc *DaemonSetsController) getNodesToDaemonPods(ds *extensions.DaemonSet) (map[string][]*api.Pod, error) {
|
||||||
nodeToDaemonPods := make(map[string][]*api.Pod)
|
nodeToDaemonPods := make(map[string][]*api.Pod)
|
||||||
daemonPods, err := dsc.podStore.Pods(ds.Namespace).List(labels.Set(ds.Spec.Selector).AsSelector())
|
daemonPods, err := dsc.podStore.Pods(ds.Namespace).List(labels.Set(ds.Spec.Selector).AsSelector())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -334,7 +334,7 @@ func (dsc *DaemonSetsController) getNodesToDaemonPods(ds *experimental.DaemonSet
|
|||||||
return nodeToDaemonPods, nil
|
return nodeToDaemonPods, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dsc *DaemonSetsController) manage(ds *experimental.DaemonSet) {
|
func (dsc *DaemonSetsController) manage(ds *extensions.DaemonSet) {
|
||||||
// Find out which nodes are running the daemon pods selected by ds.
|
// Find out which nodes are running the daemon pods selected by ds.
|
||||||
nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ds)
|
nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -401,7 +401,7 @@ func (dsc *DaemonSetsController) manage(ds *experimental.DaemonSet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func storeDaemonSetStatus(dsClient client.DaemonSetInterface, ds *experimental.DaemonSet, desiredNumberScheduled, currentNumberScheduled, numberMisscheduled int) error {
|
func storeDaemonSetStatus(dsClient client.DaemonSetInterface, ds *extensions.DaemonSet, desiredNumberScheduled, currentNumberScheduled, numberMisscheduled int) error {
|
||||||
if ds.Status.DesiredNumberScheduled == desiredNumberScheduled && ds.Status.CurrentNumberScheduled == currentNumberScheduled && ds.Status.NumberMisscheduled == numberMisscheduled {
|
if ds.Status.DesiredNumberScheduled == desiredNumberScheduled && ds.Status.CurrentNumberScheduled == currentNumberScheduled && ds.Status.NumberMisscheduled == numberMisscheduled {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -426,7 +426,7 @@ func storeDaemonSetStatus(dsClient client.DaemonSetInterface, ds *experimental.D
|
|||||||
return updateErr
|
return updateErr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dsc *DaemonSetsController) updateDaemonSetStatus(ds *experimental.DaemonSet) {
|
func (dsc *DaemonSetsController) updateDaemonSetStatus(ds *extensions.DaemonSet) {
|
||||||
glog.V(4).Infof("Updating daemon set status")
|
glog.V(4).Infof("Updating daemon set status")
|
||||||
nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ds)
|
nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -482,7 +482,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
|
|||||||
dsc.expectations.DeleteExpectations(key)
|
dsc.expectations.DeleteExpectations(key)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ds := obj.(*experimental.DaemonSet)
|
ds := obj.(*extensions.DaemonSet)
|
||||||
if !dsc.podStoreSynced() {
|
if !dsc.podStoreSynced() {
|
||||||
// Sleep so we give the pod reflector goroutine a chance to run.
|
// Sleep so we give the pod reflector goroutine a chance to run.
|
||||||
time.Sleep(PodStoreSyncedPollPeriod)
|
time.Sleep(PodStoreSyncedPollPeriod)
|
||||||
@ -509,7 +509,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// byCreationTimestamp sorts a list by creation timestamp, using their names as a tie breaker.
|
// byCreationTimestamp sorts a list by creation timestamp, using their names as a tie breaker.
|
||||||
type byCreationTimestamp []experimental.DaemonSet
|
type byCreationTimestamp []extensions.DaemonSet
|
||||||
|
|
||||||
func (o byCreationTimestamp) Len() int { return len(o) }
|
func (o byCreationTimestamp) Len() int { return len(o) }
|
||||||
func (o byCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
|
func (o byCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
|
||||||
|
@ -42,7 +42,7 @@ func init() {
|
|||||||
api.ForTesting_ReferencesAllowBlankSelfLinks = true
|
api.ForTesting_ReferencesAllowBlankSelfLinks = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func getKey(ds *experimental.DaemonSet, t *testing.T) string {
|
func getKey(ds *extensions.DaemonSet, t *testing.T) string {
|
||||||
if key, err := controller.KeyFunc(ds); err != nil {
|
if key, err := controller.KeyFunc(ds); err != nil {
|
||||||
t.Errorf("Unexpected error getting key for ds %v: %v", ds.Name, err)
|
t.Errorf("Unexpected error getting key for ds %v: %v", ds.Name, err)
|
||||||
return ""
|
return ""
|
||||||
@ -51,14 +51,14 @@ func getKey(ds *experimental.DaemonSet, t *testing.T) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDaemonSet(name string) *experimental.DaemonSet {
|
func newDaemonSet(name string) *extensions.DaemonSet {
|
||||||
return &experimental.DaemonSet{
|
return &extensions.DaemonSet{
|
||||||
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Extensions.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Extensions.Version()},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: simpleDaemonSetLabel,
|
Selector: simpleDaemonSetLabel,
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -146,7 +146,7 @@ func validateSyncDaemonSets(t *testing.T, fakePodControl *controller.FakePodCont
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func syncAndValidateDaemonSets(t *testing.T, manager *DaemonSetsController, ds *experimental.DaemonSet, podControl *controller.FakePodControl, expectedCreates, expectedDeletes int) {
|
func syncAndValidateDaemonSets(t *testing.T, manager *DaemonSetsController, ds *extensions.DaemonSet, podControl *controller.FakePodControl, expectedCreates, expectedDeletes int) {
|
||||||
key, err := controller.KeyFunc(ds)
|
key, err := controller.KeyFunc(ds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Could not get key for daemon.")
|
t.Errorf("Could not get key for daemon.")
|
||||||
|
@ -73,22 +73,22 @@ func (d *DeploymentController) reconcileDeployments() []error {
|
|||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) reconcileDeployment(deployment *experimental.Deployment) error {
|
func (d *DeploymentController) reconcileDeployment(deployment *extensions.Deployment) error {
|
||||||
switch deployment.Spec.Strategy.Type {
|
switch deployment.Spec.Strategy.Type {
|
||||||
case experimental.RecreateDeploymentStrategyType:
|
case extensions.RecreateDeploymentStrategyType:
|
||||||
return d.reconcileRecreateDeployment(*deployment)
|
return d.reconcileRecreateDeployment(*deployment)
|
||||||
case experimental.RollingUpdateDeploymentStrategyType:
|
case extensions.RollingUpdateDeploymentStrategyType:
|
||||||
return d.reconcileRollingUpdateDeployment(*deployment)
|
return d.reconcileRollingUpdateDeployment(*deployment)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unexpected deployment strategy type: %s", deployment.Spec.Strategy.Type)
|
return fmt.Errorf("unexpected deployment strategy type: %s", deployment.Spec.Strategy.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) reconcileRecreateDeployment(deployment experimental.Deployment) error {
|
func (d *DeploymentController) reconcileRecreateDeployment(deployment extensions.Deployment) error {
|
||||||
// TODO: implement me.
|
// TODO: implement me.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) reconcileRollingUpdateDeployment(deployment experimental.Deployment) error {
|
func (d *DeploymentController) reconcileRollingUpdateDeployment(deployment extensions.Deployment) error {
|
||||||
newRC, err := d.getNewRC(deployment)
|
newRC, err := d.getNewRC(deployment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -124,13 +124,13 @@ func (d *DeploymentController) reconcileRollingUpdateDeployment(deployment exper
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) getOldRCs(deployment experimental.Deployment) ([]*api.ReplicationController, error) {
|
func (d *DeploymentController) getOldRCs(deployment extensions.Deployment) ([]*api.ReplicationController, error) {
|
||||||
return deploymentUtil.GetOldRCs(deployment, d.client)
|
return deploymentUtil.GetOldRCs(deployment, d.client)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an RC that matches the intent of the given deployment.
|
// Returns an RC that matches the intent of the given deployment.
|
||||||
// It creates a new RC if required.
|
// It creates a new RC if required.
|
||||||
func (d *DeploymentController) getNewRC(deployment experimental.Deployment) (*api.ReplicationController, error) {
|
func (d *DeploymentController) getNewRC(deployment extensions.Deployment) (*api.ReplicationController, error) {
|
||||||
existingNewRC, err := deploymentUtil.GetNewRC(deployment, d.client)
|
existingNewRC, err := deploymentUtil.GetNewRC(deployment, d.client)
|
||||||
if err != nil || existingNewRC != nil {
|
if err != nil || existingNewRC != nil {
|
||||||
return existingNewRC, err
|
return existingNewRC, err
|
||||||
@ -158,7 +158,7 @@ func (d *DeploymentController) getNewRC(deployment experimental.Deployment) (*ap
|
|||||||
return createdRC, nil
|
return createdRC, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) reconcileNewRC(allRCs []*api.ReplicationController, newRC *api.ReplicationController, deployment experimental.Deployment) (bool, error) {
|
func (d *DeploymentController) reconcileNewRC(allRCs []*api.ReplicationController, newRC *api.ReplicationController, deployment extensions.Deployment) (bool, error) {
|
||||||
if newRC.Spec.Replicas == deployment.Spec.Replicas {
|
if newRC.Spec.Replicas == deployment.Spec.Replicas {
|
||||||
// Scaling not required.
|
// Scaling not required.
|
||||||
return false, nil
|
return false, nil
|
||||||
@ -192,7 +192,7 @@ func (d *DeploymentController) reconcileNewRC(allRCs []*api.ReplicationControlle
|
|||||||
return true, err
|
return true, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationController, oldRCs []*api.ReplicationController, newRC *api.ReplicationController, deployment experimental.Deployment) (bool, error) {
|
func (d *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationController, oldRCs []*api.ReplicationController, newRC *api.ReplicationController, deployment extensions.Deployment) (bool, error) {
|
||||||
oldPodsCount := deploymentUtil.GetReplicaCountForRCs(oldRCs)
|
oldPodsCount := deploymentUtil.GetReplicaCountForRCs(oldRCs)
|
||||||
if oldPodsCount == 0 {
|
if oldPodsCount == 0 {
|
||||||
// Cant scale down further
|
// Cant scale down further
|
||||||
@ -239,12 +239,12 @@ func (d *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControll
|
|||||||
return true, err
|
return true, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) updateDeploymentStatus(allRCs []*api.ReplicationController, newRC *api.ReplicationController, deployment experimental.Deployment) error {
|
func (d *DeploymentController) updateDeploymentStatus(allRCs []*api.ReplicationController, newRC *api.ReplicationController, deployment extensions.Deployment) error {
|
||||||
totalReplicas := deploymentUtil.GetReplicaCountForRCs(allRCs)
|
totalReplicas := deploymentUtil.GetReplicaCountForRCs(allRCs)
|
||||||
updatedReplicas := deploymentUtil.GetReplicaCountForRCs([]*api.ReplicationController{newRC})
|
updatedReplicas := deploymentUtil.GetReplicaCountForRCs([]*api.ReplicationController{newRC})
|
||||||
newDeployment := deployment
|
newDeployment := deployment
|
||||||
// TODO: Reconcile this with API definition. API definition talks about ready pods, while this just computes created pods.
|
// TODO: Reconcile this with API definition. API definition talks about ready pods, while this just computes created pods.
|
||||||
newDeployment.Status = experimental.DeploymentStatus{
|
newDeployment.Status = extensions.DeploymentStatus{
|
||||||
Replicas: totalReplicas,
|
Replicas: totalReplicas,
|
||||||
UpdatedReplicas: updatedReplicas,
|
UpdatedReplicas: updatedReplicas,
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ func (d *DeploymentController) updateDeploymentStatus(allRCs []*api.ReplicationC
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) scaleRCAndRecordEvent(rc *api.ReplicationController, newScale int, deployment experimental.Deployment) (*api.ReplicationController, error) {
|
func (d *DeploymentController) scaleRCAndRecordEvent(rc *api.ReplicationController, newScale int, deployment extensions.Deployment) (*api.ReplicationController, error) {
|
||||||
scalingOperation := "down"
|
scalingOperation := "down"
|
||||||
if rc.Spec.Replicas < newScale {
|
if rc.Spec.Replicas < newScale {
|
||||||
scalingOperation = "up"
|
scalingOperation = "up"
|
||||||
@ -270,7 +270,7 @@ func (d *DeploymentController) scaleRC(rc *api.ReplicationController, newScale i
|
|||||||
return d.client.ReplicationControllers(rc.ObjectMeta.Namespace).Update(rc)
|
return d.client.ReplicationControllers(rc.ObjectMeta.Namespace).Update(rc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DeploymentController) updateDeployment(deployment *experimental.Deployment) (*experimental.Deployment, error) {
|
func (d *DeploymentController) updateDeployment(deployment *extensions.Deployment) (*extensions.Deployment, error) {
|
||||||
// TODO: Using client for now, update to use store when it is ready.
|
// TODO: Using client for now, update to use store when it is ready.
|
||||||
return d.client.Experimental().Deployments(deployment.ObjectMeta.Namespace).Update(deployment)
|
return d.client.Experimental().Deployments(deployment.ObjectMeta.Namespace).Update(deployment)
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ type JobController struct {
|
|||||||
podControl controller.PodControlInterface
|
podControl controller.PodControlInterface
|
||||||
|
|
||||||
// To allow injection of updateJobStatus for testing.
|
// To allow injection of updateJobStatus for testing.
|
||||||
updateHandler func(job *experimental.Job) error
|
updateHandler func(job *extensions.Job) error
|
||||||
syncHandler func(jobKey string) error
|
syncHandler func(jobKey string) error
|
||||||
// podStoreSynced returns true if the pod store has been synced at least once.
|
// podStoreSynced returns true if the pod store has been synced at least once.
|
||||||
// Added as a member to the struct to allow injection for testing.
|
// Added as a member to the struct to allow injection for testing.
|
||||||
@ -92,13 +92,13 @@ func NewJobController(kubeClient client.Interface, resyncPeriod controller.Resyn
|
|||||||
return jm.kubeClient.Experimental().Jobs(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
|
return jm.kubeClient.Experimental().Jobs(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&experimental.Job{},
|
&extensions.Job{},
|
||||||
// TODO: Can we have much longer period here?
|
// TODO: Can we have much longer period here?
|
||||||
replicationcontroller.FullControllerResyncPeriod,
|
replicationcontroller.FullControllerResyncPeriod,
|
||||||
framework.ResourceEventHandlerFuncs{
|
framework.ResourceEventHandlerFuncs{
|
||||||
AddFunc: jm.enqueueController,
|
AddFunc: jm.enqueueController,
|
||||||
UpdateFunc: func(old, cur interface{}) {
|
UpdateFunc: func(old, cur interface{}) {
|
||||||
if job := cur.(*experimental.Job); !isJobFinished(job) {
|
if job := cur.(*extensions.Job); !isJobFinished(job) {
|
||||||
jm.enqueueController(job)
|
jm.enqueueController(job)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -144,7 +144,7 @@ func (jm *JobController) Run(workers int, stopCh <-chan struct{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getPodJob returns the job managing the given pod.
|
// getPodJob returns the job managing the given pod.
|
||||||
func (jm *JobController) getPodJob(pod *api.Pod) *experimental.Job {
|
func (jm *JobController) getPodJob(pod *api.Pod) *extensions.Job {
|
||||||
jobs, err := jm.jobStore.GetPodJobs(pod)
|
jobs, err := jm.jobStore.GetPodJobs(pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(4).Infof("No jobs found for pod %v, job controller will avoid syncing", pod.Name)
|
glog.V(4).Infof("No jobs found for pod %v, job controller will avoid syncing", pod.Name)
|
||||||
@ -240,7 +240,7 @@ func (jm *JobController) deletePod(obj interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// obj could be an *experimental.Job, or a DeletionFinalStateUnknown marker item.
|
// obj could be an *extensions.Job, or a DeletionFinalStateUnknown marker item.
|
||||||
func (jm *JobController) enqueueController(obj interface{}) {
|
func (jm *JobController) enqueueController(obj interface{}) {
|
||||||
key, err := controller.KeyFunc(obj)
|
key, err := controller.KeyFunc(obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -295,7 +295,7 @@ func (jm *JobController) syncJob(key string) error {
|
|||||||
jm.queue.Add(key)
|
jm.queue.Add(key)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
job := *obj.(*experimental.Job)
|
job := *obj.(*extensions.Job)
|
||||||
if !jm.podStoreSynced() {
|
if !jm.podStoreSynced() {
|
||||||
// Sleep so we give the pod reflector goroutine a chance to run.
|
// Sleep so we give the pod reflector goroutine a chance to run.
|
||||||
time.Sleep(replicationcontroller.PodStoreSyncedPollPeriod)
|
time.Sleep(replicationcontroller.PodStoreSyncedPollPeriod)
|
||||||
@ -345,9 +345,9 @@ func (jm *JobController) syncJob(key string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCondition() experimental.JobCondition {
|
func newCondition() extensions.JobCondition {
|
||||||
return experimental.JobCondition{
|
return extensions.JobCondition{
|
||||||
Type: experimental.JobComplete,
|
Type: extensions.JobComplete,
|
||||||
Status: api.ConditionTrue,
|
Status: api.ConditionTrue,
|
||||||
LastProbeTime: unversioned.Now(),
|
LastProbeTime: unversioned.Now(),
|
||||||
LastTransitionTime: unversioned.Now(),
|
LastTransitionTime: unversioned.Now(),
|
||||||
@ -360,7 +360,7 @@ func getStatus(pods []api.Pod) (succeeded, failed int) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *experimental.Job) int {
|
func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *extensions.Job) int {
|
||||||
var activeLock sync.Mutex
|
var activeLock sync.Mutex
|
||||||
active := len(activePods)
|
active := len(activePods)
|
||||||
parallelism := *job.Spec.Parallelism
|
parallelism := *job.Spec.Parallelism
|
||||||
@ -430,7 +430,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ex
|
|||||||
return active
|
return active
|
||||||
}
|
}
|
||||||
|
|
||||||
func (jm *JobController) updateJobStatus(job *experimental.Job) error {
|
func (jm *JobController) updateJobStatus(job *extensions.Job) error {
|
||||||
_, err := jm.kubeClient.Experimental().Jobs(job.Namespace).UpdateStatus(job)
|
_, err := jm.kubeClient.Experimental().Jobs(job.Namespace).UpdateStatus(job)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -446,9 +446,9 @@ func filterPods(pods []api.Pod, phase api.PodPhase) int {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func isJobFinished(j *experimental.Job) bool {
|
func isJobFinished(j *extensions.Job) bool {
|
||||||
for _, c := range j.Status.Conditions {
|
for _, c := range j.Status.Conditions {
|
||||||
if c.Type == experimental.JobComplete && c.Status == api.ConditionTrue {
|
if c.Type == extensions.JobComplete && c.Status == api.ConditionTrue {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ func isJobFinished(j *experimental.Job) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// byCreationTimestamp sorts a list by creation timestamp, using their names as a tie breaker.
|
// byCreationTimestamp sorts a list by creation timestamp, using their names as a tie breaker.
|
||||||
type byCreationTimestamp []experimental.Job
|
type byCreationTimestamp []extensions.Job
|
||||||
|
|
||||||
func (o byCreationTimestamp) Len() int { return len(o) }
|
func (o byCreationTimestamp) Len() int { return len(o) }
|
||||||
func (o byCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
|
func (o byCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
|
||||||
|
@ -34,13 +34,13 @@ import (
|
|||||||
|
|
||||||
var alwaysReady = func() bool { return true }
|
var alwaysReady = func() bool { return true }
|
||||||
|
|
||||||
func newJob(parallelism, completions int) *experimental.Job {
|
func newJob(parallelism, completions int) *extensions.Job {
|
||||||
return &experimental.Job{
|
return &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foobar",
|
Name: "foobar",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: ¶llelism,
|
Parallelism: ¶llelism,
|
||||||
Completions: &completions,
|
Completions: &completions,
|
||||||
Selector: map[string]string{"foo": "bar"},
|
Selector: map[string]string{"foo": "bar"},
|
||||||
@ -60,7 +60,7 @@ func newJob(parallelism, completions int) *experimental.Job {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getKey(job *experimental.Job, t *testing.T) string {
|
func getKey(job *extensions.Job, t *testing.T) string {
|
||||||
if key, err := controller.KeyFunc(job); err != nil {
|
if key, err := controller.KeyFunc(job); err != nil {
|
||||||
t.Errorf("Unexpected error getting key for job %v: %v", job.Name, err)
|
t.Errorf("Unexpected error getting key for job %v: %v", job.Name, err)
|
||||||
return ""
|
return ""
|
||||||
@ -70,7 +70,7 @@ func getKey(job *experimental.Job, t *testing.T) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create count pods with the given phase for the given job
|
// create count pods with the given phase for the given job
|
||||||
func newPodList(count int, status api.PodPhase, job *experimental.Job) []api.Pod {
|
func newPodList(count int, status api.PodPhase, job *extensions.Job) []api.Pod {
|
||||||
pods := []api.Pod{}
|
pods := []api.Pod{}
|
||||||
for i := 0; i < count; i++ {
|
for i := 0; i < count; i++ {
|
||||||
newPod := api.Pod{
|
newPod := api.Pod{
|
||||||
@ -165,8 +165,8 @@ func TestControllerSyncJob(t *testing.T) {
|
|||||||
fakePodControl := controller.FakePodControl{Err: tc.podControllerError}
|
fakePodControl := controller.FakePodControl{Err: tc.podControllerError}
|
||||||
manager.podControl = &fakePodControl
|
manager.podControl = &fakePodControl
|
||||||
manager.podStoreSynced = alwaysReady
|
manager.podStoreSynced = alwaysReady
|
||||||
var actual *experimental.Job
|
var actual *extensions.Job
|
||||||
manager.updateHandler = func(job *experimental.Job) error {
|
manager.updateHandler = func(job *extensions.Job) error {
|
||||||
actual = job
|
actual = job
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ func TestControllerSyncJob(t *testing.T) {
|
|||||||
if tc.expectedComplete {
|
if tc.expectedComplete {
|
||||||
completed := false
|
completed := false
|
||||||
for _, v := range actual.Status.Conditions {
|
for _, v := range actual.Status.Conditions {
|
||||||
if v.Type == experimental.JobComplete && v.Status == api.ConditionTrue {
|
if v.Type == extensions.JobComplete && v.Status == api.ConditionTrue {
|
||||||
completed = true
|
completed = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ func TestSyncJobDeleted(t *testing.T) {
|
|||||||
fakePodControl := controller.FakePodControl{}
|
fakePodControl := controller.FakePodControl{}
|
||||||
manager.podControl = &fakePodControl
|
manager.podControl = &fakePodControl
|
||||||
manager.podStoreSynced = alwaysReady
|
manager.podStoreSynced = alwaysReady
|
||||||
manager.updateHandler = func(job *experimental.Job) error { return nil }
|
manager.updateHandler = func(job *extensions.Job) error { return nil }
|
||||||
job := newJob(2, 2)
|
job := newJob(2, 2)
|
||||||
err := manager.syncJob(getKey(job, t))
|
err := manager.syncJob(getKey(job, t))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -249,7 +249,7 @@ func TestSyncJobUpdateRequeue(t *testing.T) {
|
|||||||
fakePodControl := controller.FakePodControl{}
|
fakePodControl := controller.FakePodControl{}
|
||||||
manager.podControl = &fakePodControl
|
manager.podControl = &fakePodControl
|
||||||
manager.podStoreSynced = alwaysReady
|
manager.podStoreSynced = alwaysReady
|
||||||
manager.updateHandler = func(job *experimental.Job) error { return fmt.Errorf("Fake error") }
|
manager.updateHandler = func(job *extensions.Job) error { return fmt.Errorf("Fake error") }
|
||||||
job := newJob(2, 2)
|
job := newJob(2, 2)
|
||||||
manager.jobStore.Store.Add(job)
|
manager.jobStore.Store.Add(job)
|
||||||
err := manager.syncJob(getKey(job, t))
|
err := manager.syncJob(getKey(job, t))
|
||||||
@ -269,14 +269,14 @@ func TestJobPodLookup(t *testing.T) {
|
|||||||
manager := NewJobController(client, controller.NoResyncPeriodFunc)
|
manager := NewJobController(client, controller.NoResyncPeriodFunc)
|
||||||
manager.podStoreSynced = alwaysReady
|
manager.podStoreSynced = alwaysReady
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
job *experimental.Job
|
job *extensions.Job
|
||||||
pod *api.Pod
|
pod *api.Pod
|
||||||
|
|
||||||
expectedName string
|
expectedName string
|
||||||
}{
|
}{
|
||||||
// pods without labels don't match any job
|
// pods without labels don't match any job
|
||||||
{
|
{
|
||||||
job: &experimental.Job{
|
job: &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "basic"},
|
ObjectMeta: api.ObjectMeta{Name: "basic"},
|
||||||
},
|
},
|
||||||
pod: &api.Pod{
|
pod: &api.Pod{
|
||||||
@ -286,9 +286,9 @@ func TestJobPodLookup(t *testing.T) {
|
|||||||
},
|
},
|
||||||
// matching labels, different namespace
|
// matching labels, different namespace
|
||||||
{
|
{
|
||||||
job: &experimental.Job{
|
job: &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: map[string]string{"foo": "bar"},
|
Selector: map[string]string{"foo": "bar"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -303,9 +303,9 @@ func TestJobPodLookup(t *testing.T) {
|
|||||||
},
|
},
|
||||||
// matching ns and labels returns
|
// matching ns and labels returns
|
||||||
{
|
{
|
||||||
job: &experimental.Job{
|
job: &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"},
|
ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: map[string]string{"foo": "bar"},
|
Selector: map[string]string{"foo": "bar"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -350,7 +350,7 @@ func TestSyncJobExpectations(t *testing.T) {
|
|||||||
fakePodControl := controller.FakePodControl{}
|
fakePodControl := controller.FakePodControl{}
|
||||||
manager.podControl = &fakePodControl
|
manager.podControl = &fakePodControl
|
||||||
manager.podStoreSynced = alwaysReady
|
manager.podStoreSynced = alwaysReady
|
||||||
manager.updateHandler = func(job *experimental.Job) error { return nil }
|
manager.updateHandler = func(job *extensions.Job) error { return nil }
|
||||||
|
|
||||||
job := newJob(2, 2)
|
job := newJob(2, 2)
|
||||||
manager.jobStore.Store.Add(job)
|
manager.jobStore.Store.Add(job)
|
||||||
@ -386,7 +386,7 @@ func TestWatchJobs(t *testing.T) {
|
|||||||
manager := NewJobController(client, controller.NoResyncPeriodFunc)
|
manager := NewJobController(client, controller.NoResyncPeriodFunc)
|
||||||
manager.podStoreSynced = alwaysReady
|
manager.podStoreSynced = alwaysReady
|
||||||
|
|
||||||
var testJob experimental.Job
|
var testJob extensions.Job
|
||||||
received := make(chan struct{})
|
received := make(chan struct{})
|
||||||
|
|
||||||
// The update sent through the fakeWatcher should make its way into the workqueue,
|
// The update sent through the fakeWatcher should make its way into the workqueue,
|
||||||
@ -397,7 +397,7 @@ func TestWatchJobs(t *testing.T) {
|
|||||||
if !exists || err != nil {
|
if !exists || err != nil {
|
||||||
t.Errorf("Expected to find job under key %v", key)
|
t.Errorf("Expected to find job under key %v", key)
|
||||||
}
|
}
|
||||||
job := *obj.(*experimental.Job)
|
job := *obj.(*extensions.Job)
|
||||||
if !api.Semantic.DeepDerivative(job, testJob) {
|
if !api.Semantic.DeepDerivative(job, testJob) {
|
||||||
t.Errorf("Expected %#v, but got %#v", testJob, job)
|
t.Errorf("Expected %#v, but got %#v", testJob, job)
|
||||||
}
|
}
|
||||||
@ -419,10 +419,10 @@ func TestWatchJobs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsJobFinished(t *testing.T) {
|
func TestIsJobFinished(t *testing.T) {
|
||||||
job := &experimental.Job{
|
job := &extensions.Job{
|
||||||
Status: experimental.JobStatus{
|
Status: extensions.JobStatus{
|
||||||
Conditions: []experimental.JobCondition{{
|
Conditions: []extensions.JobCondition{{
|
||||||
Type: experimental.JobComplete,
|
Type: extensions.JobComplete,
|
||||||
Status: api.ConditionTrue,
|
Status: api.ConditionTrue,
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
@ -462,7 +462,7 @@ func TestWatchPods(t *testing.T) {
|
|||||||
if !exists || err != nil {
|
if !exists || err != nil {
|
||||||
t.Errorf("Expected to find job under key %v", key)
|
t.Errorf("Expected to find job under key %v", key)
|
||||||
}
|
}
|
||||||
job := obj.(*experimental.Job)
|
job := obj.(*extensions.Job)
|
||||||
if !api.Semantic.DeepDerivative(job, testJob) {
|
if !api.Semantic.DeepDerivative(job, testJob) {
|
||||||
t.Errorf("\nExpected %#v,\nbut got %#v", testJob, job)
|
t.Errorf("\nExpected %#v,\nbut got %#v", testJob, job)
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ const (
|
|||||||
// A PV created specifically for one claim must contain this annotation in order to bind to the claim.
|
// A PV created specifically for one claim must contain this annotation in order to bind to the claim.
|
||||||
// The value must be the namespace and name of the claim being bound to (i.e, claim.Namespace/claim.Name)
|
// The value must be the namespace and name of the claim being bound to (i.e, claim.Namespace/claim.Name)
|
||||||
// This is an experimental feature and likely to change in the future.
|
// This is an experimental feature and likely to change in the future.
|
||||||
createdForKey = "volume.experimental.kubernetes.io/provisioned-for"
|
createdForKey = "volume.extensions.kubernetes.io/provisioned-for"
|
||||||
)
|
)
|
||||||
|
|
||||||
// persistentVolumeOrderedIndex is a cache.Store that keeps persistent volumes indexed by AccessModes and ordered by storage capacity.
|
// persistentVolumeOrderedIndex is a cache.Store that keeps persistent volumes indexed by AccessModes and ordered by storage capacity.
|
||||||
|
@ -68,7 +68,7 @@ func (a *HorizontalController) Run(syncPeriod time.Duration) {
|
|||||||
}, syncPeriod, util.NeverStop)
|
}, syncPeriod, util.NeverStop)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *HorizontalController) reconcileAutoscaler(hpa experimental.HorizontalPodAutoscaler) error {
|
func (a *HorizontalController) reconcileAutoscaler(hpa extensions.HorizontalPodAutoscaler) error {
|
||||||
reference := fmt.Sprintf("%s/%s/%s", hpa.Spec.ScaleRef.Kind, hpa.Spec.ScaleRef.Namespace, hpa.Spec.ScaleRef.Name)
|
reference := fmt.Sprintf("%s/%s/%s", hpa.Spec.ScaleRef.Kind, hpa.Spec.ScaleRef.Namespace, hpa.Spec.ScaleRef.Name)
|
||||||
|
|
||||||
scale, err := a.client.Experimental().Scales(hpa.Spec.ScaleRef.Namespace).Get(hpa.Spec.ScaleRef.Kind, hpa.Spec.ScaleRef.Name)
|
scale, err := a.client.Experimental().Scales(hpa.Spec.ScaleRef.Namespace).Get(hpa.Spec.ScaleRef.Kind, hpa.Spec.ScaleRef.Name)
|
||||||
@ -137,7 +137,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa experimental.HorizontalPo
|
|||||||
desiredReplicas = currentReplicas
|
desiredReplicas = currentReplicas
|
||||||
}
|
}
|
||||||
|
|
||||||
hpa.Status = experimental.HorizontalPodAutoscalerStatus{
|
hpa.Status = extensions.HorizontalPodAutoscalerStatus{
|
||||||
CurrentReplicas: currentReplicas,
|
CurrentReplicas: currentReplicas,
|
||||||
DesiredReplicas: desiredReplicas,
|
DesiredReplicas: desiredReplicas,
|
||||||
CurrentConsumption: currentConsumption,
|
CurrentConsumption: currentConsumption,
|
||||||
|
@ -77,16 +77,16 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake {
|
|||||||
|
|
||||||
fakeClient := &testclient.Fake{}
|
fakeClient := &testclient.Fake{}
|
||||||
fakeClient.AddReactor("list", "horizontalpodautoscalers", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
fakeClient.AddReactor("list", "horizontalpodautoscalers", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
||||||
obj := &experimental.HorizontalPodAutoscalerList{
|
obj := &extensions.HorizontalPodAutoscalerList{
|
||||||
Items: []experimental.HorizontalPodAutoscaler{
|
Items: []extensions.HorizontalPodAutoscaler{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: hpaName,
|
Name: hpaName,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
SelfLink: "experimental/v1/namespaces/" + namespace + "/horizontalpodautoscalers/" + hpaName,
|
SelfLink: "experimental/v1/namespaces/" + namespace + "/horizontalpodautoscalers/" + hpaName,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Kind: "replicationController",
|
Kind: "replicationController",
|
||||||
Name: rcName,
|
Name: rcName,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
@ -94,7 +94,7 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake {
|
|||||||
},
|
},
|
||||||
MinReplicas: tc.minReplicas,
|
MinReplicas: tc.minReplicas,
|
||||||
MaxReplicas: tc.maxReplicas,
|
MaxReplicas: tc.maxReplicas,
|
||||||
Target: experimental.ResourceConsumption{Resource: tc.targetResource, Quantity: tc.targetLevel},
|
Target: extensions.ResourceConsumption{Resource: tc.targetResource, Quantity: tc.targetLevel},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -103,15 +103,15 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake {
|
|||||||
})
|
})
|
||||||
|
|
||||||
fakeClient.AddReactor("get", "replicationController", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
fakeClient.AddReactor("get", "replicationController", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
||||||
obj := &experimental.Scale{
|
obj := &extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: rcName,
|
Name: rcName,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
},
|
},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: tc.initialReplicas,
|
Replicas: tc.initialReplicas,
|
||||||
},
|
},
|
||||||
Status: experimental.ScaleStatus{
|
Status: extensions.ScaleStatus{
|
||||||
Replicas: tc.initialReplicas,
|
Replicas: tc.initialReplicas,
|
||||||
Selector: map[string]string{"name": podNamePrefix},
|
Selector: map[string]string{"name": podNamePrefix},
|
||||||
},
|
},
|
||||||
@ -155,15 +155,15 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake {
|
|||||||
})
|
})
|
||||||
|
|
||||||
fakeClient.AddReactor("update", "replicationController", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
fakeClient.AddReactor("update", "replicationController", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
||||||
obj := action.(testclient.UpdateAction).GetObject().(*experimental.Scale)
|
obj := action.(testclient.UpdateAction).GetObject().(*extensions.Scale)
|
||||||
replicas := action.(testclient.UpdateAction).GetObject().(*experimental.Scale).Spec.Replicas
|
replicas := action.(testclient.UpdateAction).GetObject().(*extensions.Scale).Spec.Replicas
|
||||||
assert.Equal(t, tc.desiredReplicas, replicas)
|
assert.Equal(t, tc.desiredReplicas, replicas)
|
||||||
tc.scaleUpdated = true
|
tc.scaleUpdated = true
|
||||||
return true, obj, nil
|
return true, obj, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
fakeClient.AddReactor("update", "horizontalpodautoscalers", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
fakeClient.AddReactor("update", "horizontalpodautoscalers", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
||||||
obj := action.(testclient.UpdateAction).GetObject().(*experimental.HorizontalPodAutoscaler)
|
obj := action.(testclient.UpdateAction).GetObject().(*extensions.HorizontalPodAutoscaler)
|
||||||
assert.Equal(t, namespace, obj.Namespace)
|
assert.Equal(t, namespace, obj.Namespace)
|
||||||
assert.Equal(t, hpaName, obj.Name)
|
assert.Equal(t, hpaName, obj.Name)
|
||||||
assert.Equal(t, tc.desiredReplicas, obj.Status.DesiredReplicas)
|
assert.Equal(t, tc.desiredReplicas, obj.Status.DesiredReplicas)
|
||||||
|
@ -47,12 +47,12 @@ type MetricsClient interface {
|
|||||||
|
|
||||||
type ResourceConsumptionClient interface {
|
type ResourceConsumptionClient interface {
|
||||||
// Gets average resource consumption for pods under the given selector.
|
// Gets average resource consumption for pods under the given selector.
|
||||||
Get(resourceName api.ResourceName, selector map[string]string) (*experimental.ResourceConsumption, error)
|
Get(resourceName api.ResourceName, selector map[string]string) (*extensions.ResourceConsumption, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggregates results into ResourceConsumption. Also returns number of
|
// Aggregates results into ResourceConsumption. Also returns number of
|
||||||
// pods included in the aggregation.
|
// pods included in the aggregation.
|
||||||
type metricAggregator func(heapster.MetricResultList) (experimental.ResourceConsumption, int)
|
type metricAggregator func(heapster.MetricResultList) (extensions.ResourceConsumption, int)
|
||||||
|
|
||||||
type metricDefinition struct {
|
type metricDefinition struct {
|
||||||
name string
|
name string
|
||||||
@ -76,23 +76,23 @@ func NewHeapsterMetricsClient(client client.Interface) *HeapsterMetricsClient {
|
|||||||
|
|
||||||
var heapsterMetricDefinitions = map[api.ResourceName]metricDefinition{
|
var heapsterMetricDefinitions = map[api.ResourceName]metricDefinition{
|
||||||
api.ResourceCPU: {"cpu-usage",
|
api.ResourceCPU: {"cpu-usage",
|
||||||
func(metrics heapster.MetricResultList) (experimental.ResourceConsumption, int) {
|
func(metrics heapster.MetricResultList) (extensions.ResourceConsumption, int) {
|
||||||
sum, count := calculateSumFromLatestSample(metrics)
|
sum, count := calculateSumFromLatestSample(metrics)
|
||||||
value := "0"
|
value := "0"
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
// assumes that cpu usage is in millis
|
// assumes that cpu usage is in millis
|
||||||
value = fmt.Sprintf("%dm", sum/uint64(count))
|
value = fmt.Sprintf("%dm", sum/uint64(count))
|
||||||
}
|
}
|
||||||
return experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse(value)}, count
|
return extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse(value)}, count
|
||||||
}},
|
}},
|
||||||
api.ResourceMemory: {"memory-usage",
|
api.ResourceMemory: {"memory-usage",
|
||||||
func(metrics heapster.MetricResultList) (experimental.ResourceConsumption, int) {
|
func(metrics heapster.MetricResultList) (extensions.ResourceConsumption, int) {
|
||||||
sum, count := calculateSumFromLatestSample(metrics)
|
sum, count := calculateSumFromLatestSample(metrics)
|
||||||
value := int64(0)
|
value := int64(0)
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
value = int64(sum) / int64(count)
|
value = int64(sum) / int64(count)
|
||||||
}
|
}
|
||||||
return experimental.ResourceConsumption{Resource: api.ResourceMemory, Quantity: *resource.NewQuantity(value, resource.DecimalSI)}, count
|
return extensions.ResourceConsumption{Resource: api.ResourceMemory, Quantity: *resource.NewQuantity(value, resource.DecimalSI)}, count
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ func (h *HeapsterMetricsClient) ResourceConsumption(namespace string) ResourceCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HeapsterResourceConsumptionClient) Get(resourceName api.ResourceName, selector map[string]string) (*experimental.ResourceConsumption, error) {
|
func (h *HeapsterResourceConsumptionClient) Get(resourceName api.ResourceName, selector map[string]string) (*extensions.ResourceConsumption, error) {
|
||||||
podList, err := h.client.Pods(h.namespace).
|
podList, err := h.client.Pods(h.namespace).
|
||||||
List(labels.SelectorFromSet(labels.Set(selector)), fields.Everything())
|
List(labels.SelectorFromSet(labels.Set(selector)), fields.Everything())
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ func (h *HeapsterResourceConsumptionClient) Get(resourceName api.ResourceName, s
|
|||||||
return h.getForPods(resourceName, podNames)
|
return h.getForPods(resourceName, podNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HeapsterResourceConsumptionClient) getForPods(resourceName api.ResourceName, podNames []string) (*experimental.ResourceConsumption, error) {
|
func (h *HeapsterResourceConsumptionClient) getForPods(resourceName api.ResourceName, podNames []string) (*extensions.ResourceConsumption, error) {
|
||||||
metricSpec, metricDefined := h.resourceDefinitions[resourceName]
|
metricSpec, metricDefined := h.resourceDefinitions[resourceName]
|
||||||
if !metricDefined {
|
if !metricDefined {
|
||||||
return nil, fmt.Errorf("heapster metric not defined for %v", resourceName)
|
return nil, fmt.Errorf("heapster metric not defined for %v", resourceName)
|
||||||
|
@ -122,7 +122,7 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake {
|
|||||||
return fakeClient
|
return fakeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tc *testCase) verifyResults(t *testing.T, val *experimental.ResourceConsumption, err error) {
|
func (tc *testCase) verifyResults(t *testing.T, val *extensions.ResourceConsumption, err error) {
|
||||||
assert.Equal(t, tc.desiredError, err)
|
assert.Equal(t, tc.desiredError, err)
|
||||||
if tc.desiredError != nil {
|
if tc.desiredError != nil {
|
||||||
return
|
return
|
||||||
|
@ -880,7 +880,7 @@ func (d *JobDescriber) Describe(namespace, name string) (string, error) {
|
|||||||
return describeJob(job, events)
|
return describeJob(job, events)
|
||||||
}
|
}
|
||||||
|
|
||||||
func describeJob(job *experimental.Job, events *api.EventList) (string, error) {
|
func describeJob(job *extensions.Job, events *api.EventList) (string, error) {
|
||||||
return tabbedString(func(out io.Writer) error {
|
return tabbedString(func(out io.Writer) error {
|
||||||
fmt.Fprintf(out, "Name:\t%s\n", job.Name)
|
fmt.Fprintf(out, "Name:\t%s\n", job.Name)
|
||||||
fmt.Fprintf(out, "Namespace:\t%s\n", job.Namespace)
|
fmt.Fprintf(out, "Namespace:\t%s\n", job.Namespace)
|
||||||
@ -928,7 +928,7 @@ func (d *DaemonSetDescriber) Describe(namespace, name string) (string, error) {
|
|||||||
return describeDaemonSet(daemon, events, running, waiting, succeeded, failed)
|
return describeDaemonSet(daemon, events, running, waiting, succeeded, failed)
|
||||||
}
|
}
|
||||||
|
|
||||||
func describeDaemonSet(daemon *experimental.DaemonSet, events *api.EventList, running, waiting, succeeded, failed int) (string, error) {
|
func describeDaemonSet(daemon *extensions.DaemonSet, events *api.EventList, running, waiting, succeeded, failed int) (string, error) {
|
||||||
return tabbedString(func(out io.Writer) error {
|
return tabbedString(func(out io.Writer) error {
|
||||||
fmt.Fprintf(out, "Name:\t%s\n", daemon.Name)
|
fmt.Fprintf(out, "Name:\t%s\n", daemon.Name)
|
||||||
if daemon.Spec.Template != nil {
|
if daemon.Spec.Template != nil {
|
||||||
@ -1448,7 +1448,7 @@ func (dd *DeploymentDescriber) Describe(namespace, name string) (string, error)
|
|||||||
// of getting all DS's and searching through them manually).
|
// of getting all DS's and searching through them manually).
|
||||||
// TODO: write an interface for controllers and fuse getReplicationControllersForLabels
|
// TODO: write an interface for controllers and fuse getReplicationControllersForLabels
|
||||||
// and getDaemonSetsForLabels.
|
// and getDaemonSetsForLabels.
|
||||||
func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.Labels) ([]experimental.DaemonSet, error) {
|
func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.Labels) ([]extensions.DaemonSet, error) {
|
||||||
// Get all daemon sets
|
// Get all daemon sets
|
||||||
// TODO: this needs a namespace scope as argument
|
// TODO: this needs a namespace scope as argument
|
||||||
dss, err := c.List(labels.Everything())
|
dss, err := c.List(labels.Everything())
|
||||||
@ -1457,7 +1457,7 @@ func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.La
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the ones that match labelsToMatch.
|
// Find the ones that match labelsToMatch.
|
||||||
var matchingDaemonSets []experimental.DaemonSet
|
var matchingDaemonSets []extensions.DaemonSet
|
||||||
for _, ds := range dss.Items {
|
for _, ds := range dss.Items {
|
||||||
selector := labels.SelectorFromSet(ds.Spec.Selector)
|
selector := labels.SelectorFromSet(ds.Spec.Selector)
|
||||||
if selector.Matches(labelsToMatch) {
|
if selector.Matches(labelsToMatch) {
|
||||||
|
@ -481,12 +481,12 @@ func TestPersistentVolumeDescriber(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDescribeDeployment(t *testing.T) {
|
func TestDescribeDeployment(t *testing.T) {
|
||||||
fake := testclient.NewSimpleFake(&experimental.Deployment{
|
fake := testclient.NewSimpleFake(&extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
Namespace: "foo",
|
Namespace: "foo",
|
||||||
},
|
},
|
||||||
Spec: experimental.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: &api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -723,7 +723,7 @@ func printReplicationControllerList(list *api.ReplicationControllerList, w io.Wr
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printJob(job *experimental.Job, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printJob(job *extensions.Job, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
name := job.Name
|
name := job.Name
|
||||||
namespace := job.Namespace
|
namespace := job.Namespace
|
||||||
containers := job.Spec.Template.Spec.Containers
|
containers := job.Spec.Template.Spec.Containers
|
||||||
@ -766,7 +766,7 @@ func printJob(job *experimental.Job, w io.Writer, withNamespace bool, wide bool,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printJobList(list *experimental.JobList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printJobList(list *extensions.JobList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
for _, job := range list.Items {
|
for _, job := range list.Items {
|
||||||
if err := printJob(&job, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
if err := printJob(&job, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -857,14 +857,14 @@ func printServiceList(list *api.ServiceList, w io.Writer, withNamespace bool, wi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// backendStringer behaves just like a string interface and converts the given backend to a string.
|
// backendStringer behaves just like a string interface and converts the given backend to a string.
|
||||||
func backendStringer(backend *experimental.IngressBackend) string {
|
func backendStringer(backend *extensions.IngressBackend) string {
|
||||||
if backend == nil {
|
if backend == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%v:%v", backend.ServiceName, backend.ServicePort.String())
|
return fmt.Sprintf("%v:%v", backend.ServiceName, backend.ServicePort.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func printIngress(ingress *experimental.Ingress, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error {
|
func printIngress(ingress *extensions.Ingress, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error {
|
||||||
name := ingress.Name
|
name := ingress.Name
|
||||||
namespace := ingress.Namespace
|
namespace := ingress.Namespace
|
||||||
|
|
||||||
@ -912,7 +912,7 @@ func printIngress(ingress *experimental.Ingress, w io.Writer, withNamespace, wid
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printIngressList(ingressList *experimental.IngressList, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error {
|
func printIngressList(ingressList *extensions.IngressList, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error {
|
||||||
for _, ingress := range ingressList.Items {
|
for _, ingress := range ingressList.Items {
|
||||||
if err := printIngress(&ingress, w, withNamespace, wide, true, columnLabels); err != nil {
|
if err := printIngress(&ingress, w, withNamespace, wide, true, columnLabels); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -921,7 +921,7 @@ func printIngressList(ingressList *experimental.IngressList, w io.Writer, withNa
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printDaemonSet(ds *experimental.DaemonSet, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printDaemonSet(ds *extensions.DaemonSet, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
name := ds.Name
|
name := ds.Name
|
||||||
namespace := ds.Namespace
|
namespace := ds.Namespace
|
||||||
|
|
||||||
@ -966,7 +966,7 @@ func printDaemonSet(ds *experimental.DaemonSet, w io.Writer, withNamespace bool,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printDaemonSetList(list *experimental.DaemonSetList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printDaemonSetList(list *extensions.DaemonSetList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
for _, ds := range list.Items {
|
for _, ds := range list.Items {
|
||||||
if err := printDaemonSet(&ds, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
if err := printDaemonSet(&ds, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1330,7 +1330,7 @@ func printComponentStatusList(list *api.ComponentStatusList, w io.Writer, withNa
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printThirdPartyResource(rsrc *experimental.ThirdPartyResource, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printThirdPartyResource(rsrc *extensions.ThirdPartyResource, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
versions := make([]string, len(rsrc.Versions))
|
versions := make([]string, len(rsrc.Versions))
|
||||||
for ix := range rsrc.Versions {
|
for ix := range rsrc.Versions {
|
||||||
version := &rsrc.Versions[ix]
|
version := &rsrc.Versions[ix]
|
||||||
@ -1343,7 +1343,7 @@ func printThirdPartyResource(rsrc *experimental.ThirdPartyResource, w io.Writer,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printThirdPartyResourceList(list *experimental.ThirdPartyResourceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printThirdPartyResourceList(list *extensions.ThirdPartyResourceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
for _, item := range list.Items {
|
for _, item := range list.Items {
|
||||||
if err := printThirdPartyResource(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
if err := printThirdPartyResource(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1353,7 +1353,7 @@ func printThirdPartyResourceList(list *experimental.ThirdPartyResourceList, w io
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printDeployment(deployment *experimental.Deployment, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printDeployment(deployment *extensions.Deployment, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
if withNamespace {
|
if withNamespace {
|
||||||
if _, err := fmt.Fprintf(w, "%s\t", deployment.Namespace); err != nil {
|
if _, err := fmt.Fprintf(w, "%s\t", deployment.Namespace); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1369,7 +1369,7 @@ func printDeployment(deployment *experimental.Deployment, w io.Writer, withNames
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func printDeploymentList(list *experimental.DeploymentList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printDeploymentList(list *extensions.DeploymentList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
for _, item := range list.Items {
|
for _, item := range list.Items {
|
||||||
if err := printDeployment(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
if err := printDeployment(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1378,7 +1378,7 @@ func printDeploymentList(list *experimental.DeploymentList, w io.Writer, withNam
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printHorizontalPodAutoscaler(hpa *experimental.HorizontalPodAutoscaler, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printHorizontalPodAutoscaler(hpa *extensions.HorizontalPodAutoscaler, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
namespace := hpa.Namespace
|
namespace := hpa.Namespace
|
||||||
name := hpa.Name
|
name := hpa.Name
|
||||||
reference := fmt.Sprintf("%s/%s/%s/%s",
|
reference := fmt.Sprintf("%s/%s/%s/%s",
|
||||||
@ -1415,7 +1415,7 @@ func printHorizontalPodAutoscaler(hpa *experimental.HorizontalPodAutoscaler, w i
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func printHorizontalPodAutoscalerList(list *experimental.HorizontalPodAutoscalerList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
func printHorizontalPodAutoscalerList(list *extensions.HorizontalPodAutoscalerList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||||
for i := range list.Items {
|
for i := range list.Items {
|
||||||
if err := printHorizontalPodAutoscaler(&list.Items[i], w, withNamespace, wide, showAll, columnLabels); err != nil {
|
if err := printHorizontalPodAutoscaler(&list.Items[i], w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1236,22 +1236,22 @@ func TestTranslateTimestamp(t *testing.T) {
|
|||||||
|
|
||||||
func TestPrintDeployment(t *testing.T) {
|
func TestPrintDeployment(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
deployment experimental.Deployment
|
deployment extensions.Deployment
|
||||||
expect string
|
expect string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
experimental.Deployment{
|
extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "test1",
|
Name: "test1",
|
||||||
CreationTimestamp: unversioned.Time{Time: time.Now().Add(1.9e9)},
|
CreationTimestamp: unversioned.Time{Time: time.Now().Add(1.9e9)},
|
||||||
},
|
},
|
||||||
Spec: experimental.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Replicas: 5,
|
Replicas: 5,
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{Containers: make([]api.Container, 2)},
|
Spec: api.PodSpec{Containers: make([]api.Container, 2)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Status: experimental.DeploymentStatus{
|
Status: extensions.DeploymentStatus{
|
||||||
Replicas: 10,
|
Replicas: 10,
|
||||||
UpdatedReplicas: 2,
|
UpdatedReplicas: 2,
|
||||||
},
|
},
|
||||||
|
@ -83,7 +83,7 @@ func (precondition *ScalePrecondition) ValidateReplicationController(controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateJob ensures that the preconditions match. Returns nil if they are valid, an error otherwise
|
// ValidateJob ensures that the preconditions match. Returns nil if they are valid, an error otherwise
|
||||||
func (precondition *ScalePrecondition) ValidateJob(job *experimental.Job) error {
|
func (precondition *ScalePrecondition) ValidateJob(job *extensions.Job) error {
|
||||||
if precondition.Size != -1 && job.Spec.Parallelism == nil {
|
if precondition.Size != -1 && job.Spec.Parallelism == nil {
|
||||||
return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), "nil"}
|
return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), "nil"}
|
||||||
}
|
}
|
||||||
|
@ -53,17 +53,17 @@ type ErrorJobs struct {
|
|||||||
invalid bool
|
invalid bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ErrorJobs) Update(job *experimental.Job) (*experimental.Job, error) {
|
func (c *ErrorJobs) Update(job *extensions.Job) (*extensions.Job, error) {
|
||||||
if c.invalid {
|
if c.invalid {
|
||||||
return nil, kerrors.NewInvalid(job.Kind, job.Name, nil)
|
return nil, kerrors.NewInvalid(job.Kind, job.Name, nil)
|
||||||
}
|
}
|
||||||
return nil, errors.New("Job update failure")
|
return nil, errors.New("Job update failure")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ErrorJobs) Get(name string) (*experimental.Job, error) {
|
func (c *ErrorJobs) Get(name string) (*extensions.Job, error) {
|
||||||
zero := 0
|
zero := 0
|
||||||
return &experimental.Job{
|
return &extensions.Job{
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &zero,
|
Parallelism: &zero,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@ -325,7 +325,7 @@ func TestJobScale(t *testing.T) {
|
|||||||
if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "jobs" || action.GetName() != name {
|
if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "jobs" || action.GetName() != name {
|
||||||
t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name)
|
t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name)
|
||||||
}
|
}
|
||||||
if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "jobs" || *action.GetObject().(*experimental.Job).Spec.Parallelism != int(count) {
|
if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "jobs" || *action.GetObject().(*extensions.Job).Spec.Parallelism != int(count) {
|
||||||
t.Errorf("unexpected action %v, expected update-job with parallelism = %d", actions[1], count)
|
t.Errorf("unexpected action %v, expected update-job with parallelism = %d", actions[1], count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,8 +351,8 @@ func TestJobScaleInvalid(t *testing.T) {
|
|||||||
|
|
||||||
func TestJobScaleFailsPreconditions(t *testing.T) {
|
func TestJobScaleFailsPreconditions(t *testing.T) {
|
||||||
ten := 10
|
ten := 10
|
||||||
fake := testclient.NewSimpleFake(&experimental.Job{
|
fake := testclient.NewSimpleFake(&extensions.Job{
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &ten,
|
Parallelism: &ten,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -375,7 +375,7 @@ func TestValidateJob(t *testing.T) {
|
|||||||
zero, ten, twenty := 0, 10, 20
|
zero, ten, twenty := 0, 10, 20
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
preconditions ScalePrecondition
|
preconditions ScalePrecondition
|
||||||
job experimental.Job
|
job extensions.Job
|
||||||
expectError bool
|
expectError bool
|
||||||
test string
|
test string
|
||||||
}{
|
}{
|
||||||
@ -386,11 +386,11 @@ func TestValidateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
preconditions: ScalePrecondition{-1, ""},
|
preconditions: ScalePrecondition{-1, ""},
|
||||||
job: experimental.Job{
|
job: extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
ResourceVersion: "foo",
|
ResourceVersion: "foo",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &ten,
|
Parallelism: &ten,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -399,11 +399,11 @@ func TestValidateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
preconditions: ScalePrecondition{0, ""},
|
preconditions: ScalePrecondition{0, ""},
|
||||||
job: experimental.Job{
|
job: extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
ResourceVersion: "foo",
|
ResourceVersion: "foo",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &zero,
|
Parallelism: &zero,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -412,11 +412,11 @@ func TestValidateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
preconditions: ScalePrecondition{-1, "foo"},
|
preconditions: ScalePrecondition{-1, "foo"},
|
||||||
job: experimental.Job{
|
job: extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
ResourceVersion: "foo",
|
ResourceVersion: "foo",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &ten,
|
Parallelism: &ten,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -425,11 +425,11 @@ func TestValidateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
preconditions: ScalePrecondition{10, "foo"},
|
preconditions: ScalePrecondition{10, "foo"},
|
||||||
job: experimental.Job{
|
job: extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
ResourceVersion: "foo",
|
ResourceVersion: "foo",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &ten,
|
Parallelism: &ten,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -438,11 +438,11 @@ func TestValidateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
preconditions: ScalePrecondition{10, "foo"},
|
preconditions: ScalePrecondition{10, "foo"},
|
||||||
job: experimental.Job{
|
job: extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
ResourceVersion: "foo",
|
ResourceVersion: "foo",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &twenty,
|
Parallelism: &twenty,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -451,7 +451,7 @@ func TestValidateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
preconditions: ScalePrecondition{10, "foo"},
|
preconditions: ScalePrecondition{10, "foo"},
|
||||||
job: experimental.Job{
|
job: extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
ResourceVersion: "foo",
|
ResourceVersion: "foo",
|
||||||
},
|
},
|
||||||
@ -461,11 +461,11 @@ func TestValidateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
preconditions: ScalePrecondition{10, "foo"},
|
preconditions: ScalePrecondition{10, "foo"},
|
||||||
job: experimental.Job{
|
job: extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
ResourceVersion: "bar",
|
ResourceVersion: "bar",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &ten,
|
Parallelism: &ten,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -474,11 +474,11 @@ func TestValidateJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
preconditions: ScalePrecondition{10, "foo"},
|
preconditions: ScalePrecondition{10, "foo"},
|
||||||
job: experimental.Job{
|
job: extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
ResourceVersion: "bar",
|
ResourceVersion: "bar",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &twenty,
|
Parallelism: &twenty,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -286,23 +286,23 @@ func TestJobStop(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Name: "OnlyOneJob",
|
Name: "OnlyOneJob",
|
||||||
Objs: []runtime.Object{
|
Objs: []runtime.Object{
|
||||||
&experimental.Job{ // GET
|
&extensions.Job{ // GET
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &zero,
|
Parallelism: &zero,
|
||||||
Selector: map[string]string{"k1": "v1"}},
|
Selector: map[string]string{"k1": "v1"}},
|
||||||
},
|
},
|
||||||
&experimental.JobList{ // LIST
|
&extensions.JobList{ // LIST
|
||||||
Items: []experimental.Job{
|
Items: []extensions.Job{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: &zero,
|
Parallelism: &zero,
|
||||||
Selector: map[string]string{"k1": "v1"}},
|
Selector: map[string]string{"k1": "v1"}},
|
||||||
},
|
},
|
||||||
|
@ -507,11 +507,11 @@ type FooList struct {
|
|||||||
func initThirdParty(t *testing.T, version string) (*Master, *tools.FakeEtcdClient, *httptest.Server, *assert.Assertions) {
|
func initThirdParty(t *testing.T, version string) (*Master, *tools.FakeEtcdClient, *httptest.Server, *assert.Assertions) {
|
||||||
master, _, assert := setUp(t)
|
master, _, assert := setUp(t)
|
||||||
master.thirdPartyResources = map[string]*thirdpartyresourcedatastorage.REST{}
|
master.thirdPartyResources = map[string]*thirdpartyresourcedatastorage.REST{}
|
||||||
api := &experimental.ThirdPartyResource{
|
api := &extensions.ThirdPartyResource{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo.company.com",
|
Name: "foo.company.com",
|
||||||
},
|
},
|
||||||
Versions: []experimental.APIVersion{
|
Versions: []extensions.APIVersion{
|
||||||
{
|
{
|
||||||
APIGroup: "group",
|
APIGroup: "group",
|
||||||
Name: version,
|
Name: version,
|
||||||
@ -630,7 +630,7 @@ func encodeToThirdParty(name string, obj interface{}) ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
thirdPartyData := experimental.ThirdPartyResourceData{
|
thirdPartyData := extensions.ThirdPartyResourceData{
|
||||||
ObjectMeta: api.ObjectMeta{Name: name},
|
ObjectMeta: api.ObjectMeta{Name: name},
|
||||||
Data: serial,
|
Data: serial,
|
||||||
}
|
}
|
||||||
@ -778,7 +778,7 @@ func testInstallThirdPartyAPIPostForVersion(t *testing.T, version string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
thirdPartyObj, ok := obj.(*experimental.ThirdPartyResourceData)
|
thirdPartyObj, ok := obj.(*extensions.ThirdPartyResourceData)
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Errorf("unexpected object: %v", obj)
|
t.Errorf("unexpected object: %v", obj)
|
||||||
}
|
}
|
||||||
|
@ -39,10 +39,10 @@ var daemonPrefix = "/daemonsets"
|
|||||||
// NewREST returns a RESTStorage object that will work against DaemonSets.
|
// NewREST returns a RESTStorage object that will work against DaemonSets.
|
||||||
func NewREST(s storage.Interface) (*REST, *StatusREST) {
|
func NewREST(s storage.Interface) (*REST, *StatusREST) {
|
||||||
store := &etcdgeneric.Etcd{
|
store := &etcdgeneric.Etcd{
|
||||||
NewFunc: func() runtime.Object { return &experimental.DaemonSet{} },
|
NewFunc: func() runtime.Object { return &extensions.DaemonSet{} },
|
||||||
|
|
||||||
// NewListFunc returns an object capable of storing results of an etcd list.
|
// NewListFunc returns an object capable of storing results of an etcd list.
|
||||||
NewListFunc: func() runtime.Object { return &experimental.DaemonSetList{} },
|
NewListFunc: func() runtime.Object { return &extensions.DaemonSetList{} },
|
||||||
// Produces a path that etcd understands, to the root of the resource
|
// Produces a path that etcd understands, to the root of the resource
|
||||||
// by combining the namespace in the context with the given prefix
|
// by combining the namespace in the context with the given prefix
|
||||||
KeyRootFunc: func(ctx api.Context) string {
|
KeyRootFunc: func(ctx api.Context) string {
|
||||||
@ -55,7 +55,7 @@ func NewREST(s storage.Interface) (*REST, *StatusREST) {
|
|||||||
},
|
},
|
||||||
// Retrieve the name field of a daemon set
|
// Retrieve the name field of a daemon set
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||||
return obj.(*experimental.DaemonSet).Name, nil
|
return obj.(*extensions.DaemonSet).Name, nil
|
||||||
},
|
},
|
||||||
// Used to match objects based on labels/fields for list and watch
|
// Used to match objects based on labels/fields for list and watch
|
||||||
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
@ -83,7 +83,7 @@ type StatusREST struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *StatusREST) New() runtime.Object {
|
func (r *StatusREST) New() runtime.Object {
|
||||||
return &experimental.DaemonSet{}
|
return &extensions.DaemonSet{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update alters the status subset of an object.
|
// Update alters the status subset of an object.
|
||||||
|
@ -34,13 +34,13 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient) {
|
|||||||
return storage, statusStorage, fakeClient
|
return storage, statusStorage, fakeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func newValidDaemonSet() *experimental.DaemonSet {
|
func newValidDaemonSet() *extensions.DaemonSet {
|
||||||
return &experimental.DaemonSet{
|
return &extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: map[string]string{"a": "b"},
|
Selector: map[string]string{"a": "b"},
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -73,8 +73,8 @@ func TestCreate(t *testing.T) {
|
|||||||
// valid
|
// valid
|
||||||
ds,
|
ds,
|
||||||
// invalid (invalid selector)
|
// invalid (invalid selector)
|
||||||
&experimental.DaemonSet{
|
&extensions.DaemonSet{
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: map[string]string{},
|
Selector: map[string]string{},
|
||||||
Template: validDaemonSet.Spec.Template,
|
Template: validDaemonSet.Spec.Template,
|
||||||
},
|
},
|
||||||
@ -90,28 +90,28 @@ func TestUpdate(t *testing.T) {
|
|||||||
newValidDaemonSet(),
|
newValidDaemonSet(),
|
||||||
// updateFunc
|
// updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.DaemonSet)
|
object := obj.(*extensions.DaemonSet)
|
||||||
object.Spec.Template.Spec.NodeSelector = map[string]string{"c": "d"}
|
object.Spec.Template.Spec.NodeSelector = map[string]string{"c": "d"}
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
// invalid updateFunc
|
// invalid updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.DaemonSet)
|
object := obj.(*extensions.DaemonSet)
|
||||||
object.UID = "newUID"
|
object.UID = "newUID"
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.DaemonSet)
|
object := obj.(*extensions.DaemonSet)
|
||||||
object.Name = ""
|
object.Name = ""
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.DaemonSet)
|
object := obj.(*extensions.DaemonSet)
|
||||||
object.Spec.Template.Spec.RestartPolicy = api.RestartPolicyOnFailure
|
object.Spec.Template.Spec.RestartPolicy = api.RestartPolicyOnFailure
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.DaemonSet)
|
object := obj.(*extensions.DaemonSet)
|
||||||
object.Spec.Selector = map[string]string{}
|
object.Spec.Selector = map[string]string{}
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
|
@ -46,16 +46,16 @@ func (daemonSetStrategy) NamespaceScoped() bool {
|
|||||||
|
|
||||||
// PrepareForCreate clears the status of a daemon set before creation.
|
// PrepareForCreate clears the status of a daemon set before creation.
|
||||||
func (daemonSetStrategy) PrepareForCreate(obj runtime.Object) {
|
func (daemonSetStrategy) PrepareForCreate(obj runtime.Object) {
|
||||||
daemonSet := obj.(*experimental.DaemonSet)
|
daemonSet := obj.(*extensions.DaemonSet)
|
||||||
daemonSet.Status = experimental.DaemonSetStatus{}
|
daemonSet.Status = extensions.DaemonSetStatus{}
|
||||||
|
|
||||||
daemonSet.Generation = 1
|
daemonSet.Generation = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||||
func (daemonSetStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
func (daemonSetStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
||||||
newDaemonSet := obj.(*experimental.DaemonSet)
|
newDaemonSet := obj.(*extensions.DaemonSet)
|
||||||
oldDaemonSet := old.(*experimental.DaemonSet)
|
oldDaemonSet := old.(*extensions.DaemonSet)
|
||||||
|
|
||||||
// update is not allowed to set status
|
// update is not allowed to set status
|
||||||
newDaemonSet.Status = oldDaemonSet.Status
|
newDaemonSet.Status = oldDaemonSet.Status
|
||||||
@ -78,7 +78,7 @@ func (daemonSetStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
|||||||
|
|
||||||
// Validate validates a new daemon set.
|
// Validate validates a new daemon set.
|
||||||
func (daemonSetStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
func (daemonSetStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
||||||
daemonSet := obj.(*experimental.DaemonSet)
|
daemonSet := obj.(*extensions.DaemonSet)
|
||||||
return validation.ValidateDaemonSet(daemonSet)
|
return validation.ValidateDaemonSet(daemonSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,8 +90,8 @@ func (daemonSetStrategy) AllowCreateOnUpdate() bool {
|
|||||||
|
|
||||||
// ValidateUpdate is the default update validation for an end user.
|
// ValidateUpdate is the default update validation for an end user.
|
||||||
func (daemonSetStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
func (daemonSetStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
||||||
validationErrorList := validation.ValidateDaemonSet(obj.(*experimental.DaemonSet))
|
validationErrorList := validation.ValidateDaemonSet(obj.(*extensions.DaemonSet))
|
||||||
updateErrorList := validation.ValidateDaemonSetUpdate(old.(*experimental.DaemonSet), obj.(*experimental.DaemonSet))
|
updateErrorList := validation.ValidateDaemonSetUpdate(old.(*extensions.DaemonSet), obj.(*extensions.DaemonSet))
|
||||||
return append(validationErrorList, updateErrorList...)
|
return append(validationErrorList, updateErrorList...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ func (daemonSetStrategy) AllowUnconditionalUpdate() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DaemonSetToSelectableFields returns a field set that represents the object.
|
// DaemonSetToSelectableFields returns a field set that represents the object.
|
||||||
func DaemonSetToSelectableFields(daemon *experimental.DaemonSet) fields.Set {
|
func DaemonSetToSelectableFields(daemon *extensions.DaemonSet) fields.Set {
|
||||||
return fields.Set{
|
return fields.Set{
|
||||||
"metadata.name": daemon.Name,
|
"metadata.name": daemon.Name,
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ func MatchDaemonSet(label labels.Selector, field fields.Selector) generic.Matche
|
|||||||
Label: label,
|
Label: label,
|
||||||
Field: field,
|
Field: field,
|
||||||
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
||||||
ds, ok := obj.(*experimental.DaemonSet)
|
ds, ok := obj.(*extensions.DaemonSet)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, fmt.Errorf("given object is not a ds.")
|
return nil, nil, fmt.Errorf("given object is not a ds.")
|
||||||
}
|
}
|
||||||
@ -131,11 +131,11 @@ type daemonSetStatusStrategy struct {
|
|||||||
var StatusStrategy = daemonSetStatusStrategy{Strategy}
|
var StatusStrategy = daemonSetStatusStrategy{Strategy}
|
||||||
|
|
||||||
func (daemonSetStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
func (daemonSetStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
||||||
newDaemonSet := obj.(*experimental.DaemonSet)
|
newDaemonSet := obj.(*extensions.DaemonSet)
|
||||||
oldDaemonSet := old.(*experimental.DaemonSet)
|
oldDaemonSet := old.(*extensions.DaemonSet)
|
||||||
newDaemonSet.Spec = oldDaemonSet.Spec
|
newDaemonSet.Spec = oldDaemonSet.Spec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (daemonSetStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
func (daemonSetStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
||||||
return validation.ValidateDaemonSetStatusUpdate(obj.(*experimental.DaemonSet), old.(*experimental.DaemonSet))
|
return validation.ValidateDaemonSetStatusUpdate(obj.(*extensions.DaemonSet), old.(*extensions.DaemonSet))
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,9 @@ type REST struct {
|
|||||||
func NewREST(s storage.Interface) *REST {
|
func NewREST(s storage.Interface) *REST {
|
||||||
prefix := "/deployments"
|
prefix := "/deployments"
|
||||||
store := &etcdgeneric.Etcd{
|
store := &etcdgeneric.Etcd{
|
||||||
NewFunc: func() runtime.Object { return &experimental.Deployment{} },
|
NewFunc: func() runtime.Object { return &extensions.Deployment{} },
|
||||||
// NewListFunc returns an object capable of storing results of an etcd list.
|
// NewListFunc returns an object capable of storing results of an etcd list.
|
||||||
NewListFunc: func() runtime.Object { return &experimental.DeploymentList{} },
|
NewListFunc: func() runtime.Object { return &extensions.DeploymentList{} },
|
||||||
// Produces a path that etcd understands, to the root of the resource
|
// Produces a path that etcd understands, to the root of the resource
|
||||||
// by combining the namespace in the context with the given prefix.
|
// by combining the namespace in the context with the given prefix.
|
||||||
KeyRootFunc: func(ctx api.Context) string {
|
KeyRootFunc: func(ctx api.Context) string {
|
||||||
@ -71,7 +71,7 @@ func NewREST(s storage.Interface) *REST {
|
|||||||
},
|
},
|
||||||
// Retrieve the name field of a deployment.
|
// Retrieve the name field of a deployment.
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||||
return obj.(*experimental.Deployment).Name, nil
|
return obj.(*extensions.Deployment).Name, nil
|
||||||
},
|
},
|
||||||
// Used to match objects based on labels/fields for list.
|
// Used to match objects based on labels/fields for list.
|
||||||
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
@ -99,7 +99,7 @@ var _ = rest.Patcher(&ScaleREST{})
|
|||||||
|
|
||||||
// New creates a new Scale object
|
// New creates a new Scale object
|
||||||
func (r *ScaleREST) New() runtime.Object {
|
func (r *ScaleREST) New() runtime.Object {
|
||||||
return &experimental.Scale{}
|
return &extensions.Scale{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ScaleREST) Get(ctx api.Context, name string) (runtime.Object, error) {
|
func (r *ScaleREST) Get(ctx api.Context, name string) (runtime.Object, error) {
|
||||||
@ -107,16 +107,16 @@ func (r *ScaleREST) Get(ctx api.Context, name string) (runtime.Object, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.NewNotFound("scale", name)
|
return nil, errors.NewNotFound("scale", name)
|
||||||
}
|
}
|
||||||
return &experimental.Scale{
|
return &extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: deployment.Namespace,
|
Namespace: deployment.Namespace,
|
||||||
CreationTimestamp: deployment.CreationTimestamp,
|
CreationTimestamp: deployment.CreationTimestamp,
|
||||||
},
|
},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: deployment.Spec.Replicas,
|
Replicas: deployment.Spec.Replicas,
|
||||||
},
|
},
|
||||||
Status: experimental.ScaleStatus{
|
Status: extensions.ScaleStatus{
|
||||||
Replicas: deployment.Status.Replicas,
|
Replicas: deployment.Status.Replicas,
|
||||||
Selector: deployment.Spec.Selector,
|
Selector: deployment.Spec.Selector,
|
||||||
},
|
},
|
||||||
@ -127,7 +127,7 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
|
|||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
|
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
|
||||||
}
|
}
|
||||||
scale, ok := obj.(*experimental.Scale)
|
scale, ok := obj.(*extensions.Scale)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("wrong object passed to Scale update: %v", obj))
|
return nil, false, errors.NewBadRequest(fmt.Sprintf("wrong object passed to Scale update: %v", obj))
|
||||||
}
|
}
|
||||||
@ -140,16 +140,16 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, errors.NewConflict("scale", scale.Name, err)
|
return nil, false, errors.NewConflict("scale", scale.Name, err)
|
||||||
}
|
}
|
||||||
return &experimental.Scale{
|
return &extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: deployment.Name,
|
Name: deployment.Name,
|
||||||
Namespace: deployment.Namespace,
|
Namespace: deployment.Namespace,
|
||||||
CreationTimestamp: deployment.CreationTimestamp,
|
CreationTimestamp: deployment.CreationTimestamp,
|
||||||
},
|
},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: deployment.Spec.Replicas,
|
Replicas: deployment.Spec.Replicas,
|
||||||
},
|
},
|
||||||
Status: experimental.ScaleStatus{
|
Status: extensions.ScaleStatus{
|
||||||
Replicas: deployment.Status.Replicas,
|
Replicas: deployment.Status.Replicas,
|
||||||
Selector: deployment.Spec.Selector,
|
Selector: deployment.Spec.Selector,
|
||||||
},
|
},
|
||||||
|
@ -40,13 +40,13 @@ func newStorage(t *testing.T) (*DeploymentStorage, *tools.FakeEtcdClient) {
|
|||||||
var namespace = "foo-namespace"
|
var namespace = "foo-namespace"
|
||||||
var name = "foo-deployment"
|
var name = "foo-deployment"
|
||||||
|
|
||||||
func validNewDeployment() *experimental.Deployment {
|
func validNewDeployment() *extensions.Deployment {
|
||||||
return &experimental.Deployment{
|
return &extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
},
|
},
|
||||||
Spec: experimental.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Selector: map[string]string{"a": "b"},
|
Selector: map[string]string{"a": "b"},
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -67,7 +67,7 @@ func validNewDeployment() *experimental.Deployment {
|
|||||||
UniqueLabelKey: "my-label",
|
UniqueLabelKey: "my-label",
|
||||||
Replicas: 7,
|
Replicas: 7,
|
||||||
},
|
},
|
||||||
Status: experimental.DeploymentStatus{
|
Status: extensions.DeploymentStatus{
|
||||||
Replicas: 5,
|
Replicas: 5,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -75,13 +75,13 @@ func validNewDeployment() *experimental.Deployment {
|
|||||||
|
|
||||||
var validDeployment = *validNewDeployment()
|
var validDeployment = *validNewDeployment()
|
||||||
|
|
||||||
func validNewScale() *experimental.Scale {
|
func validNewScale() *extensions.Scale {
|
||||||
return &experimental.Scale{
|
return &extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace},
|
ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: validDeployment.Spec.Replicas,
|
Replicas: validDeployment.Spec.Replicas,
|
||||||
},
|
},
|
||||||
Status: experimental.ScaleStatus{
|
Status: extensions.ScaleStatus{
|
||||||
Replicas: validDeployment.Status.Replicas,
|
Replicas: validDeployment.Status.Replicas,
|
||||||
Selector: validDeployment.Spec.Template.Labels,
|
Selector: validDeployment.Spec.Template.Labels,
|
||||||
},
|
},
|
||||||
@ -99,8 +99,8 @@ func TestCreate(t *testing.T) {
|
|||||||
// valid
|
// valid
|
||||||
deployment,
|
deployment,
|
||||||
// invalid (invalid selector)
|
// invalid (invalid selector)
|
||||||
&experimental.Deployment{
|
&extensions.Deployment{
|
||||||
Spec: experimental.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Selector: map[string]string{},
|
Selector: map[string]string{},
|
||||||
Template: validDeployment.Spec.Template,
|
Template: validDeployment.Spec.Template,
|
||||||
},
|
},
|
||||||
@ -116,28 +116,28 @@ func TestUpdate(t *testing.T) {
|
|||||||
validNewDeployment(),
|
validNewDeployment(),
|
||||||
// updateFunc
|
// updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Deployment)
|
object := obj.(*extensions.Deployment)
|
||||||
object.Spec.Template.Spec.NodeSelector = map[string]string{"c": "d"}
|
object.Spec.Template.Spec.NodeSelector = map[string]string{"c": "d"}
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
// invalid updateFunc
|
// invalid updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Deployment)
|
object := obj.(*extensions.Deployment)
|
||||||
object.UID = "newUID"
|
object.UID = "newUID"
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Deployment)
|
object := obj.(*extensions.Deployment)
|
||||||
object.Name = ""
|
object.Name = ""
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Deployment)
|
object := obj.(*extensions.Deployment)
|
||||||
object.Spec.Template.Spec.RestartPolicy = api.RestartPolicyOnFailure
|
object.Spec.Template.Spec.RestartPolicy = api.RestartPolicyOnFailure
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Deployment)
|
object := obj.(*extensions.Deployment)
|
||||||
object.Spec.Selector = map[string]string{}
|
object.Spec.Selector = map[string]string{}
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
@ -197,7 +197,7 @@ func TestScaleGet(t *testing.T) {
|
|||||||
|
|
||||||
expect := &validScale
|
expect := &validScale
|
||||||
obj, err := storage.Scale.Get(ctx, name)
|
obj, err := storage.Scale.Get(ctx, name)
|
||||||
scale := obj.(*experimental.Scale)
|
scale := obj.(*extensions.Scale)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@ -215,9 +215,9 @@ func TestScaleUpdate(t *testing.T) {
|
|||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
replicas := 12
|
replicas := 12
|
||||||
update := experimental.Scale{
|
update := extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace},
|
ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: replicas,
|
Replicas: replicas,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ func TestScaleUpdate(t *testing.T) {
|
|||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var deployment experimental.Deployment
|
var deployment extensions.Deployment
|
||||||
testapi.Extensions.Codec().DecodeInto([]byte(response.Node.Value), &deployment)
|
testapi.Extensions.Codec().DecodeInto([]byte(response.Node.Value), &deployment)
|
||||||
if deployment.Spec.Replicas != replicas {
|
if deployment.Spec.Replicas != replicas {
|
||||||
t.Errorf("wrong replicas count expected: %d got: %d", replicas, deployment.Spec.Replicas)
|
t.Errorf("wrong replicas count expected: %d got: %d", replicas, deployment.Spec.Replicas)
|
||||||
|
@ -28,10 +28,10 @@ import (
|
|||||||
|
|
||||||
// Registry is an interface for things that know how to store Deployments.
|
// Registry is an interface for things that know how to store Deployments.
|
||||||
type Registry interface {
|
type Registry interface {
|
||||||
ListDeployments(ctx api.Context, label labels.Selector, field fields.Selector) (*experimental.DeploymentList, error)
|
ListDeployments(ctx api.Context, label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error)
|
||||||
GetDeployment(ctx api.Context, deploymentID string) (*experimental.Deployment, error)
|
GetDeployment(ctx api.Context, deploymentID string) (*extensions.Deployment, error)
|
||||||
CreateDeployment(ctx api.Context, deployment *experimental.Deployment) (*experimental.Deployment, error)
|
CreateDeployment(ctx api.Context, deployment *extensions.Deployment) (*extensions.Deployment, error)
|
||||||
UpdateDeployment(ctx api.Context, deployment *experimental.Deployment) (*experimental.Deployment, error)
|
UpdateDeployment(ctx api.Context, deployment *extensions.Deployment) (*extensions.Deployment, error)
|
||||||
DeleteDeployment(ctx api.Context, deploymentID string) error
|
DeleteDeployment(ctx api.Context, deploymentID string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List obtains a list of Deployments that match selector.
|
// List obtains a list of Deployments that match selector.
|
||||||
func (s *storage) ListDeployments(ctx api.Context, label labels.Selector, field fields.Selector) (*experimental.DeploymentList, error) {
|
func (s *storage) ListDeployments(ctx api.Context, label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error) {
|
||||||
if !field.Empty() {
|
if !field.Empty() {
|
||||||
return nil, fmt.Errorf("field selector not supported yet")
|
return nil, fmt.Errorf("field selector not supported yet")
|
||||||
}
|
}
|
||||||
@ -54,31 +54,31 @@ func (s *storage) ListDeployments(ctx api.Context, label labels.Selector, field
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.DeploymentList), err
|
return obj.(*extensions.DeploymentList), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) GetDeployment(ctx api.Context, deploymentID string) (*experimental.Deployment, error) {
|
func (s *storage) GetDeployment(ctx api.Context, deploymentID string) (*extensions.Deployment, error) {
|
||||||
obj, err := s.Get(ctx, deploymentID)
|
obj, err := s.Get(ctx, deploymentID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.Deployment), nil
|
return obj.(*extensions.Deployment), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) CreateDeployment(ctx api.Context, deployment *experimental.Deployment) (*experimental.Deployment, error) {
|
func (s *storage) CreateDeployment(ctx api.Context, deployment *extensions.Deployment) (*extensions.Deployment, error) {
|
||||||
obj, err := s.Create(ctx, deployment)
|
obj, err := s.Create(ctx, deployment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.Deployment), nil
|
return obj.(*extensions.Deployment), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) UpdateDeployment(ctx api.Context, deployment *experimental.Deployment) (*experimental.Deployment, error) {
|
func (s *storage) UpdateDeployment(ctx api.Context, deployment *extensions.Deployment) (*extensions.Deployment, error) {
|
||||||
obj, _, err := s.Update(ctx, deployment)
|
obj, _, err := s.Update(ctx, deployment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.Deployment), nil
|
return obj.(*extensions.Deployment), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) DeleteDeployment(ctx api.Context, deploymentID string) error {
|
func (s *storage) DeleteDeployment(ctx api.Context, deploymentID string) error {
|
||||||
|
@ -50,7 +50,7 @@ func (deploymentStrategy) PrepareForCreate(obj runtime.Object) {
|
|||||||
|
|
||||||
// Validate validates a new deployment.
|
// Validate validates a new deployment.
|
||||||
func (deploymentStrategy) Validate(ctx api.Context, obj runtime.Object) errs.ValidationErrorList {
|
func (deploymentStrategy) Validate(ctx api.Context, obj runtime.Object) errs.ValidationErrorList {
|
||||||
deployment := obj.(*experimental.Deployment)
|
deployment := obj.(*extensions.Deployment)
|
||||||
return validation.ValidateDeployment(deployment)
|
return validation.ValidateDeployment(deployment)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ func (deploymentStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
|||||||
|
|
||||||
// ValidateUpdate is the default update validation for an end user.
|
// ValidateUpdate is the default update validation for an end user.
|
||||||
func (deploymentStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) errs.ValidationErrorList {
|
func (deploymentStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) errs.ValidationErrorList {
|
||||||
return validation.ValidateDeploymentUpdate(old.(*experimental.Deployment), obj.(*experimental.Deployment))
|
return validation.ValidateDeploymentUpdate(old.(*extensions.Deployment), obj.(*extensions.Deployment))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (deploymentStrategy) AllowUnconditionalUpdate() bool {
|
func (deploymentStrategy) AllowUnconditionalUpdate() bool {
|
||||||
@ -73,7 +73,7 @@ func (deploymentStrategy) AllowUnconditionalUpdate() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeploymentToSelectableFields returns a field set that represents the object.
|
// DeploymentToSelectableFields returns a field set that represents the object.
|
||||||
func DeploymentToSelectableFields(deployment *experimental.Deployment) fields.Set {
|
func DeploymentToSelectableFields(deployment *extensions.Deployment) fields.Set {
|
||||||
return fields.Set{
|
return fields.Set{
|
||||||
"metadata.name": deployment.Name,
|
"metadata.name": deployment.Name,
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ func MatchDeployment(label labels.Selector, field fields.Selector) generic.Match
|
|||||||
Label: label,
|
Label: label,
|
||||||
Field: field,
|
Field: field,
|
||||||
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
||||||
deployment, ok := obj.(*experimental.Deployment)
|
deployment, ok := obj.(*extensions.Deployment)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, fmt.Errorf("given object is not a deployment.")
|
return nil, nil, fmt.Errorf("given object is not a deployment.")
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ var _ = rest.Patcher(&ScaleREST{})
|
|||||||
|
|
||||||
// New creates a new Scale object
|
// New creates a new Scale object
|
||||||
func (r *ScaleREST) New() runtime.Object {
|
func (r *ScaleREST) New() runtime.Object {
|
||||||
return &experimental.Scale{}
|
return &extensions.Scale{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ScaleREST) Get(ctx api.Context, name string) (runtime.Object, error) {
|
func (r *ScaleREST) Get(ctx api.Context, name string) (runtime.Object, error) {
|
||||||
@ -65,16 +65,16 @@ func (r *ScaleREST) Get(ctx api.Context, name string) (runtime.Object, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.NewNotFound("scale", name)
|
return nil, errors.NewNotFound("scale", name)
|
||||||
}
|
}
|
||||||
return &experimental.Scale{
|
return &extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: rc.Namespace,
|
Namespace: rc.Namespace,
|
||||||
CreationTimestamp: rc.CreationTimestamp,
|
CreationTimestamp: rc.CreationTimestamp,
|
||||||
},
|
},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: rc.Spec.Replicas,
|
Replicas: rc.Spec.Replicas,
|
||||||
},
|
},
|
||||||
Status: experimental.ScaleStatus{
|
Status: extensions.ScaleStatus{
|
||||||
Replicas: rc.Status.Replicas,
|
Replicas: rc.Status.Replicas,
|
||||||
Selector: rc.Spec.Selector,
|
Selector: rc.Spec.Selector,
|
||||||
},
|
},
|
||||||
@ -85,7 +85,7 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
|
|||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
|
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
|
||||||
}
|
}
|
||||||
scale, ok := obj.(*experimental.Scale)
|
scale, ok := obj.(*extensions.Scale)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("wrong object passed to Scale update: %v", obj))
|
return nil, false, errors.NewBadRequest(fmt.Sprintf("wrong object passed to Scale update: %v", obj))
|
||||||
}
|
}
|
||||||
@ -98,16 +98,16 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, errors.NewConflict("scale", scale.Name, err)
|
return nil, false, errors.NewConflict("scale", scale.Name, err)
|
||||||
}
|
}
|
||||||
return &experimental.Scale{
|
return &extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: rc.Name,
|
Name: rc.Name,
|
||||||
Namespace: rc.Namespace,
|
Namespace: rc.Namespace,
|
||||||
CreationTimestamp: rc.CreationTimestamp,
|
CreationTimestamp: rc.CreationTimestamp,
|
||||||
},
|
},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: rc.Spec.Replicas,
|
Replicas: rc.Spec.Replicas,
|
||||||
},
|
},
|
||||||
Status: experimental.ScaleStatus{
|
Status: extensions.ScaleStatus{
|
||||||
Replicas: rc.Status.Replicas,
|
Replicas: rc.Status.Replicas,
|
||||||
Selector: rc.Spec.Selector,
|
Selector: rc.Spec.Selector,
|
||||||
},
|
},
|
||||||
@ -118,5 +118,5 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
|
|||||||
type RcREST struct{}
|
type RcREST struct{}
|
||||||
|
|
||||||
func (r *RcREST) New() runtime.Object {
|
func (r *RcREST) New() runtime.Object {
|
||||||
return &experimental.ReplicationControllerDummy{}
|
return &extensions.ReplicationControllerDummy{}
|
||||||
}
|
}
|
||||||
|
@ -66,12 +66,12 @@ var validController = api.ReplicationController{
|
|||||||
Spec: validControllerSpec,
|
Spec: validControllerSpec,
|
||||||
}
|
}
|
||||||
|
|
||||||
var validScale = experimental.Scale{
|
var validScale = extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test"},
|
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test"},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: validReplicas,
|
Replicas: validReplicas,
|
||||||
},
|
},
|
||||||
Status: experimental.ScaleStatus{
|
Status: extensions.ScaleStatus{
|
||||||
Replicas: 0,
|
Replicas: 0,
|
||||||
Selector: validPodTemplate.Template.Labels,
|
Selector: validPodTemplate.Template.Labels,
|
||||||
},
|
},
|
||||||
@ -88,7 +88,7 @@ func TestGet(t *testing.T) {
|
|||||||
|
|
||||||
expect := &validScale
|
expect := &validScale
|
||||||
obj, err := storage.Get(ctx, "foo")
|
obj, err := storage.Get(ctx, "foo")
|
||||||
scale := obj.(*experimental.Scale)
|
scale := obj.(*extensions.Scale)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@ -106,9 +106,9 @@ func TestUpdate(t *testing.T) {
|
|||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
replicas := 12
|
replicas := 12
|
||||||
update := experimental.Scale{
|
update := extensions.Scale{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test"},
|
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test"},
|
||||||
Spec: experimental.ScaleSpec{
|
Spec: extensions.ScaleSpec{
|
||||||
Replicas: replicas,
|
Replicas: replicas,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ type REST struct {
|
|||||||
func NewREST(s storage.Interface) *REST {
|
func NewREST(s storage.Interface) *REST {
|
||||||
prefix := "/horizontalpodautoscalers"
|
prefix := "/horizontalpodautoscalers"
|
||||||
store := &etcdgeneric.Etcd{
|
store := &etcdgeneric.Etcd{
|
||||||
NewFunc: func() runtime.Object { return &experimental.HorizontalPodAutoscaler{} },
|
NewFunc: func() runtime.Object { return &extensions.HorizontalPodAutoscaler{} },
|
||||||
// NewListFunc returns an object capable of storing results of an etcd list.
|
// NewListFunc returns an object capable of storing results of an etcd list.
|
||||||
NewListFunc: func() runtime.Object { return &experimental.HorizontalPodAutoscalerList{} },
|
NewListFunc: func() runtime.Object { return &extensions.HorizontalPodAutoscalerList{} },
|
||||||
// Produces a path that etcd understands, to the root of the resource
|
// Produces a path that etcd understands, to the root of the resource
|
||||||
// by combining the namespace in the context with the given prefix
|
// by combining the namespace in the context with the given prefix
|
||||||
KeyRootFunc: func(ctx api.Context) string {
|
KeyRootFunc: func(ctx api.Context) string {
|
||||||
@ -51,7 +51,7 @@ func NewREST(s storage.Interface) *REST {
|
|||||||
},
|
},
|
||||||
// Retrieve the name field of an autoscaler
|
// Retrieve the name field of an autoscaler
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||||
return obj.(*experimental.HorizontalPodAutoscaler).Name, nil
|
return obj.(*extensions.HorizontalPodAutoscaler).Name, nil
|
||||||
},
|
},
|
||||||
// Used to match objects based on labels/fields for list
|
// Used to match objects based on labels/fields for list
|
||||||
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
|
@ -36,19 +36,19 @@ func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient) {
|
|||||||
return NewREST(etcdStorage), fakeClient
|
return NewREST(etcdStorage), fakeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func validNewHorizontalPodAutoscaler(name string) *experimental.HorizontalPodAutoscaler {
|
func validNewHorizontalPodAutoscaler(name string) *extensions.HorizontalPodAutoscaler {
|
||||||
return &experimental.HorizontalPodAutoscaler{
|
return &extensions.HorizontalPodAutoscaler{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Subresource: "scale",
|
Subresource: "scale",
|
||||||
},
|
},
|
||||||
MinReplicas: 1,
|
MinReplicas: 1,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ func TestCreate(t *testing.T) {
|
|||||||
// valid
|
// valid
|
||||||
autoscaler,
|
autoscaler,
|
||||||
// invalid
|
// invalid
|
||||||
&experimental.HorizontalPodAutoscaler{},
|
&extensions.HorizontalPodAutoscaler{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ func TestUpdate(t *testing.T) {
|
|||||||
validNewHorizontalPodAutoscaler("foo"),
|
validNewHorizontalPodAutoscaler("foo"),
|
||||||
// updateFunc
|
// updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.HorizontalPodAutoscaler)
|
object := obj.(*extensions.HorizontalPodAutoscaler)
|
||||||
object.Spec.MaxReplicas = object.Spec.MaxReplicas + 1
|
object.Spec.MaxReplicas = object.Spec.MaxReplicas + 1
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
|
@ -46,12 +46,12 @@ func (autoscalerStrategy) NamespaceScoped() bool {
|
|||||||
|
|
||||||
// PrepareForCreate clears fields that are not allowed to be set by end users on creation.
|
// PrepareForCreate clears fields that are not allowed to be set by end users on creation.
|
||||||
func (autoscalerStrategy) PrepareForCreate(obj runtime.Object) {
|
func (autoscalerStrategy) PrepareForCreate(obj runtime.Object) {
|
||||||
_ = obj.(*experimental.HorizontalPodAutoscaler)
|
_ = obj.(*extensions.HorizontalPodAutoscaler)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates a new autoscaler.
|
// Validate validates a new autoscaler.
|
||||||
func (autoscalerStrategy) Validate(ctx api.Context, obj runtime.Object) errs.ValidationErrorList {
|
func (autoscalerStrategy) Validate(ctx api.Context, obj runtime.Object) errs.ValidationErrorList {
|
||||||
autoscaler := obj.(*experimental.HorizontalPodAutoscaler)
|
autoscaler := obj.(*extensions.HorizontalPodAutoscaler)
|
||||||
return validation.ValidateHorizontalPodAutoscaler(autoscaler)
|
return validation.ValidateHorizontalPodAutoscaler(autoscaler)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,19 +62,19 @@ func (autoscalerStrategy) AllowCreateOnUpdate() bool {
|
|||||||
|
|
||||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||||
func (autoscalerStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
func (autoscalerStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
||||||
_ = obj.(*experimental.HorizontalPodAutoscaler)
|
_ = obj.(*extensions.HorizontalPodAutoscaler)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate is the default update validation for an end user.
|
// ValidateUpdate is the default update validation for an end user.
|
||||||
func (autoscalerStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) errs.ValidationErrorList {
|
func (autoscalerStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) errs.ValidationErrorList {
|
||||||
return validation.ValidateHorizontalPodAutoscalerUpdate(obj.(*experimental.HorizontalPodAutoscaler), old.(*experimental.HorizontalPodAutoscaler))
|
return validation.ValidateHorizontalPodAutoscalerUpdate(obj.(*extensions.HorizontalPodAutoscaler), old.(*extensions.HorizontalPodAutoscaler))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (autoscalerStrategy) AllowUnconditionalUpdate() bool {
|
func (autoscalerStrategy) AllowUnconditionalUpdate() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func AutoscalerToSelectableFields(limitRange *experimental.HorizontalPodAutoscaler) fields.Set {
|
func AutoscalerToSelectableFields(limitRange *extensions.HorizontalPodAutoscaler) fields.Set {
|
||||||
return fields.Set{}
|
return fields.Set{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ func MatchAutoscaler(label labels.Selector, field fields.Selector) generic.Match
|
|||||||
Label: label,
|
Label: label,
|
||||||
Field: field,
|
Field: field,
|
||||||
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
||||||
hpa, ok := obj.(*experimental.HorizontalPodAutoscaler)
|
hpa, ok := obj.(*extensions.HorizontalPodAutoscaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, fmt.Errorf("given object is not a horizontal pod autoscaler.")
|
return nil, nil, fmt.Errorf("given object is not a horizontal pod autoscaler.")
|
||||||
}
|
}
|
||||||
|
@ -40,10 +40,10 @@ type REST struct {
|
|||||||
// NewREST returns a RESTStorage object that will work against replication controllers.
|
// NewREST returns a RESTStorage object that will work against replication controllers.
|
||||||
func NewREST(s storage.Interface) *REST {
|
func NewREST(s storage.Interface) *REST {
|
||||||
store := &etcdgeneric.Etcd{
|
store := &etcdgeneric.Etcd{
|
||||||
NewFunc: func() runtime.Object { return &experimental.Ingress{} },
|
NewFunc: func() runtime.Object { return &extensions.Ingress{} },
|
||||||
|
|
||||||
// NewListFunc returns an object capable of storing results of an etcd list.
|
// NewListFunc returns an object capable of storing results of an etcd list.
|
||||||
NewListFunc: func() runtime.Object { return &experimental.IngressList{} },
|
NewListFunc: func() runtime.Object { return &extensions.IngressList{} },
|
||||||
// Produces a ingress that etcd understands, to the root of the resource
|
// Produces a ingress that etcd understands, to the root of the resource
|
||||||
// by combining the namespace in the context with the given prefix
|
// by combining the namespace in the context with the given prefix
|
||||||
KeyRootFunc: func(ctx api.Context) string {
|
KeyRootFunc: func(ctx api.Context) string {
|
||||||
@ -56,7 +56,7 @@ func NewREST(s storage.Interface) *REST {
|
|||||||
},
|
},
|
||||||
// Retrieve the name field of a replication controller
|
// Retrieve the name field of a replication controller
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||||
return obj.(*experimental.Ingress).Name, nil
|
return obj.(*extensions.Ingress).Name, nil
|
||||||
},
|
},
|
||||||
// Used to match objects based on labels/fields for list and watch
|
// Used to match objects based on labels/fields for list and watch
|
||||||
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
|
@ -48,12 +48,12 @@ var (
|
|||||||
|
|
||||||
type IngressRuleValues map[string]string
|
type IngressRuleValues map[string]string
|
||||||
|
|
||||||
func toHTTPIngressPaths(pathMap map[string]string) []experimental.HTTPIngressPath {
|
func toHTTPIngressPaths(pathMap map[string]string) []extensions.HTTPIngressPath {
|
||||||
httpPaths := []experimental.HTTPIngressPath{}
|
httpPaths := []extensions.HTTPIngressPath{}
|
||||||
for path, backend := range pathMap {
|
for path, backend := range pathMap {
|
||||||
httpPaths = append(httpPaths, experimental.HTTPIngressPath{
|
httpPaths = append(httpPaths, extensions.HTTPIngressPath{
|
||||||
Path: path,
|
Path: path,
|
||||||
Backend: experimental.IngressBackend{
|
Backend: extensions.IngressBackend{
|
||||||
ServiceName: backend,
|
ServiceName: backend,
|
||||||
ServicePort: defaultBackendPort,
|
ServicePort: defaultBackendPort,
|
||||||
},
|
},
|
||||||
@ -62,13 +62,13 @@ func toHTTPIngressPaths(pathMap map[string]string) []experimental.HTTPIngressPat
|
|||||||
return httpPaths
|
return httpPaths
|
||||||
}
|
}
|
||||||
|
|
||||||
func toIngressRules(hostRules map[string]IngressRuleValues) []experimental.IngressRule {
|
func toIngressRules(hostRules map[string]IngressRuleValues) []extensions.IngressRule {
|
||||||
rules := []experimental.IngressRule{}
|
rules := []extensions.IngressRule{}
|
||||||
for host, pathMap := range hostRules {
|
for host, pathMap := range hostRules {
|
||||||
rules = append(rules, experimental.IngressRule{
|
rules = append(rules, extensions.IngressRule{
|
||||||
Host: host,
|
Host: host,
|
||||||
IngressRuleValue: experimental.IngressRuleValue{
|
IngressRuleValue: extensions.IngressRuleValue{
|
||||||
HTTP: &experimental.HTTPIngressRuleValue{
|
HTTP: &extensions.HTTPIngressRuleValue{
|
||||||
Paths: toHTTPIngressPaths(pathMap),
|
Paths: toHTTPIngressPaths(pathMap),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -77,14 +77,14 @@ func toIngressRules(hostRules map[string]IngressRuleValues) []experimental.Ingre
|
|||||||
return rules
|
return rules
|
||||||
}
|
}
|
||||||
|
|
||||||
func newIngress(pathMap map[string]string) *experimental.Ingress {
|
func newIngress(pathMap map[string]string) *extensions.Ingress {
|
||||||
return &experimental.Ingress{
|
return &extensions.Ingress{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
},
|
},
|
||||||
Spec: experimental.IngressSpec{
|
Spec: extensions.IngressSpec{
|
||||||
Backend: &experimental.IngressBackend{
|
Backend: &extensions.IngressBackend{
|
||||||
ServiceName: defaultBackendName,
|
ServiceName: defaultBackendName,
|
||||||
ServicePort: defaultBackendPort,
|
ServicePort: defaultBackendPort,
|
||||||
},
|
},
|
||||||
@ -92,7 +92,7 @@ func newIngress(pathMap map[string]string) *experimental.Ingress {
|
|||||||
defaultHostname: pathMap,
|
defaultHostname: pathMap,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
Status: experimental.IngressStatus{
|
Status: extensions.IngressStatus{
|
||||||
LoadBalancer: api.LoadBalancerStatus{
|
LoadBalancer: api.LoadBalancerStatus{
|
||||||
Ingress: []api.LoadBalancerIngress{
|
Ingress: []api.LoadBalancerIngress{
|
||||||
{IP: defaultLoadBalancer},
|
{IP: defaultLoadBalancer},
|
||||||
@ -102,7 +102,7 @@ func newIngress(pathMap map[string]string) *experimental.Ingress {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func validIngress() *experimental.Ingress {
|
func validIngress() *extensions.Ingress {
|
||||||
return newIngress(defaultPathMap)
|
return newIngress(defaultPathMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ func TestCreate(t *testing.T) {
|
|||||||
test := registrytest.New(t, fakeClient, storage.Etcd)
|
test := registrytest.New(t, fakeClient, storage.Etcd)
|
||||||
ingress := validIngress()
|
ingress := validIngress()
|
||||||
noDefaultBackendAndRules := validIngress()
|
noDefaultBackendAndRules := validIngress()
|
||||||
noDefaultBackendAndRules.Spec.Backend = &experimental.IngressBackend{}
|
noDefaultBackendAndRules.Spec.Backend = &extensions.IngressBackend{}
|
||||||
noDefaultBackendAndRules.Spec.Rules = []experimental.IngressRule{}
|
noDefaultBackendAndRules.Spec.Rules = []extensions.IngressRule{}
|
||||||
badPath := validIngress()
|
badPath := validIngress()
|
||||||
badPath.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
|
badPath.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
|
||||||
"foo.bar.com": {"/invalid[": "svc"}})
|
"foo.bar.com": {"/invalid[": "svc"}})
|
||||||
@ -132,7 +132,7 @@ func TestUpdate(t *testing.T) {
|
|||||||
validIngress(),
|
validIngress(),
|
||||||
// updateFunc
|
// updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Ingress)
|
object := obj.(*extensions.Ingress)
|
||||||
object.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
|
object.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
|
||||||
"bar.foo.com": {"/bar": defaultBackendName},
|
"bar.foo.com": {"/bar": defaultBackendName},
|
||||||
})
|
})
|
||||||
@ -140,19 +140,19 @@ func TestUpdate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
// invalid updateFunc: ObjeceMeta is not to be tampered with.
|
// invalid updateFunc: ObjeceMeta is not to be tampered with.
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Ingress)
|
object := obj.(*extensions.Ingress)
|
||||||
object.UID = "newUID"
|
object.UID = "newUID"
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
|
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Ingress)
|
object := obj.(*extensions.Ingress)
|
||||||
object.Name = ""
|
object.Name = ""
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
|
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Ingress)
|
object := obj.(*extensions.Ingress)
|
||||||
object.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
|
object.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
|
||||||
"foo.bar.com": {"/invalid[": "svc"}})
|
"foo.bar.com": {"/invalid[": "svc"}})
|
||||||
return object
|
return object
|
||||||
|
@ -46,16 +46,16 @@ func (ingressStrategy) NamespaceScoped() bool {
|
|||||||
|
|
||||||
// PrepareForCreate clears the status of an Ingress before creation.
|
// PrepareForCreate clears the status of an Ingress before creation.
|
||||||
func (ingressStrategy) PrepareForCreate(obj runtime.Object) {
|
func (ingressStrategy) PrepareForCreate(obj runtime.Object) {
|
||||||
ingress := obj.(*experimental.Ingress)
|
ingress := obj.(*extensions.Ingress)
|
||||||
ingress.Status = experimental.IngressStatus{}
|
ingress.Status = extensions.IngressStatus{}
|
||||||
|
|
||||||
ingress.Generation = 1
|
ingress.Generation = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||||
func (ingressStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
func (ingressStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
||||||
newIngress := obj.(*experimental.Ingress)
|
newIngress := obj.(*extensions.Ingress)
|
||||||
oldIngress := old.(*experimental.Ingress)
|
oldIngress := old.(*extensions.Ingress)
|
||||||
//TODO: Clear Ingress status once we have a sub-resource.
|
//TODO: Clear Ingress status once we have a sub-resource.
|
||||||
|
|
||||||
// Any changes to the spec increment the generation number, any changes to the
|
// Any changes to the spec increment the generation number, any changes to the
|
||||||
@ -69,7 +69,7 @@ func (ingressStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
|||||||
|
|
||||||
// Validate validates a new Ingress.
|
// Validate validates a new Ingress.
|
||||||
func (ingressStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
func (ingressStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
||||||
ingress := obj.(*experimental.Ingress)
|
ingress := obj.(*extensions.Ingress)
|
||||||
err := validation.ValidateIngress(ingress)
|
err := validation.ValidateIngress(ingress)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -81,8 +81,8 @@ func (ingressStrategy) AllowCreateOnUpdate() bool {
|
|||||||
|
|
||||||
// ValidateUpdate is the default update validation for an end user.
|
// ValidateUpdate is the default update validation for an end user.
|
||||||
func (ingressStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
func (ingressStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
||||||
validationErrorList := validation.ValidateIngress(obj.(*experimental.Ingress))
|
validationErrorList := validation.ValidateIngress(obj.(*extensions.Ingress))
|
||||||
updateErrorList := validation.ValidateIngressUpdate(old.(*experimental.Ingress), obj.(*experimental.Ingress))
|
updateErrorList := validation.ValidateIngressUpdate(old.(*extensions.Ingress), obj.(*extensions.Ingress))
|
||||||
return append(validationErrorList, updateErrorList...)
|
return append(validationErrorList, updateErrorList...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ func (ingressStrategy) AllowUnconditionalUpdate() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IngressToSelectableFields returns a label set that represents the object.
|
// IngressToSelectableFields returns a label set that represents the object.
|
||||||
func IngressToSelectableFields(ingress *experimental.Ingress) fields.Set {
|
func IngressToSelectableFields(ingress *extensions.Ingress) fields.Set {
|
||||||
return fields.Set{
|
return fields.Set{
|
||||||
"metadata.name": ingress.Name,
|
"metadata.name": ingress.Name,
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ func MatchIngress(label labels.Selector, field fields.Selector) generic.Matcher
|
|||||||
Label: label,
|
Label: label,
|
||||||
Field: field,
|
Field: field,
|
||||||
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
||||||
ingress, ok := obj.(*experimental.Ingress)
|
ingress, ok := obj.(*extensions.Ingress)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, fmt.Errorf("Given object is not an Ingress.")
|
return nil, nil, fmt.Errorf("Given object is not an Ingress.")
|
||||||
}
|
}
|
||||||
|
@ -40,10 +40,10 @@ var jobPrefix = "/jobs"
|
|||||||
// NewREST returns a RESTStorage object that will work against Jobs.
|
// NewREST returns a RESTStorage object that will work against Jobs.
|
||||||
func NewREST(s storage.Interface) (*REST, *StatusREST) {
|
func NewREST(s storage.Interface) (*REST, *StatusREST) {
|
||||||
store := &etcdgeneric.Etcd{
|
store := &etcdgeneric.Etcd{
|
||||||
NewFunc: func() runtime.Object { return &experimental.Job{} },
|
NewFunc: func() runtime.Object { return &extensions.Job{} },
|
||||||
|
|
||||||
// NewListFunc returns an object capable of storing results of an etcd list.
|
// NewListFunc returns an object capable of storing results of an etcd list.
|
||||||
NewListFunc: func() runtime.Object { return &experimental.JobList{} },
|
NewListFunc: func() runtime.Object { return &extensions.JobList{} },
|
||||||
// Produces a path that etcd understands, to the root of the resource
|
// Produces a path that etcd understands, to the root of the resource
|
||||||
// by combining the namespace in the context with the given prefix
|
// by combining the namespace in the context with the given prefix
|
||||||
KeyRootFunc: func(ctx api.Context) string {
|
KeyRootFunc: func(ctx api.Context) string {
|
||||||
@ -56,7 +56,7 @@ func NewREST(s storage.Interface) (*REST, *StatusREST) {
|
|||||||
},
|
},
|
||||||
// Retrieve the name field of a job
|
// Retrieve the name field of a job
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||||
return obj.(*experimental.Job).Name, nil
|
return obj.(*extensions.Job).Name, nil
|
||||||
},
|
},
|
||||||
// Used to match objects based on labels/fields for list and watch
|
// Used to match objects based on labels/fields for list and watch
|
||||||
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
@ -85,7 +85,7 @@ type StatusREST struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *StatusREST) New() runtime.Object {
|
func (r *StatusREST) New() runtime.Object {
|
||||||
return &experimental.Job{}
|
return &extensions.Job{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update alters the status subset of an object.
|
// Update alters the status subset of an object.
|
||||||
|
@ -36,15 +36,15 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient) {
|
|||||||
return storage, statusStorage, fakeClient
|
return storage, statusStorage, fakeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func validNewJob() *experimental.Job {
|
func validNewJob() *extensions.Job {
|
||||||
completions := 1
|
completions := 1
|
||||||
parallelism := 1
|
parallelism := 1
|
||||||
return &experimental.Job{
|
return &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Completions: &completions,
|
Completions: &completions,
|
||||||
Parallelism: ¶llelism,
|
Parallelism: ¶llelism,
|
||||||
Selector: map[string]string{"a": "b"},
|
Selector: map[string]string{"a": "b"},
|
||||||
@ -77,8 +77,8 @@ func TestCreate(t *testing.T) {
|
|||||||
// valid
|
// valid
|
||||||
validJob,
|
validJob,
|
||||||
// invalid (empty selector)
|
// invalid (empty selector)
|
||||||
&experimental.Job{
|
&extensions.Job{
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Completions: validJob.Spec.Completions,
|
Completions: validJob.Spec.Completions,
|
||||||
Selector: map[string]string{},
|
Selector: map[string]string{},
|
||||||
Template: validJob.Spec.Template,
|
Template: validJob.Spec.Template,
|
||||||
@ -96,18 +96,18 @@ func TestUpdate(t *testing.T) {
|
|||||||
validNewJob(),
|
validNewJob(),
|
||||||
// updateFunc
|
// updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Job)
|
object := obj.(*extensions.Job)
|
||||||
object.Spec.Parallelism = &two
|
object.Spec.Parallelism = &two
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
// invalid updateFunc
|
// invalid updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Job)
|
object := obj.(*extensions.Job)
|
||||||
object.Spec.Selector = map[string]string{}
|
object.Spec.Selector = map[string]string{}
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.Job)
|
object := obj.(*extensions.Job)
|
||||||
object.Spec.Completions = &two
|
object.Spec.Completions = &two
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
|
@ -30,15 +30,15 @@ import (
|
|||||||
// Registry is an interface for things that know how to store Jobs.
|
// Registry is an interface for things that know how to store Jobs.
|
||||||
type Registry interface {
|
type Registry interface {
|
||||||
// ListJobs obtains a list of Jobs having labels and fields which match selector.
|
// ListJobs obtains a list of Jobs having labels and fields which match selector.
|
||||||
ListJobs(ctx api.Context, label labels.Selector, field fields.Selector) (*experimental.JobList, error)
|
ListJobs(ctx api.Context, label labels.Selector, field fields.Selector) (*extensions.JobList, error)
|
||||||
// WatchJobs watch for new/changed/deleted Jobs.
|
// WatchJobs watch for new/changed/deleted Jobs.
|
||||||
WatchJobs(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
WatchJobs(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||||
// GetJobs gets a specific Job.
|
// GetJobs gets a specific Job.
|
||||||
GetJob(ctx api.Context, name string) (*experimental.Job, error)
|
GetJob(ctx api.Context, name string) (*extensions.Job, error)
|
||||||
// CreateJob creates a Job based on a specification.
|
// CreateJob creates a Job based on a specification.
|
||||||
CreateJob(ctx api.Context, job *experimental.Job) (*experimental.Job, error)
|
CreateJob(ctx api.Context, job *extensions.Job) (*extensions.Job, error)
|
||||||
// UpdateJob updates an existing Job.
|
// UpdateJob updates an existing Job.
|
||||||
UpdateJob(ctx api.Context, job *experimental.Job) (*experimental.Job, error)
|
UpdateJob(ctx api.Context, job *extensions.Job) (*extensions.Job, error)
|
||||||
// DeleteJob deletes an existing Job.
|
// DeleteJob deletes an existing Job.
|
||||||
DeleteJob(ctx api.Context, name string) error
|
DeleteJob(ctx api.Context, name string) error
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
|||||||
return &storage{s}
|
return &storage{s}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) ListJobs(ctx api.Context, label labels.Selector, field fields.Selector) (*experimental.JobList, error) {
|
func (s *storage) ListJobs(ctx api.Context, label labels.Selector, field fields.Selector) (*extensions.JobList, error) {
|
||||||
if !field.Empty() {
|
if !field.Empty() {
|
||||||
return nil, fmt.Errorf("field selector not supported yet")
|
return nil, fmt.Errorf("field selector not supported yet")
|
||||||
}
|
}
|
||||||
@ -62,35 +62,35 @@ func (s *storage) ListJobs(ctx api.Context, label labels.Selector, field fields.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.JobList), err
|
return obj.(*extensions.JobList), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) WatchJobs(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
|
func (s *storage) WatchJobs(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
|
||||||
return s.Watch(ctx, label, field, resourceVersion)
|
return s.Watch(ctx, label, field, resourceVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) GetJob(ctx api.Context, name string) (*experimental.Job, error) {
|
func (s *storage) GetJob(ctx api.Context, name string) (*extensions.Job, error) {
|
||||||
obj, err := s.Get(ctx, name)
|
obj, err := s.Get(ctx, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.Job), nil
|
return obj.(*extensions.Job), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) CreateJob(ctx api.Context, job *experimental.Job) (*experimental.Job, error) {
|
func (s *storage) CreateJob(ctx api.Context, job *extensions.Job) (*extensions.Job, error) {
|
||||||
obj, err := s.Create(ctx, job)
|
obj, err := s.Create(ctx, job)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.Job), nil
|
return obj.(*extensions.Job), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) UpdateJob(ctx api.Context, job *experimental.Job) (*experimental.Job, error) {
|
func (s *storage) UpdateJob(ctx api.Context, job *extensions.Job) (*extensions.Job, error) {
|
||||||
obj, _, err := s.Update(ctx, job)
|
obj, _, err := s.Update(ctx, job)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.Job), nil
|
return obj.(*extensions.Job), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) DeleteJob(ctx api.Context, name string) error {
|
func (s *storage) DeleteJob(ctx api.Context, name string) error {
|
||||||
|
@ -46,20 +46,20 @@ func (jobStrategy) NamespaceScoped() bool {
|
|||||||
|
|
||||||
// PrepareForCreate clears the status of a job before creation.
|
// PrepareForCreate clears the status of a job before creation.
|
||||||
func (jobStrategy) PrepareForCreate(obj runtime.Object) {
|
func (jobStrategy) PrepareForCreate(obj runtime.Object) {
|
||||||
job := obj.(*experimental.Job)
|
job := obj.(*extensions.Job)
|
||||||
job.Status = experimental.JobStatus{}
|
job.Status = extensions.JobStatus{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||||
func (jobStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
func (jobStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
||||||
newJob := obj.(*experimental.Job)
|
newJob := obj.(*extensions.Job)
|
||||||
oldJob := old.(*experimental.Job)
|
oldJob := old.(*extensions.Job)
|
||||||
newJob.Status = oldJob.Status
|
newJob.Status = oldJob.Status
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates a new job.
|
// Validate validates a new job.
|
||||||
func (jobStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
func (jobStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
||||||
job := obj.(*experimental.Job)
|
job := obj.(*extensions.Job)
|
||||||
return validation.ValidateJob(job)
|
return validation.ValidateJob(job)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,8 +74,8 @@ func (jobStrategy) AllowCreateOnUpdate() bool {
|
|||||||
|
|
||||||
// ValidateUpdate is the default update validation for an end user.
|
// ValidateUpdate is the default update validation for an end user.
|
||||||
func (jobStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
func (jobStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
||||||
validationErrorList := validation.ValidateJob(obj.(*experimental.Job))
|
validationErrorList := validation.ValidateJob(obj.(*extensions.Job))
|
||||||
updateErrorList := validation.ValidateJobUpdate(old.(*experimental.Job), obj.(*experimental.Job))
|
updateErrorList := validation.ValidateJobUpdate(old.(*extensions.Job), obj.(*extensions.Job))
|
||||||
return append(validationErrorList, updateErrorList...)
|
return append(validationErrorList, updateErrorList...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,17 +86,17 @@ type jobStatusStrategy struct {
|
|||||||
var StatusStrategy = jobStatusStrategy{Strategy}
|
var StatusStrategy = jobStatusStrategy{Strategy}
|
||||||
|
|
||||||
func (jobStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
func (jobStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
|
||||||
newJob := obj.(*experimental.Job)
|
newJob := obj.(*extensions.Job)
|
||||||
oldJob := old.(*experimental.Job)
|
oldJob := old.(*extensions.Job)
|
||||||
newJob.Spec = oldJob.Spec
|
newJob.Spec = oldJob.Spec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (jobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
func (jobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
||||||
return validation.ValidateJobUpdateStatus(obj.(*experimental.Job), old.(*experimental.Job))
|
return validation.ValidateJobUpdateStatus(obj.(*extensions.Job), old.(*extensions.Job))
|
||||||
}
|
}
|
||||||
|
|
||||||
// JobSelectableFields returns a field set that represents the object for matching purposes.
|
// JobSelectableFields returns a field set that represents the object for matching purposes.
|
||||||
func JobToSelectableFields(job *experimental.Job) fields.Set {
|
func JobToSelectableFields(job *extensions.Job) fields.Set {
|
||||||
return fields.Set{
|
return fields.Set{
|
||||||
"metadata.name": job.Name,
|
"metadata.name": job.Name,
|
||||||
"status.successful": strconv.Itoa(job.Status.Succeeded),
|
"status.successful": strconv.Itoa(job.Status.Succeeded),
|
||||||
@ -111,7 +111,7 @@ func MatchJob(label labels.Selector, field fields.Selector) generic.Matcher {
|
|||||||
Label: label,
|
Label: label,
|
||||||
Field: field,
|
Field: field,
|
||||||
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
||||||
job, ok := obj.(*experimental.Job)
|
job, ok := obj.(*extensions.Job)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, fmt.Errorf("Given object is not a job.")
|
return nil, nil, fmt.Errorf("Given object is not a job.")
|
||||||
}
|
}
|
||||||
|
@ -43,16 +43,16 @@ func TestJobStrategy(t *testing.T) {
|
|||||||
Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}},
|
Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
job := &experimental.Job{
|
job := &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateSpec,
|
Template: &validPodTemplateSpec,
|
||||||
},
|
},
|
||||||
Status: experimental.JobStatus{
|
Status: extensions.JobStatus{
|
||||||
Active: 11,
|
Active: 11,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -66,12 +66,12 @@ func TestJobStrategy(t *testing.T) {
|
|||||||
t.Errorf("Unexpected error validating %v", errs)
|
t.Errorf("Unexpected error validating %v", errs)
|
||||||
}
|
}
|
||||||
parallelism := 10
|
parallelism := 10
|
||||||
updatedJob := &experimental.Job{
|
updatedJob := &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "4"},
|
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "4"},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: ¶llelism,
|
Parallelism: ¶llelism,
|
||||||
},
|
},
|
||||||
Status: experimental.JobStatus{
|
Status: extensions.JobStatus{
|
||||||
Active: 11,
|
Active: 11,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -108,33 +108,33 @@ func TestJobStatusStrategy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
oldParallelism := 10
|
oldParallelism := 10
|
||||||
newParallelism := 11
|
newParallelism := 11
|
||||||
oldJob := &experimental.Job{
|
oldJob := &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
ResourceVersion: "10",
|
ResourceVersion: "10",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateSpec,
|
Template: &validPodTemplateSpec,
|
||||||
Parallelism: &oldParallelism,
|
Parallelism: &oldParallelism,
|
||||||
},
|
},
|
||||||
Status: experimental.JobStatus{
|
Status: extensions.JobStatus{
|
||||||
Active: 11,
|
Active: 11,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
newJob := &experimental.Job{
|
newJob := &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "myjob",
|
Name: "myjob",
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
ResourceVersion: "9",
|
ResourceVersion: "9",
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Selector: validSelector,
|
Selector: validSelector,
|
||||||
Template: &validPodTemplateSpec,
|
Template: &validPodTemplateSpec,
|
||||||
Parallelism: &newParallelism,
|
Parallelism: &newParallelism,
|
||||||
},
|
},
|
||||||
Status: experimental.JobStatus{
|
Status: extensions.JobStatus{
|
||||||
Active: 12,
|
Active: 12,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ func NewREST(s storage.Interface) *REST {
|
|||||||
prefix := "/thirdpartyresources"
|
prefix := "/thirdpartyresources"
|
||||||
|
|
||||||
store := &etcdgeneric.Etcd{
|
store := &etcdgeneric.Etcd{
|
||||||
NewFunc: func() runtime.Object { return &experimental.ThirdPartyResource{} },
|
NewFunc: func() runtime.Object { return &extensions.ThirdPartyResource{} },
|
||||||
NewListFunc: func() runtime.Object { return &experimental.ThirdPartyResourceList{} },
|
NewListFunc: func() runtime.Object { return &extensions.ThirdPartyResourceList{} },
|
||||||
KeyRootFunc: func(ctx api.Context) string {
|
KeyRootFunc: func(ctx api.Context) string {
|
||||||
return etcdgeneric.NamespaceKeyRootFunc(ctx, prefix)
|
return etcdgeneric.NamespaceKeyRootFunc(ctx, prefix)
|
||||||
},
|
},
|
||||||
@ -47,7 +47,7 @@ func NewREST(s storage.Interface) *REST {
|
|||||||
return etcdgeneric.NamespaceKeyFunc(ctx, prefix, id)
|
return etcdgeneric.NamespaceKeyFunc(ctx, prefix, id)
|
||||||
},
|
},
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||||
return obj.(*experimental.ThirdPartyResource).Name, nil
|
return obj.(*extensions.ThirdPartyResource).Name, nil
|
||||||
},
|
},
|
||||||
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
return thirdpartyresource.Matcher(label, field)
|
return thirdpartyresource.Matcher(label, field)
|
||||||
|
@ -35,13 +35,13 @@ func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient) {
|
|||||||
return NewREST(etcdStorage), fakeClient
|
return NewREST(etcdStorage), fakeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func validNewThirdPartyResource(name string) *experimental.ThirdPartyResource {
|
func validNewThirdPartyResource(name string) *extensions.ThirdPartyResource {
|
||||||
return &experimental.ThirdPartyResource{
|
return &extensions.ThirdPartyResource{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
},
|
},
|
||||||
Versions: []experimental.APIVersion{
|
Versions: []extensions.APIVersion{
|
||||||
{
|
{
|
||||||
Name: "stable/v1",
|
Name: "stable/v1",
|
||||||
},
|
},
|
||||||
@ -58,7 +58,7 @@ func TestCreate(t *testing.T) {
|
|||||||
// valid
|
// valid
|
||||||
rsrc,
|
rsrc,
|
||||||
// invalid
|
// invalid
|
||||||
&experimental.ThirdPartyResource{},
|
&extensions.ThirdPartyResource{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ func TestUpdate(t *testing.T) {
|
|||||||
validNewThirdPartyResource("foo"),
|
validNewThirdPartyResource("foo"),
|
||||||
// updateFunc
|
// updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.ThirdPartyResource)
|
object := obj.(*extensions.ThirdPartyResource)
|
||||||
object.Description = "new description"
|
object.Description = "new description"
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
|
@ -52,7 +52,7 @@ func (strategy) PrepareForCreate(obj runtime.Object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (strategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
func (strategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
||||||
return validation.ValidateThirdPartyResource(obj.(*experimental.ThirdPartyResource))
|
return validation.ValidateThirdPartyResource(obj.(*extensions.ThirdPartyResource))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (strategy) AllowCreateOnUpdate() bool {
|
func (strategy) AllowCreateOnUpdate() bool {
|
||||||
@ -63,7 +63,7 @@ func (strategy) PrepareForUpdate(obj, old runtime.Object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (strategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
func (strategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
||||||
return validation.ValidateThirdPartyResourceUpdate(old.(*experimental.ThirdPartyResource), obj.(*experimental.ThirdPartyResource))
|
return validation.ValidateThirdPartyResourceUpdate(old.(*extensions.ThirdPartyResource), obj.(*extensions.ThirdPartyResource))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (strategy) AllowUnconditionalUpdate() bool {
|
func (strategy) AllowUnconditionalUpdate() bool {
|
||||||
@ -73,7 +73,7 @@ func (strategy) AllowUnconditionalUpdate() bool {
|
|||||||
// Matcher returns a generic matcher for a given label and field selector.
|
// Matcher returns a generic matcher for a given label and field selector.
|
||||||
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
|
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
|
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
|
||||||
sa, ok := obj.(*experimental.ThirdPartyResource)
|
sa, ok := obj.(*extensions.ThirdPartyResource)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false, fmt.Errorf("not a ThirdPartyResource")
|
return false, fmt.Errorf("not a ThirdPartyResource")
|
||||||
}
|
}
|
||||||
@ -83,6 +83,6 @@ func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SelectableFields returns a label set that can be used for filter selection
|
// SelectableFields returns a label set that can be used for filter selection
|
||||||
func SelectableFields(obj *experimental.ThirdPartyResource) labels.Set {
|
func SelectableFields(obj *extensions.ThirdPartyResource) labels.Set {
|
||||||
return labels.Set{}
|
return labels.Set{}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ func NewCodec(codec runtime.Codec, kind string) runtime.Codec {
|
|||||||
return &thirdPartyResourceDataCodec{codec, kind}
|
return &thirdPartyResourceDataCodec{codec, kind}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *thirdPartyResourceDataCodec) populate(objIn *experimental.ThirdPartyResourceData, data []byte) error {
|
func (t *thirdPartyResourceDataCodec) populate(objIn *extensions.ThirdPartyResourceData, data []byte) error {
|
||||||
var obj interface{}
|
var obj interface{}
|
||||||
if err := json.Unmarshal(data, &obj); err != nil {
|
if err := json.Unmarshal(data, &obj); err != nil {
|
||||||
fmt.Printf("Invalid JSON:\n%s\n", string(data))
|
fmt.Printf("Invalid JSON:\n%s\n", string(data))
|
||||||
@ -118,7 +118,7 @@ func (t *thirdPartyResourceDataCodec) populate(objIn *experimental.ThirdPartyRes
|
|||||||
return t.populateFromObject(objIn, mapObj, data)
|
return t.populateFromObject(objIn, mapObj, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *thirdPartyResourceDataCodec) populateFromObject(objIn *experimental.ThirdPartyResourceData, mapObj map[string]interface{}, data []byte) error {
|
func (t *thirdPartyResourceDataCodec) populateFromObject(objIn *extensions.ThirdPartyResourceData, mapObj map[string]interface{}, data []byte) error {
|
||||||
typeMeta := unversioned.TypeMeta{}
|
typeMeta := unversioned.TypeMeta{}
|
||||||
if err := json.Unmarshal(data, &typeMeta); err != nil {
|
if err := json.Unmarshal(data, &typeMeta); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -146,7 +146,7 @@ func (t *thirdPartyResourceDataCodec) populateFromObject(objIn *experimental.Thi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *thirdPartyResourceDataCodec) Decode(data []byte) (runtime.Object, error) {
|
func (t *thirdPartyResourceDataCodec) Decode(data []byte) (runtime.Object, error) {
|
||||||
result := &experimental.ThirdPartyResourceData{}
|
result := &extensions.ThirdPartyResourceData{}
|
||||||
if err := t.populate(result, data); err != nil {
|
if err := t.populate(result, data); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ func (t *thirdPartyResourceDataCodec) DecodeToVersion(data []byte, version strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *thirdPartyResourceDataCodec) DecodeInto(data []byte, obj runtime.Object) error {
|
func (t *thirdPartyResourceDataCodec) DecodeInto(data []byte, obj runtime.Object) error {
|
||||||
thirdParty, ok := obj.(*experimental.ThirdPartyResourceData)
|
thirdParty, ok := obj.(*extensions.ThirdPartyResourceData)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("unexpected object: %#v", obj)
|
return fmt.Errorf("unexpected object: %#v", obj)
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ func (t *thirdPartyResourceDataCodec) DecodeInto(data []byte, obj runtime.Object
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *thirdPartyResourceDataCodec) DecodeIntoWithSpecifiedVersionKind(data []byte, obj runtime.Object, version, kind string) error {
|
func (t *thirdPartyResourceDataCodec) DecodeIntoWithSpecifiedVersionKind(data []byte, obj runtime.Object, version, kind string) error {
|
||||||
thirdParty, ok := obj.(*experimental.ThirdPartyResourceData)
|
thirdParty, ok := obj.(*extensions.ThirdPartyResourceData)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("unexpected object: %#v", obj)
|
return fmt.Errorf("unexpected object: %#v", obj)
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ const template = `{
|
|||||||
"items": [ %s ]
|
"items": [ %s ]
|
||||||
}`
|
}`
|
||||||
|
|
||||||
func encodeToJSON(obj *experimental.ThirdPartyResourceData, stream io.Writer) error {
|
func encodeToJSON(obj *extensions.ThirdPartyResourceData, stream io.Writer) error {
|
||||||
var objOut interface{}
|
var objOut interface{}
|
||||||
if err := json.Unmarshal(obj.Data, &objOut); err != nil {
|
if err := json.Unmarshal(obj.Data, &objOut); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -250,9 +250,9 @@ func (t *thirdPartyResourceDataCodec) Encode(obj runtime.Object) ([]byte, error)
|
|||||||
|
|
||||||
func (t *thirdPartyResourceDataCodec) EncodeToStream(obj runtime.Object, stream io.Writer) (err error) {
|
func (t *thirdPartyResourceDataCodec) EncodeToStream(obj runtime.Object, stream io.Writer) (err error) {
|
||||||
switch obj := obj.(type) {
|
switch obj := obj.(type) {
|
||||||
case *experimental.ThirdPartyResourceData:
|
case *extensions.ThirdPartyResourceData:
|
||||||
return encodeToJSON(obj, stream)
|
return encodeToJSON(obj, stream)
|
||||||
case *experimental.ThirdPartyResourceDataList:
|
case *extensions.ThirdPartyResourceDataList:
|
||||||
// TODO: There must be a better way to do this...
|
// TODO: There must be a better way to do this...
|
||||||
dataStrings := make([]string, len(obj.Items))
|
dataStrings := make([]string, len(obj.Items))
|
||||||
for ix := range obj.Items {
|
for ix := range obj.Items {
|
||||||
@ -288,12 +288,12 @@ func (t *thirdPartyResourceDataCreator) New(groupVersion, kind string) (out runt
|
|||||||
if apiutil.GetGroupVersion(t.group, t.version) != groupVersion {
|
if apiutil.GetGroupVersion(t.group, t.version) != groupVersion {
|
||||||
return nil, fmt.Errorf("unknown version %s for kind %s", groupVersion, kind)
|
return nil, fmt.Errorf("unknown version %s for kind %s", groupVersion, kind)
|
||||||
}
|
}
|
||||||
return &experimental.ThirdPartyResourceData{}, nil
|
return &extensions.ThirdPartyResourceData{}, nil
|
||||||
case "ThirdPartyResourceDataList":
|
case "ThirdPartyResourceDataList":
|
||||||
if apiutil.GetGroupVersion(t.group, t.version) != groupVersion {
|
if apiutil.GetGroupVersion(t.group, t.version) != groupVersion {
|
||||||
return nil, fmt.Errorf("unknown version %s for kind %s", groupVersion, kind)
|
return nil, fmt.Errorf("unknown version %s for kind %s", groupVersion, kind)
|
||||||
}
|
}
|
||||||
return &experimental.ThirdPartyResourceDataList{}, nil
|
return &extensions.ThirdPartyResourceDataList{}, nil
|
||||||
default:
|
default:
|
||||||
return t.delegate.New(groupVersion, kind)
|
return t.delegate.New(groupVersion, kind)
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ func TestCodec(t *testing.T) {
|
|||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
rsrcObj, ok := obj.(*experimental.ThirdPartyResourceData)
|
rsrcObj, ok := obj.(*extensions.ThirdPartyResourceData)
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Errorf("[%s] unexpected object: %v", test.name, obj)
|
t.Errorf("[%s] unexpected object: %v", test.name, obj)
|
||||||
continue
|
continue
|
||||||
@ -149,7 +149,7 @@ func TestCreater(t *testing.T) {
|
|||||||
name: "valid ThirdPartyResourceData creation",
|
name: "valid ThirdPartyResourceData creation",
|
||||||
version: "creater group/creater version",
|
version: "creater group/creater version",
|
||||||
kind: "ThirdPartyResourceData",
|
kind: "ThirdPartyResourceData",
|
||||||
expectedObj: &experimental.ThirdPartyResourceData{},
|
expectedObj: &extensions.ThirdPartyResourceData{},
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -40,8 +40,8 @@ func NewREST(s storage.Interface, group, kind string) *REST {
|
|||||||
prefix := "/ThirdPartyResourceData/" + group + "/" + strings.ToLower(kind) + "s"
|
prefix := "/ThirdPartyResourceData/" + group + "/" + strings.ToLower(kind) + "s"
|
||||||
|
|
||||||
store := &etcdgeneric.Etcd{
|
store := &etcdgeneric.Etcd{
|
||||||
NewFunc: func() runtime.Object { return &experimental.ThirdPartyResourceData{} },
|
NewFunc: func() runtime.Object { return &extensions.ThirdPartyResourceData{} },
|
||||||
NewListFunc: func() runtime.Object { return &experimental.ThirdPartyResourceDataList{} },
|
NewListFunc: func() runtime.Object { return &extensions.ThirdPartyResourceDataList{} },
|
||||||
KeyRootFunc: func(ctx api.Context) string {
|
KeyRootFunc: func(ctx api.Context) string {
|
||||||
return etcdgeneric.NamespaceKeyRootFunc(ctx, prefix)
|
return etcdgeneric.NamespaceKeyRootFunc(ctx, prefix)
|
||||||
},
|
},
|
||||||
@ -49,7 +49,7 @@ func NewREST(s storage.Interface, group, kind string) *REST {
|
|||||||
return etcdgeneric.NamespaceKeyFunc(ctx, prefix, id)
|
return etcdgeneric.NamespaceKeyFunc(ctx, prefix, id)
|
||||||
},
|
},
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||||
return obj.(*experimental.ThirdPartyResourceData).Name, nil
|
return obj.(*extensions.ThirdPartyResourceData).Name, nil
|
||||||
},
|
},
|
||||||
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
return thirdpartyresourcedata.Matcher(label, field)
|
return thirdpartyresourcedata.Matcher(label, field)
|
||||||
|
@ -35,8 +35,8 @@ func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient) {
|
|||||||
return NewREST(etcdStorage, "foo", "bar"), fakeClient
|
return NewREST(etcdStorage, "foo", "bar"), fakeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func validNewThirdPartyResourceData(name string) *experimental.ThirdPartyResourceData {
|
func validNewThirdPartyResourceData(name string) *extensions.ThirdPartyResourceData {
|
||||||
return &experimental.ThirdPartyResourceData{
|
return &extensions.ThirdPartyResourceData{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
@ -54,7 +54,7 @@ func TestCreate(t *testing.T) {
|
|||||||
// valid
|
// valid
|
||||||
rsrc,
|
rsrc,
|
||||||
// invalid
|
// invalid
|
||||||
&experimental.ThirdPartyResourceData{},
|
&extensions.ThirdPartyResourceData{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ func TestUpdate(t *testing.T) {
|
|||||||
validNewThirdPartyResourceData("foo"),
|
validNewThirdPartyResourceData("foo"),
|
||||||
// updateFunc
|
// updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*experimental.ThirdPartyResourceData)
|
object := obj.(*extensions.ThirdPartyResourceData)
|
||||||
object.Data = []byte("new description")
|
object.Data = []byte("new description")
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
|
@ -28,15 +28,15 @@ import (
|
|||||||
// Registry is an interface implemented by things that know how to store ThirdPartyResourceData objects.
|
// Registry is an interface implemented by things that know how to store ThirdPartyResourceData objects.
|
||||||
type Registry interface {
|
type Registry interface {
|
||||||
// ListThirdPartyResourceData obtains a list of ThirdPartyResourceData having labels which match selector.
|
// ListThirdPartyResourceData obtains a list of ThirdPartyResourceData having labels which match selector.
|
||||||
ListThirdPartyResourceData(ctx api.Context, selector labels.Selector) (*experimental.ThirdPartyResourceDataList, error)
|
ListThirdPartyResourceData(ctx api.Context, selector labels.Selector) (*extensions.ThirdPartyResourceDataList, error)
|
||||||
// Watch for new/changed/deleted ThirdPartyResourceData
|
// Watch for new/changed/deleted ThirdPartyResourceData
|
||||||
WatchThirdPartyResourceData(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
WatchThirdPartyResourceData(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||||
// Get a specific ThirdPartyResourceData
|
// Get a specific ThirdPartyResourceData
|
||||||
GetThirdPartyResourceData(ctx api.Context, name string) (*experimental.ThirdPartyResourceData, error)
|
GetThirdPartyResourceData(ctx api.Context, name string) (*extensions.ThirdPartyResourceData, error)
|
||||||
// Create a ThirdPartyResourceData based on a specification.
|
// Create a ThirdPartyResourceData based on a specification.
|
||||||
CreateThirdPartyResourceData(ctx api.Context, resource *experimental.ThirdPartyResourceData) (*experimental.ThirdPartyResourceData, error)
|
CreateThirdPartyResourceData(ctx api.Context, resource *extensions.ThirdPartyResourceData) (*extensions.ThirdPartyResourceData, error)
|
||||||
// Update an existing ThirdPartyResourceData
|
// Update an existing ThirdPartyResourceData
|
||||||
UpdateThirdPartyResourceData(ctx api.Context, resource *experimental.ThirdPartyResourceData) (*experimental.ThirdPartyResourceData, error)
|
UpdateThirdPartyResourceData(ctx api.Context, resource *extensions.ThirdPartyResourceData) (*extensions.ThirdPartyResourceData, error)
|
||||||
// Delete an existing ThirdPartyResourceData
|
// Delete an existing ThirdPartyResourceData
|
||||||
DeleteThirdPartyResourceData(ctx api.Context, name string) error
|
DeleteThirdPartyResourceData(ctx api.Context, name string) error
|
||||||
}
|
}
|
||||||
@ -52,34 +52,34 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
|||||||
return &storage{s}
|
return &storage{s}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) ListThirdPartyResourceData(ctx api.Context, label labels.Selector) (*experimental.ThirdPartyResourceDataList, error) {
|
func (s *storage) ListThirdPartyResourceData(ctx api.Context, label labels.Selector) (*extensions.ThirdPartyResourceDataList, error) {
|
||||||
obj, err := s.List(ctx, label, fields.Everything())
|
obj, err := s.List(ctx, label, fields.Everything())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.ThirdPartyResourceDataList), nil
|
return obj.(*extensions.ThirdPartyResourceDataList), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) WatchThirdPartyResourceData(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
|
func (s *storage) WatchThirdPartyResourceData(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
|
||||||
return s.Watch(ctx, label, field, resourceVersion)
|
return s.Watch(ctx, label, field, resourceVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) GetThirdPartyResourceData(ctx api.Context, name string) (*experimental.ThirdPartyResourceData, error) {
|
func (s *storage) GetThirdPartyResourceData(ctx api.Context, name string) (*extensions.ThirdPartyResourceData, error) {
|
||||||
obj, err := s.Get(ctx, name)
|
obj, err := s.Get(ctx, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return obj.(*experimental.ThirdPartyResourceData), nil
|
return obj.(*extensions.ThirdPartyResourceData), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) CreateThirdPartyResourceData(ctx api.Context, ThirdPartyResourceData *experimental.ThirdPartyResourceData) (*experimental.ThirdPartyResourceData, error) {
|
func (s *storage) CreateThirdPartyResourceData(ctx api.Context, ThirdPartyResourceData *extensions.ThirdPartyResourceData) (*extensions.ThirdPartyResourceData, error) {
|
||||||
obj, err := s.Create(ctx, ThirdPartyResourceData)
|
obj, err := s.Create(ctx, ThirdPartyResourceData)
|
||||||
return obj.(*experimental.ThirdPartyResourceData), err
|
return obj.(*extensions.ThirdPartyResourceData), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) UpdateThirdPartyResourceData(ctx api.Context, ThirdPartyResourceData *experimental.ThirdPartyResourceData) (*experimental.ThirdPartyResourceData, error) {
|
func (s *storage) UpdateThirdPartyResourceData(ctx api.Context, ThirdPartyResourceData *extensions.ThirdPartyResourceData) (*extensions.ThirdPartyResourceData, error) {
|
||||||
obj, _, err := s.Update(ctx, ThirdPartyResourceData)
|
obj, _, err := s.Update(ctx, ThirdPartyResourceData)
|
||||||
return obj.(*experimental.ThirdPartyResourceData), err
|
return obj.(*extensions.ThirdPartyResourceData), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) DeleteThirdPartyResourceData(ctx api.Context, name string) error {
|
func (s *storage) DeleteThirdPartyResourceData(ctx api.Context, name string) error {
|
||||||
|
@ -52,7 +52,7 @@ func (strategy) PrepareForCreate(obj runtime.Object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (strategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
func (strategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
|
||||||
return validation.ValidateThirdPartyResourceData(obj.(*experimental.ThirdPartyResourceData))
|
return validation.ValidateThirdPartyResourceData(obj.(*extensions.ThirdPartyResourceData))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (strategy) AllowCreateOnUpdate() bool {
|
func (strategy) AllowCreateOnUpdate() bool {
|
||||||
@ -63,7 +63,7 @@ func (strategy) PrepareForUpdate(obj, old runtime.Object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (strategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
func (strategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
|
||||||
return validation.ValidateThirdPartyResourceDataUpdate(old.(*experimental.ThirdPartyResourceData), obj.(*experimental.ThirdPartyResourceData))
|
return validation.ValidateThirdPartyResourceDataUpdate(old.(*extensions.ThirdPartyResourceData), obj.(*extensions.ThirdPartyResourceData))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (strategy) AllowUnconditionalUpdate() bool {
|
func (strategy) AllowUnconditionalUpdate() bool {
|
||||||
@ -73,7 +73,7 @@ func (strategy) AllowUnconditionalUpdate() bool {
|
|||||||
// Matcher returns a generic matcher for a given label and field selector.
|
// Matcher returns a generic matcher for a given label and field selector.
|
||||||
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
|
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||||
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
|
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
|
||||||
sa, ok := obj.(*experimental.ThirdPartyResourceData)
|
sa, ok := obj.(*extensions.ThirdPartyResourceData)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false, fmt.Errorf("not a ThirdPartyResourceData")
|
return false, fmt.Errorf("not a ThirdPartyResourceData")
|
||||||
}
|
}
|
||||||
@ -83,6 +83,6 @@ func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SelectableFields returns a label set that can be used for filter selection
|
// SelectableFields returns a label set that can be used for filter selection
|
||||||
func SelectableFields(obj *experimental.ThirdPartyResourceData) labels.Set {
|
func SelectableFields(obj *extensions.ThirdPartyResourceData) labels.Set {
|
||||||
return labels.Set{}
|
return labels.Set{}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ func convertToCamelCase(input string) string {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExtractApiGroupAndKind(rsrc *experimental.ThirdPartyResource) (kind string, group string, err error) {
|
func ExtractApiGroupAndKind(rsrc *extensions.ThirdPartyResource) (kind string, group string, err error) {
|
||||||
parts := strings.Split(rsrc.Name, ".")
|
parts := strings.Split(rsrc.Name, ".")
|
||||||
if len(parts) < 3 {
|
if len(parts) < 3 {
|
||||||
return "", "", fmt.Errorf("unexpectedly short resource name: %s, expected at least <kind>.<domain>.<tld>", rsrc.Name)
|
return "", "", fmt.Errorf("unexpectedly short resource name: %s, expected at least <kind>.<domain>.<tld>", rsrc.Name)
|
||||||
|
@ -47,7 +47,7 @@ func TestExtractAPIGroupAndKind(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
kind, group, err := ExtractApiGroupAndKind(&experimental.ThirdPartyResource{ObjectMeta: api.ObjectMeta{Name: test.input}})
|
kind, group, err := ExtractApiGroupAndKind(&extensions.ThirdPartyResource{ObjectMeta: api.ObjectMeta{Name: test.input}})
|
||||||
if err != nil && !test.expectErr {
|
if err != nil && !test.expectErr {
|
||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
continue
|
continue
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Returns the old RCs targetted by the given Deployment.
|
// Returns the old RCs targetted by the given Deployment.
|
||||||
func GetOldRCs(deployment experimental.Deployment, c client.Interface) ([]*api.ReplicationController, error) {
|
func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.ReplicationController, error) {
|
||||||
namespace := deployment.ObjectMeta.Namespace
|
namespace := deployment.ObjectMeta.Namespace
|
||||||
// 1. Find all pods whose labels match deployment.Spec.Selector
|
// 1. Find all pods whose labels match deployment.Spec.Selector
|
||||||
podList, err := c.Pods(namespace).List(labels.SelectorFromSet(deployment.Spec.Selector), fields.Everything())
|
podList, err := c.Pods(namespace).List(labels.SelectorFromSet(deployment.Spec.Selector), fields.Everything())
|
||||||
@ -65,7 +65,7 @@ func GetOldRCs(deployment experimental.Deployment, c client.Interface) ([]*api.R
|
|||||||
|
|
||||||
// Returns an RC that matches the intent of the given deployment.
|
// Returns an RC that matches the intent of the given deployment.
|
||||||
// Returns nil if the new RC doesnt exist yet.
|
// Returns nil if the new RC doesnt exist yet.
|
||||||
func GetNewRC(deployment experimental.Deployment, c client.Interface) (*api.ReplicationController, error) {
|
func GetNewRC(deployment extensions.Deployment, c client.Interface) (*api.ReplicationController, error) {
|
||||||
namespace := deployment.ObjectMeta.Namespace
|
namespace := deployment.ObjectMeta.Namespace
|
||||||
rcList, err := c.ReplicationControllers(namespace).List(labels.Everything())
|
rcList, err := c.ReplicationControllers(namespace).List(labels.Everything())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -84,7 +84,7 @@ func GetNewRC(deployment experimental.Deployment, c client.Interface) (*api.Repl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the desired PodTemplateSpec for the new RC corresponding to the given RC.
|
// Returns the desired PodTemplateSpec for the new RC corresponding to the given RC.
|
||||||
func GetNewRCTemplate(deployment experimental.Deployment) *api.PodTemplateSpec {
|
func GetNewRCTemplate(deployment extensions.Deployment) *api.PodTemplateSpec {
|
||||||
// newRC will have the same template as in deployment spec, plus a unique label in some cases.
|
// newRC will have the same template as in deployment spec, plus a unique label in some cases.
|
||||||
newRCTemplate := &api.PodTemplateSpec{
|
newRCTemplate := &api.PodTemplateSpec{
|
||||||
ObjectMeta: deployment.Spec.Template.ObjectMeta,
|
ObjectMeta: deployment.Spec.Template.ObjectMeta,
|
||||||
|
@ -74,11 +74,11 @@ var _ = Describe("Daemon set", func() {
|
|||||||
label := map[string]string{daemonsetNameLabel: dsName}
|
label := map[string]string{daemonsetNameLabel: dsName}
|
||||||
|
|
||||||
Logf("Creating simple daemon set %s", dsName)
|
Logf("Creating simple daemon set %s", dsName)
|
||||||
_, err := c.DaemonSets(ns).Create(&experimental.DaemonSet{
|
_, err := c.DaemonSets(ns).Create(&extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: dsName,
|
Name: dsName,
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Labels: label,
|
Labels: label,
|
||||||
@ -129,11 +129,11 @@ var _ = Describe("Daemon set", func() {
|
|||||||
complexLabel := map[string]string{daemonsetNameLabel: dsName}
|
complexLabel := map[string]string{daemonsetNameLabel: dsName}
|
||||||
nodeSelector := map[string]string{daemonsetColorLabel: "blue"}
|
nodeSelector := map[string]string{daemonsetColorLabel: "blue"}
|
||||||
Logf("Creating daemon with a node selector %s", dsName)
|
Logf("Creating daemon with a node selector %s", dsName)
|
||||||
_, err := c.DaemonSets(ns).Create(&experimental.DaemonSet{
|
_, err := c.DaemonSets(ns).Create(&extensions.DaemonSet{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: dsName,
|
Name: dsName,
|
||||||
},
|
},
|
||||||
Spec: experimental.DaemonSetSpec{
|
Spec: extensions.DaemonSetSpec{
|
||||||
Selector: complexLabel,
|
Selector: complexLabel,
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
@ -46,11 +46,11 @@ func testNewDeployment(f *Framework) {
|
|||||||
deploymentName := "nginx-deployment"
|
deploymentName := "nginx-deployment"
|
||||||
podLabels := map[string]string{"name": "nginx"}
|
podLabels := map[string]string{"name": "nginx"}
|
||||||
Logf("Creating simple deployment %s", deploymentName)
|
Logf("Creating simple deployment %s", deploymentName)
|
||||||
_, err := c.Deployments(ns).Create(&experimental.Deployment{
|
_, err := c.Deployments(ns).Create(&extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: deploymentName,
|
Name: deploymentName,
|
||||||
},
|
},
|
||||||
Spec: experimental.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Replicas: 1,
|
Replicas: 1,
|
||||||
Selector: podLabels,
|
Selector: podLabels,
|
||||||
UniqueLabelKey: "deployment.kubernetes.io/podTemplateHash",
|
UniqueLabelKey: "deployment.kubernetes.io/podTemplateHash",
|
||||||
@ -139,11 +139,11 @@ func testRollingUpdateDeployment(f *Framework) {
|
|||||||
// Create a deployment to delete nginx pods and instead bring up redis pods.
|
// Create a deployment to delete nginx pods and instead bring up redis pods.
|
||||||
deploymentName := "redis-deployment"
|
deploymentName := "redis-deployment"
|
||||||
Logf("Creating deployment %s", deploymentName)
|
Logf("Creating deployment %s", deploymentName)
|
||||||
newDeployment := experimental.Deployment{
|
newDeployment := extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: deploymentName,
|
Name: deploymentName,
|
||||||
},
|
},
|
||||||
Spec: experimental.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Replicas: 3,
|
Replicas: 3,
|
||||||
Selector: deploymentPodLabels,
|
Selector: deploymentPodLabels,
|
||||||
UniqueLabelKey: "deployment.kubernetes.io/podTemplateHash",
|
UniqueLabelKey: "deployment.kubernetes.io/podTemplateHash",
|
||||||
@ -220,11 +220,11 @@ func testRollingUpdateDeploymentEvents(f *Framework) {
|
|||||||
// Create a deployment to delete nginx pods and instead bring up redis pods.
|
// Create a deployment to delete nginx pods and instead bring up redis pods.
|
||||||
deploymentName := "redis-deployment"
|
deploymentName := "redis-deployment"
|
||||||
Logf("Creating deployment %s", deploymentName)
|
Logf("Creating deployment %s", deploymentName)
|
||||||
newDeployment := experimental.Deployment{
|
newDeployment := extensions.Deployment{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: deploymentName,
|
Name: deploymentName,
|
||||||
},
|
},
|
||||||
Spec: experimental.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Replicas: 1,
|
Replicas: 1,
|
||||||
Selector: deploymentPodLabels,
|
Selector: deploymentPodLabels,
|
||||||
UniqueLabelKey: "deployment.kubernetes.io/podTemplateHash",
|
UniqueLabelKey: "deployment.kubernetes.io/podTemplateHash",
|
||||||
|
@ -152,13 +152,13 @@ var _ = Describe("Horizontal pod autoscaling", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) {
|
func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) {
|
||||||
hpa := &experimental.HorizontalPodAutoscaler{
|
hpa := &extensions.HorizontalPodAutoscaler{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: rc.name,
|
Name: rc.name,
|
||||||
Namespace: rc.framework.Namespace.Name,
|
Namespace: rc.framework.Namespace.Name,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: rc.name,
|
Name: rc.name,
|
||||||
Namespace: rc.framework.Namespace.Name,
|
Namespace: rc.framework.Namespace.Name,
|
||||||
@ -166,7 +166,7 @@ func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) {
|
|||||||
},
|
},
|
||||||
MinReplicas: 1,
|
MinReplicas: 1,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse(cpu)},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse(cpu)},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_, errHPA := rc.framework.Client.Experimental().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa)
|
_, errHPA := rc.framework.Client.Experimental().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa)
|
||||||
@ -175,13 +175,13 @@ func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) {
|
|||||||
|
|
||||||
// argument memory is in megabytes
|
// argument memory is in megabytes
|
||||||
func createMemoryHorizontalPodAutoscaler(rc *ResourceConsumer, memory string) {
|
func createMemoryHorizontalPodAutoscaler(rc *ResourceConsumer, memory string) {
|
||||||
hpa := &experimental.HorizontalPodAutoscaler{
|
hpa := &extensions.HorizontalPodAutoscaler{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: rc.name,
|
Name: rc.name,
|
||||||
Namespace: rc.framework.Namespace.Name,
|
Namespace: rc.framework.Namespace.Name,
|
||||||
},
|
},
|
||||||
Spec: experimental.HorizontalPodAutoscalerSpec{
|
Spec: extensions.HorizontalPodAutoscalerSpec{
|
||||||
ScaleRef: &experimental.SubresourceReference{
|
ScaleRef: &extensions.SubresourceReference{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: rc.name,
|
Name: rc.name,
|
||||||
Namespace: rc.framework.Namespace.Name,
|
Namespace: rc.framework.Namespace.Name,
|
||||||
@ -189,7 +189,7 @@ func createMemoryHorizontalPodAutoscaler(rc *ResourceConsumer, memory string) {
|
|||||||
},
|
},
|
||||||
MinReplicas: 1,
|
MinReplicas: 1,
|
||||||
MaxReplicas: 5,
|
MaxReplicas: 5,
|
||||||
Target: experimental.ResourceConsumption{Resource: api.ResourceMemory, Quantity: resource.MustParse(memory + "M")},
|
Target: extensions.ResourceConsumption{Resource: api.ResourceMemory, Quantity: resource.MustParse(memory + "M")},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_, errHPA := rc.framework.Client.Experimental().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa)
|
_, errHPA := rc.framework.Client.Experimental().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa)
|
||||||
|
@ -183,12 +183,12 @@ var _ = Describe("Job", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// newTestJob returns a job which does one of several testing behaviors.
|
// newTestJob returns a job which does one of several testing behaviors.
|
||||||
func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, completions int) *experimental.Job {
|
func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, completions int) *extensions.Job {
|
||||||
job := &experimental.Job{
|
job := &extensions.Job{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
},
|
},
|
||||||
Spec: experimental.JobSpec{
|
Spec: extensions.JobSpec{
|
||||||
Parallelism: ¶llelism,
|
Parallelism: ¶llelism,
|
||||||
Completions: &completions,
|
Completions: &completions,
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &api.PodTemplateSpec{
|
||||||
@ -223,7 +223,7 @@ func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, comp
|
|||||||
return job
|
return job
|
||||||
}
|
}
|
||||||
|
|
||||||
func createJob(c *client.Client, ns string, job *experimental.Job) (*experimental.Job, error) {
|
func createJob(c *client.Client, ns string, job *extensions.Job) (*extensions.Job, error) {
|
||||||
return c.Experimental().Jobs(ns).Create(job)
|
return c.Experimental().Jobs(ns).Create(job)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user