experimental. -> extensions.

This commit is contained in:
Chao Xu 2015-10-09 15:49:10 -07:00
parent 2816eb0f8a
commit 7c9f4cc42f
81 changed files with 839 additions and 839 deletions

View File

@ -98,7 +98,7 @@ func (s *ProxyServerConfig) AddFlags(fs *pflag.FlagSet) {
const (
proxyModeUserspace = "userspace"
proxyModeIptables = "iptables"
experimentalProxyModeAnnotation = "net.experimental.kubernetes.io/proxy-mode"
experimentalProxyModeAnnotation = "net.extensions.kubernetes.io/proxy-mode"
)
func checkKnownProxyMode(proxyMode string) bool {

View File

@ -40,15 +40,15 @@ func Test_mayTryIptablesProxy(t *testing.T) {
{"userspace", "", "", false},
{"iptables", "", "", true},
{"", "", "", false},
{"", "net.experimental.kubernetes.io/proxy-mode", "userspace", false},
{"", "net.experimental.kubernetes.io/proxy-mode", "iptables", true},
{"", "net.experimental.kubernetes.io/proxy-mode", "other", false},
{"", "net.experimental.kubernetes.io/proxy-mode", "", false},
{"", "net.extensions.kubernetes.io/proxy-mode", "userspace", false},
{"", "net.extensions.kubernetes.io/proxy-mode", "iptables", true},
{"", "net.extensions.kubernetes.io/proxy-mode", "other", false},
{"", "net.extensions.kubernetes.io/proxy-mode", "", false},
{"", "proxy-mode", "iptables", false},
{"userspace", "net.experimental.kubernetes.io/proxy-mode", "userspace", false},
{"userspace", "net.experimental.kubernetes.io/proxy-mode", "iptables", false},
{"iptables", "net.experimental.kubernetes.io/proxy-mode", "userspace", true},
{"iptables", "net.experimental.kubernetes.io/proxy-mode", "iptables", true},
{"userspace", "net.extensions.kubernetes.io/proxy-mode", "userspace", false},
{"userspace", "net.extensions.kubernetes.io/proxy-mode", "iptables", false},
{"iptables", "net.extensions.kubernetes.io/proxy-mode", "userspace", true},
{"iptables", "net.extensions.kubernetes.io/proxy-mode", "iptables", true},
}
for i, c := range cases {
getter := &fakeNodeInterface{}

View File

@ -101,17 +101,17 @@ func validateObject(obj runtime.Object) (errors []error) {
t.Namespace = api.NamespaceDefault
}
errors = validation.ValidateResourceQuota(t)
case *experimental.Deployment:
case *extensions.Deployment:
if t.Namespace == "" {
t.Namespace = api.NamespaceDefault
}
errors = expValidation.ValidateDeployment(t)
case *experimental.Job:
case *extensions.Job:
if t.Namespace == "" {
t.Namespace = api.NamespaceDefault
}
errors = expValidation.ValidateJob(t)
case *experimental.DaemonSet:
case *extensions.DaemonSet:
if t.Namespace == "" {
t.Namespace = api.NamespaceDefault
}
@ -221,10 +221,10 @@ func TestExampleObjectSchemas(t *testing.T) {
"multi-pod": nil,
"pod": &api.Pod{},
"replication": &api.ReplicationController{},
"job": &experimental.Job{},
"job": &extensions.Job{},
},
"../docs/admin": {
"daemon": &experimental.DaemonSet{},
"daemon": &extensions.DaemonSet{},
},
"../examples": {
"scheduler-policy-config": &schedulerapi.Policy{},
@ -364,7 +364,7 @@ func TestExampleObjectSchemas(t *testing.T) {
"fc": &api.Pod{},
},
"../examples/experimental": {
"deployment": &experimental.Deployment{},
"deployment": &extensions.Deployment{},
},
"../examples/javaweb-tomcat-sidecar": {
"javaweb": &api.Pod{},

View File

@ -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
//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
// 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))]
if j.Type != experimental.RollingUpdateDeploymentStrategyType {
if j.Type != extensions.RollingUpdateDeploymentStrategyType {
j.RollingUpdate = nil
} else {
rollingUpdate := experimental.RollingUpdateDeployment{}
rollingUpdate := extensions.RollingUpdateDeployment{}
if c.RandBool() {
rollingUpdate.MaxUnavailable = 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
}
},
func(j *experimental.JobSpec, c fuzz.Continue) {
func(j *extensions.JobSpec, c fuzz.Continue) {
c.FuzzNoCustom(j) // fuzz self without calling this function again
completions := 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)
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
// string, which will cause tests failure.
s.APIGroup = "something"

View File

@ -27,7 +27,7 @@ import (
)
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)
if err != nil {
t.Fatalf("unexpected error: %v", err)
@ -36,7 +36,7 @@ func TestResourceVersioner(t *testing.T) {
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)
if err != nil {
t.Fatalf("unexpected error: %v", err)
@ -47,14 +47,14 @@ func TestResourceVersioner(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
// want to test if the package install and package latest work as expected.
data, err := latest.GroupOrDie("extensions").Codec.Encode(&daemonSet)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
other := experimental.DaemonSet{}
other := extensions.DaemonSet{}
if err := json.Unmarshal(data, &other); err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -101,7 +101,7 @@ func TestRESTMapper(t *testing.T) {
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)
if err != nil {
t.Errorf("unexpected error: %v", err)

View File

@ -51,7 +51,7 @@ func ValidateHorizontalPodAutoscalerName(name string, prefix bool) (bool, string
return apivalidation.ValidateReplicationControllerName(name, prefix)
}
func validateHorizontalPodAutoscalerSpec(autoscaler experimental.HorizontalPodAutoscalerSpec) errs.ValidationErrorList {
func validateHorizontalPodAutoscalerSpec(autoscaler extensions.HorizontalPodAutoscalerSpec) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if autoscaler.MinReplicas < 0 {
allErrs = append(allErrs, errs.NewFieldInvalid("minReplicas", autoscaler.MinReplicas, isNegativeErrorMsg))
@ -73,25 +73,25 @@ func validateHorizontalPodAutoscalerSpec(autoscaler experimental.HorizontalPodAu
return allErrs
}
func ValidateHorizontalPodAutoscaler(autoscaler *experimental.HorizontalPodAutoscaler) errs.ValidationErrorList {
func ValidateHorizontalPodAutoscaler(autoscaler *extensions.HorizontalPodAutoscaler) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&autoscaler.ObjectMeta, true, ValidateHorizontalPodAutoscalerName).Prefix("metadata")...)
allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(autoscaler.Spec)...)
return allErrs
}
func ValidateHorizontalPodAutoscalerUpdate(newAutoscler, oldAutoscaler *experimental.HorizontalPodAutoscaler) errs.ValidationErrorList {
func ValidateHorizontalPodAutoscalerUpdate(newAutoscler, oldAutoscaler *extensions.HorizontalPodAutoscaler) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&newAutoscler.ObjectMeta, &oldAutoscaler.ObjectMeta).Prefix("metadata")...)
allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(newAutoscler.Spec)...)
return allErrs
}
func ValidateThirdPartyResourceUpdate(old, update *experimental.ThirdPartyResource) errs.ValidationErrorList {
func ValidateThirdPartyResourceUpdate(old, update *extensions.ThirdPartyResource) errs.ValidationErrorList {
return ValidateThirdPartyResource(update)
}
func ValidateThirdPartyResource(obj *experimental.ThirdPartyResource) errs.ValidationErrorList {
func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if len(obj.Name) == 0 {
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.
func ValidateDaemonSet(controller *experimental.DaemonSet) errs.ValidationErrorList {
func ValidateDaemonSet(controller *extensions.DaemonSet) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&controller.ObjectMeta, true, apivalidation.ValidateReplicationControllerName).Prefix("metadata")...)
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.
func ValidateDaemonSetUpdate(oldController, controller *experimental.DaemonSet) errs.ValidationErrorList {
func ValidateDaemonSetUpdate(oldController, controller *extensions.DaemonSet) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...)
allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec).Prefix("spec")...)
@ -128,7 +128,7 @@ func ValidateDaemonSetUpdate(oldController, controller *experimental.DaemonSet)
}
// validateDaemonSetStatus validates a DaemonSetStatus
func validateDaemonSetStatus(status *experimental.DaemonSetStatus) errs.ValidationErrorList {
func validateDaemonSetStatus(status *extensions.DaemonSetStatus) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.CurrentNumberScheduled), "currentNumberScheduled")...)
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
func ValidateDaemonSetStatusUpdate(controller, oldController *experimental.DaemonSet) errs.ValidationErrorList {
func ValidateDaemonSetStatusUpdate(controller, oldController *extensions.DaemonSet) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...)
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.
func ValidateDaemonSetSpec(spec *experimental.DaemonSetSpec) errs.ValidationErrorList {
func ValidateDaemonSetSpec(spec *extensions.DaemonSetSpec) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
selector := labels.Set(spec.Selector).AsSelector()
@ -237,7 +237,7 @@ func IsNotMoreThan100Percent(intOrStringValue util.IntOrString, fieldName string
return allErrs
}
func ValidateRollingUpdateDeployment(rollingUpdate *experimental.RollingUpdateDeployment, fieldName string) errs.ValidationErrorList {
func ValidateRollingUpdateDeployment(rollingUpdate *extensions.RollingUpdateDeployment, fieldName string) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxUnavailable, fieldName+"maxUnavailable")...)
allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxSurge, fieldName+".maxSurge")...)
@ -251,22 +251,22 @@ func ValidateRollingUpdateDeployment(rollingUpdate *experimental.RollingUpdateDe
return allErrs
}
func ValidateDeploymentStrategy(strategy *experimental.DeploymentStrategy, fieldName string) errs.ValidationErrorList {
func ValidateDeploymentStrategy(strategy *extensions.DeploymentStrategy, fieldName string) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if strategy.RollingUpdate == nil {
return allErrs
}
switch strategy.Type {
case experimental.RecreateDeploymentStrategyType:
allErrs = append(allErrs, errs.NewFieldForbidden("rollingUpdate", "rollingUpdate should be nil when strategy type is "+experimental.RecreateDeploymentStrategyType))
case experimental.RollingUpdateDeploymentStrategyType:
case extensions.RecreateDeploymentStrategyType:
allErrs = append(allErrs, errs.NewFieldForbidden("rollingUpdate", "rollingUpdate should be nil when strategy type is "+extensions.RecreateDeploymentStrategyType))
case extensions.RollingUpdateDeploymentStrategyType:
allErrs = append(allErrs, ValidateRollingUpdateDeployment(strategy.RollingUpdate, "rollingUpdate")...)
}
return allErrs
}
// Validates given deployment spec.
func ValidateDeploymentSpec(spec *experimental.DeploymentSpec) errs.ValidationErrorList {
func ValidateDeploymentSpec(spec *extensions.DeploymentSpec) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateNonEmptySelector(spec.Selector, "selector")...)
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(spec.Replicas), "replicas")...)
@ -276,25 +276,25 @@ func ValidateDeploymentSpec(spec *experimental.DeploymentSpec) errs.ValidationEr
return allErrs
}
func ValidateDeploymentUpdate(old, update *experimental.Deployment) errs.ValidationErrorList {
func ValidateDeploymentUpdate(old, update *extensions.Deployment) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta).Prefix("metadata")...)
allErrs = append(allErrs, ValidateDeploymentSpec(&update.Spec).Prefix("spec")...)
return allErrs
}
func ValidateDeployment(obj *experimental.Deployment) errs.ValidationErrorList {
func ValidateDeployment(obj *extensions.Deployment) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, true, ValidateDeploymentName).Prefix("metadata")...)
allErrs = append(allErrs, ValidateDeploymentSpec(&obj.Spec).Prefix("spec")...)
return allErrs
}
func ValidateThirdPartyResourceDataUpdate(old, update *experimental.ThirdPartyResourceData) errs.ValidationErrorList {
func ValidateThirdPartyResourceDataUpdate(old, update *extensions.ThirdPartyResourceData) errs.ValidationErrorList {
return ValidateThirdPartyResourceData(update)
}
func ValidateThirdPartyResourceData(obj *experimental.ThirdPartyResourceData) errs.ValidationErrorList {
func ValidateThirdPartyResourceData(obj *extensions.ThirdPartyResourceData) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if len(obj.Name) == 0 {
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
}
func ValidateJob(job *experimental.Job) errs.ValidationErrorList {
func ValidateJob(job *extensions.Job) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
// Jobs and rcs have the same name validation
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
}
func ValidateJobSpec(spec *experimental.JobSpec) errs.ValidationErrorList {
func ValidateJobSpec(spec *extensions.JobSpec) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if spec.Parallelism != nil && *spec.Parallelism < 0 {
@ -342,7 +342,7 @@ func ValidateJobSpec(spec *experimental.JobSpec) errs.ValidationErrorList {
return allErrs
}
func ValidateJobStatus(status *experimental.JobStatus) errs.ValidationErrorList {
func ValidateJobStatus(status *extensions.JobStatus) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Active), "active")...)
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Succeeded), "succeeded")...)
@ -350,21 +350,21 @@ func ValidateJobStatus(status *experimental.JobStatus) errs.ValidationErrorList
return allErrs
}
func ValidateJobUpdate(oldJob, job *experimental.Job) errs.ValidationErrorList {
func ValidateJobUpdate(oldJob, job *extensions.Job) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta).Prefix("metadata")...)
allErrs = append(allErrs, ValidateJobSpecUpdate(oldJob.Spec, job.Spec).Prefix("spec")...)
return allErrs
}
func ValidateJobUpdateStatus(oldJob, job *experimental.Job) errs.ValidationErrorList {
func ValidateJobUpdateStatus(oldJob, job *extensions.Job) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta).Prefix("metadata")...)
allErrs = append(allErrs, ValidateJobStatusUpdate(oldJob.Status, job.Status).Prefix("status")...)
return allErrs
}
func ValidateJobSpecUpdate(oldSpec, spec experimental.JobSpec) errs.ValidationErrorList {
func ValidateJobSpecUpdate(oldSpec, spec extensions.JobSpec) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, ValidateJobSpec(&spec)...)
if !api.Semantic.DeepEqual(oldSpec.Completions, spec.Completions) {
@ -379,14 +379,14 @@ func ValidateJobSpecUpdate(oldSpec, spec experimental.JobSpec) errs.ValidationEr
return allErrs
}
func ValidateJobStatusUpdate(oldStatus, status experimental.JobStatus) errs.ValidationErrorList {
func ValidateJobStatusUpdate(oldStatus, status extensions.JobStatus) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, ValidateJobStatus(&status)...)
return allErrs
}
// 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 = append(allErrs, apivalidation.ValidateObjectMeta(&ingress.ObjectMeta, true, ValidateIngressName).Prefix("metadata")...)
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.
func ValidateIngressSpec(spec *experimental.IngressSpec) errs.ValidationErrorList {
func ValidateIngressSpec(spec *extensions.IngressSpec) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
// TODO: Is a default backend mandatory?
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.
func ValidateIngressUpdate(oldIngress, ingress *experimental.Ingress) errs.ValidationErrorList {
func ValidateIngressUpdate(oldIngress, ingress *extensions.Ingress) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&ingress.ObjectMeta, &oldIngress.ObjectMeta).Prefix("metadata")...)
allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec).Prefix("spec")...)
return allErrs
}
func validateIngressRules(IngressRules []experimental.IngressRule) errs.ValidationErrorList {
func validateIngressRules(IngressRules []extensions.IngressRule) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if len(IngressRules) == 0 {
return append(allErrs, errs.NewFieldRequired("IngressRules"))
@ -442,7 +442,7 @@ func validateIngressRules(IngressRules []experimental.IngressRule) errs.Validati
return allErrs
}
func validateIngressRuleValue(ingressRule *experimental.IngressRuleValue) errs.ValidationErrorList {
func validateIngressRuleValue(ingressRule *extensions.IngressRuleValue) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if ingressRule.HTTP != nil {
allErrs = append(allErrs, validateHTTPIngressRuleValue(ingressRule.HTTP).Prefix("http")...)
@ -450,7 +450,7 @@ func validateIngressRuleValue(ingressRule *experimental.IngressRuleValue) errs.V
return allErrs
}
func validateHTTPIngressRuleValue(httpIngressRuleValue *experimental.HTTPIngressRuleValue) errs.ValidationErrorList {
func validateHTTPIngressRuleValue(httpIngressRuleValue *extensions.HTTPIngressRuleValue) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if len(httpIngressRuleValue.Paths) == 0 {
allErrs = append(allErrs, errs.NewFieldRequired("paths"))
@ -480,7 +480,7 @@ func validateHTTPIngressRuleValue(httpIngressRuleValue *experimental.HTTPIngress
}
// 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{}
// 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
}
func validateClusterAutoscalerSpec(spec experimental.ClusterAutoscalerSpec) errs.ValidationErrorList {
func validateClusterAutoscalerSpec(spec extensions.ClusterAutoscalerSpec) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if spec.MinNodes < 0 {
allErrs = append(allErrs, errs.NewFieldInvalid("minNodes", spec.MinNodes, `must be non-negative`))
@ -527,7 +527,7 @@ func validateClusterAutoscalerSpec(spec experimental.ClusterAutoscalerSpec) errs
return allErrs
}
func ValidateClusterAutoscaler(autoscaler *experimental.ClusterAutoscaler) errs.ValidationErrorList {
func ValidateClusterAutoscaler(autoscaler *extensions.ClusterAutoscaler) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if autoscaler.Name != "ClusterAutoscaler" {
allErrs = append(allErrs, errs.NewFieldInvalid("name", autoscaler.Name, `name must be ClusterAutoscaler`))

View File

@ -29,19 +29,19 @@ import (
)
func TestValidateHorizontalPodAutoscaler(t *testing.T) {
successCases := []experimental.HorizontalPodAutoscaler{
successCases := []extensions.HorizontalPodAutoscaler{
{
ObjectMeta: api.ObjectMeta{
Name: "myautoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Subresource: "scale",
},
MinReplicas: 1,
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": {
ObjectMeta: api.ObjectMeta{
Name: "myautoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Subresource: "scale",
},
MinReplicas: -1,
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": {
@ -71,13 +71,13 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myautoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Subresource: "scale",
},
MinReplicas: 7,
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": {
@ -85,13 +85,13 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myautoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Subresource: "scale",
},
MinReplicas: 1,
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": {
@ -99,13 +99,13 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myautoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Subresource: "scale",
},
MinReplicas: 1,
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": {
@ -113,10 +113,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myautoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
Spec: extensions.HorizontalPodAutoscalerSpec{
MinReplicas: 1,
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) {
type dsUpdateTest struct {
old experimental.DaemonSet
update experimental.DaemonSet
old extensions.DaemonSet
update extensions.DaemonSet
}
successCases := []dsUpdateTest{
{
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Status: experimental.DaemonSetStatus{
Status: extensions.DaemonSetStatus{
CurrentNumberScheduled: 1,
NumberMisscheduled: 2,
DesiredNumberScheduled: 3,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Status: experimental.DaemonSetStatus{
Status: extensions.DaemonSetStatus{
CurrentNumberScheduled: 1,
NumberMisscheduled: 1,
DesiredNumberScheduled: 3,
@ -168,17 +168,17 @@ func TestValidateDaemonSetStatusUpdate(t *testing.T) {
errorCases := map[string]dsUpdateTest{
"negative values": {
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Status: experimental.DaemonSetStatus{
Status: extensions.DaemonSetStatus{
CurrentNumberScheduled: 1,
NumberMisscheduled: 2,
DesiredNumberScheduled: 3,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Status: experimental.DaemonSetStatus{
Status: extensions.DaemonSetStatus{
CurrentNumberScheduled: -1,
NumberMisscheduled: -1,
DesiredNumberScheduled: -3,
@ -277,53 +277,53 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
}
type dsUpdateTest struct {
old experimental.DaemonSet
update experimental.DaemonSet
old extensions.DaemonSet
update extensions.DaemonSet
}
successCases := []dsUpdateTest{
{
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
},
{
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector2,
Template: &validPodTemplateAbc2.Template,
},
},
},
{
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateNodeSelector.Template,
},
@ -339,80 +339,80 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
}
errorCases := map[string]dsUpdateTest{
"change daemon name": {
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
},
"invalid selector": {
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: invalidSelector,
Template: &validPodTemplateAbc.Template,
},
},
},
"invalid pod": {
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &invalidPodTemplate.Template,
},
},
},
"change container image": {
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateDef.Template,
},
},
},
"read-write volume": {
old: experimental.DaemonSet{
old: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplateAbc.Template,
},
},
update: experimental.DaemonSet{
update: extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
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},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplate.Template,
},
},
{
ObjectMeta: api.ObjectMeta{Name: "abc-123", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
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": {
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplate.Template,
},
},
"missing-namespace": {
ObjectMeta: api.ObjectMeta{Name: "abc-123"},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplate.Template,
},
},
"empty selector": {
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Template: &validPodTemplate.Template,
},
},
"selector_doesnt_match": {
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: map[string]string{"foo": "bar"},
Template: &validPodTemplate.Template,
},
},
"invalid manifest": {
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
},
},
@ -516,7 +516,7 @@ func TestValidateDaemonSet(t *testing.T) {
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
},
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplate.Template,
},
@ -529,7 +529,7 @@ func TestValidateDaemonSet(t *testing.T) {
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
},
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Template: &invalidPodTemplate.Template,
},
},
@ -541,7 +541,7 @@ func TestValidateDaemonSet(t *testing.T) {
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
},
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &validPodTemplate.Template,
},
@ -551,7 +551,7 @@ func TestValidateDaemonSet(t *testing.T) {
Name: "abc-123",
Namespace: api.NamespaceDefault,
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &api.PodTemplateSpec{
Spec: api.PodSpec{
@ -570,7 +570,7 @@ func TestValidateDaemonSet(t *testing.T) {
Name: "abc-123",
Namespace: api.NamespaceDefault,
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: validSelector,
Template: &api.PodTemplateSpec{
Spec: api.PodSpec{
@ -607,13 +607,13 @@ func TestValidateDaemonSet(t *testing.T) {
}
}
func validDeployment() *experimental.Deployment {
return &experimental.Deployment{
func validDeployment() *extensions.Deployment {
return &extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: "abc",
Namespace: api.NamespaceDefault,
},
Spec: experimental.DeploymentSpec{
Spec: extensions.DeploymentSpec{
Selector: map[string]string{
"name": "abc",
},
@ -643,7 +643,7 @@ func validDeployment() *experimental.Deployment {
}
func TestValidateDeployment(t *testing.T) {
successCases := []*experimental.Deployment{
successCases := []*extensions.Deployment{
validDeployment(),
}
for _, successCase := range successCases {
@ -652,8 +652,8 @@ func TestValidateDeployment(t *testing.T) {
}
}
errorCases := map[string]*experimental.Deployment{}
errorCases["metadata.name: required value"] = &experimental.Deployment{
errorCases := map[string]*extensions.Deployment{}
errorCases["metadata.name: required value"] = &extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Namespace: api.NamespaceDefault,
},
@ -677,17 +677,17 @@ func TestValidateDeployment(t *testing.T) {
// rollingUpdate should be nil for recreate.
invalidRecreateDeployment := validDeployment()
invalidRecreateDeployment.Spec.Strategy = experimental.DeploymentStrategy{
Type: experimental.RecreateDeploymentStrategyType,
RollingUpdate: &experimental.RollingUpdateDeployment{},
invalidRecreateDeployment.Spec.Strategy = extensions.DeploymentStrategy{
Type: extensions.RecreateDeploymentStrategyType,
RollingUpdate: &extensions.RollingUpdateDeployment{},
}
errorCases["rollingUpdate should be nil when strategy type is Recreate"] = invalidRecreateDeployment
// MaxSurge should be in the form of 20%.
invalidMaxSurgeDeployment := validDeployment()
invalidMaxSurgeDeployment.Spec.Strategy = experimental.DeploymentStrategy{
Type: experimental.RollingUpdateDeploymentStrategyType,
RollingUpdate: &experimental.RollingUpdateDeployment{
invalidMaxSurgeDeployment.Spec.Strategy = extensions.DeploymentStrategy{
Type: extensions.RollingUpdateDeploymentStrategyType,
RollingUpdate: &extensions.RollingUpdateDeployment{
MaxSurge: util.NewIntOrStringFromString("20Percent"),
},
}
@ -695,9 +695,9 @@ func TestValidateDeployment(t *testing.T) {
// MaxSurge and MaxUnavailable cannot both be zero.
invalidRollingUpdateDeployment := validDeployment()
invalidRollingUpdateDeployment.Spec.Strategy = experimental.DeploymentStrategy{
Type: experimental.RollingUpdateDeploymentStrategyType,
RollingUpdate: &experimental.RollingUpdateDeployment{
invalidRollingUpdateDeployment.Spec.Strategy = extensions.DeploymentStrategy{
Type: extensions.RollingUpdateDeploymentStrategyType,
RollingUpdate: &extensions.RollingUpdateDeployment{
MaxSurge: util.NewIntOrStringFromString("0%"),
MaxUnavailable: util.NewIntOrStringFromInt(0),
},
@ -706,9 +706,9 @@ func TestValidateDeployment(t *testing.T) {
// MaxUnavailable should not be more than 100%.
invalidMaxUnavailableDeployment := validDeployment()
invalidMaxUnavailableDeployment.Spec.Strategy = experimental.DeploymentStrategy{
Type: experimental.RollingUpdateDeploymentStrategyType,
RollingUpdate: &experimental.RollingUpdateDeployment{
invalidMaxUnavailableDeployment.Spec.Strategy = extensions.DeploymentStrategy{
Type: extensions.RollingUpdateDeploymentStrategyType,
RollingUpdate: &extensions.RollingUpdateDeployment{
MaxUnavailable: util.NewIntOrStringFromString("110%"),
},
}
@ -736,13 +736,13 @@ func TestValidateJob(t *testing.T) {
Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}},
},
}
successCases := []experimental.Job{
successCases := []extensions.Job{
{
ObjectMeta: api.ObjectMeta{
Name: "myjob",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: validSelector,
Template: &validPodTemplateSpec,
},
@ -754,13 +754,13 @@ func TestValidateJob(t *testing.T) {
}
}
negative := -1
errorCases := map[string]experimental.Job{
errorCases := map[string]extensions.Job{
"spec.parallelism:must be non-negative": {
ObjectMeta: api.ObjectMeta{
Name: "myjob",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &negative,
Selector: validSelector,
Template: &validPodTemplateSpec,
@ -771,7 +771,7 @@ func TestValidateJob(t *testing.T) {
Name: "myjob",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Completions: &negative,
Selector: validSelector,
Template: &validPodTemplateSpec,
@ -782,7 +782,7 @@ func TestValidateJob(t *testing.T) {
Name: "myjob",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: map[string]string{},
Template: &validPodTemplateSpec,
},
@ -792,7 +792,7 @@ func TestValidateJob(t *testing.T) {
Name: "myjob",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: validSelector,
},
},
@ -801,7 +801,7 @@ func TestValidateJob(t *testing.T) {
Name: "myjob",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: validSelector,
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{
@ -820,7 +820,7 @@ func TestValidateJob(t *testing.T) {
Name: "myjob",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: validSelector,
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{
@ -853,28 +853,28 @@ func TestValidateJob(t *testing.T) {
type ingressRules map[string]string
func TestValidateIngress(t *testing.T) {
defaultBackend := experimental.IngressBackend{
defaultBackend := extensions.IngressBackend{
ServiceName: "default-backend",
ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80},
}
newValid := func() experimental.Ingress {
return experimental.Ingress{
newValid := func() extensions.Ingress {
return extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: api.NamespaceDefault,
},
Spec: experimental.IngressSpec{
Backend: &experimental.IngressBackend{
Spec: extensions.IngressSpec{
Backend: &extensions.IngressBackend{
ServiceName: "default-backend",
ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80},
},
Rules: []experimental.IngressRule{
Rules: []extensions.IngressRule{
{
Host: "foo.bar.com",
IngressRuleValue: experimental.IngressRuleValue{
HTTP: &experimental.HTTPIngressRuleValue{
Paths: []experimental.HTTPIngressPath{
IngressRuleValue: extensions.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{
Paths: []extensions.HTTPIngressPath{
{
Path: "/foo",
Backend: defaultBackend,
@ -885,7 +885,7 @@ func TestValidateIngress(t *testing.T) {
},
},
},
Status: experimental.IngressStatus{
Status: extensions.IngressStatus{
LoadBalancer: api.LoadBalancerStatus{
Ingress: []api.LoadBalancerIngress{
{IP: "127.0.0.1"},
@ -899,21 +899,21 @@ func TestValidateIngress(t *testing.T) {
invalidNameBackend := newValid()
invalidNameBackend.Spec.Backend.ServiceName = "defaultBackend"
noPortBackend := newValid()
noPortBackend.Spec.Backend = &experimental.IngressBackend{ServiceName: defaultBackend.ServiceName}
noPortBackend.Spec.Backend = &extensions.IngressBackend{ServiceName: defaultBackend.ServiceName}
noForwardSlashPath := newValid()
noForwardSlashPath.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []experimental.HTTPIngressPath{
noForwardSlashPath.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []extensions.HTTPIngressPath{
{
Path: "invalid",
Backend: defaultBackend,
},
}
noPaths := newValid()
noPaths.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []experimental.HTTPIngressPath{}
noPaths.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []extensions.HTTPIngressPath{}
badHost := newValid()
badHost.Spec.Rules[0].Host = "foobar:80"
badRegexPath := newValid()
badPathExpr := "/invalid["
badRegexPath.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []experimental.HTTPIngressPath{
badRegexPath.Spec.Rules[0].IngressRuleValue.HTTP.Paths = []extensions.HTTPIngressPath{
{
Path: badPathExpr,
Backend: defaultBackend,
@ -926,7 +926,7 @@ func TestValidateIngress(t *testing.T) {
badHostIP.Spec.Rules[0].Host = 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: invalid value": invalidNameBackend,
"spec.backend.servicePort: invalid value": noPortBackend,
@ -952,18 +952,18 @@ func TestValidateIngress(t *testing.T) {
}
func TestValidateClusterAutoscaler(t *testing.T) {
successCases := []experimental.ClusterAutoscaler{
successCases := []extensions.ClusterAutoscaler{
{
ObjectMeta: api.ObjectMeta{
Name: "ClusterAutoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.ClusterAutoscalerSpec{
Spec: extensions.ClusterAutoscalerSpec{
MinNodes: 1,
MaxNodes: 5,
TargetUtilization: []experimental.NodeUtilization{
TargetUtilization: []extensions.NodeUtilization{
{
Resource: experimental.CpuRequest,
Resource: extensions.CpuRequest,
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": {
ObjectMeta: api.ObjectMeta{
Name: "TestClusterAutoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.ClusterAutoscalerSpec{
Spec: extensions.ClusterAutoscalerSpec{
MinNodes: 1,
MaxNodes: 5,
TargetUtilization: []experimental.NodeUtilization{
TargetUtilization: []extensions.NodeUtilization{
{
Resource: experimental.CpuRequest,
Resource: extensions.CpuRequest,
Value: 0.7,
},
},
@ -998,12 +998,12 @@ func TestValidateClusterAutoscaler(t *testing.T) {
Name: "ClusterAutoscaler",
Namespace: "test",
},
Spec: experimental.ClusterAutoscalerSpec{
Spec: extensions.ClusterAutoscalerSpec{
MinNodes: 1,
MaxNodes: 5,
TargetUtilization: []experimental.NodeUtilization{
TargetUtilization: []extensions.NodeUtilization{
{
Resource: experimental.CpuRequest,
Resource: extensions.CpuRequest,
Value: 0.7,
},
},
@ -1015,12 +1015,12 @@ func TestValidateClusterAutoscaler(t *testing.T) {
Name: "ClusterAutoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.ClusterAutoscalerSpec{
Spec: extensions.ClusterAutoscalerSpec{
MinNodes: -1,
MaxNodes: 5,
TargetUtilization: []experimental.NodeUtilization{
TargetUtilization: []extensions.NodeUtilization{
{
Resource: experimental.CpuRequest,
Resource: extensions.CpuRequest,
Value: 0.7,
},
},
@ -1031,12 +1031,12 @@ func TestValidateClusterAutoscaler(t *testing.T) {
Name: "ClusterAutoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.ClusterAutoscalerSpec{
Spec: extensions.ClusterAutoscalerSpec{
MinNodes: 10,
MaxNodes: 5,
TargetUtilization: []experimental.NodeUtilization{
TargetUtilization: []extensions.NodeUtilization{
{
Resource: experimental.CpuRequest,
Resource: extensions.CpuRequest,
Value: 0.7,
},
},
@ -1047,10 +1047,10 @@ func TestValidateClusterAutoscaler(t *testing.T) {
Name: "ClusterAutoscaler",
Namespace: api.NamespaceDefault,
},
Spec: experimental.ClusterAutoscalerSpec{
Spec: extensions.ClusterAutoscalerSpec{
MinNodes: 1,
MaxNodes: 5,
TargetUtilization: []experimental.NodeUtilization{},
TargetUtilization: []extensions.NodeUtilization{},
},
},
}

View File

@ -232,7 +232,7 @@ type StoreToDaemonSetLister struct {
}
// 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)
if err != nil {
return false, err
@ -242,18 +242,18 @@ func (s *StoreToDaemonSetLister) Exists(ds *experimental.DaemonSet) (bool, error
// List lists all daemon sets in the store.
// 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() {
dss = append(dss, *(c.(*experimental.DaemonSet)))
dss = append(dss, *(c.(*extensions.DaemonSet)))
}
return dss, nil
}
// GetPodDaemonSets returns a list of daemon sets managing a pod.
// 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 daemonSet experimental.DaemonSet
var daemonSet extensions.DaemonSet
if len(pod.Labels) == 0 {
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() {
daemonSet = *m.(*experimental.DaemonSet)
daemonSet = *m.(*extensions.DaemonSet)
if daemonSet.Namespace != pod.Namespace {
continue
}
@ -351,7 +351,7 @@ type StoreToJobLister struct {
}
// 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)
if err != nil {
return false, err
@ -360,17 +360,17 @@ func (s *StoreToJobLister) Exists(job *experimental.Job) (bool, error) {
}
// 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() {
jobs = append(jobs, *(c.(*experimental.Job)))
jobs = append(jobs, *(c.(*extensions.Job)))
}
return jobs, nil
}
// 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 job experimental.Job
var job extensions.Job
if len(pod.Labels) == 0 {
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() {
job = *m.(*experimental.Job)
job = *m.(*extensions.Job)
if job.Namespace != pod.Namespace {
continue
}

View File

@ -160,44 +160,44 @@ func TestStoreToDaemonSetLister(t *testing.T) {
store := NewStore(MetaNamespaceKeyFunc)
lister := StoreToDaemonSetLister{store}
testCases := []struct {
inDSs []*experimental.DaemonSet
list func() ([]experimental.DaemonSet, error)
inDSs []*extensions.DaemonSet
list func() ([]extensions.DaemonSet, error)
outDaemonSetNames sets.String
expectErr bool
}{
// Basic listing
{
inDSs: []*experimental.DaemonSet{
inDSs: []*extensions.DaemonSet{
{ObjectMeta: api.ObjectMeta{Name: "basic"}},
},
list: func() ([]experimental.DaemonSet, error) {
list: func() ([]extensions.DaemonSet, error) {
return lister.List()
},
outDaemonSetNames: sets.NewString("basic"),
},
// Listing multiple daemon sets
{
inDSs: []*experimental.DaemonSet{
inDSs: []*extensions.DaemonSet{
{ObjectMeta: api.ObjectMeta{Name: "basic"}},
{ObjectMeta: api.ObjectMeta{Name: "complex"}},
{ObjectMeta: api.ObjectMeta{Name: "complex2"}},
},
list: func() ([]experimental.DaemonSet, error) {
list: func() ([]extensions.DaemonSet, error) {
return lister.List()
},
outDaemonSetNames: sets.NewString("basic", "complex", "complex2"),
},
// No pod labels
{
inDSs: []*experimental.DaemonSet{
inDSs: []*extensions.DaemonSet{
{
ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: map[string]string{"foo": "baz"},
},
},
},
list: func() ([]experimental.DaemonSet, error) {
list: func() ([]extensions.DaemonSet, error) {
pod := &api.Pod{
ObjectMeta: api.ObjectMeta{Name: "pod1", Namespace: "ns"},
}
@ -208,12 +208,12 @@ func TestStoreToDaemonSetLister(t *testing.T) {
},
// No DS selectors
{
inDSs: []*experimental.DaemonSet{
inDSs: []*extensions.DaemonSet{
{
ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"},
},
},
list: func() ([]experimental.DaemonSet, error) {
list: func() ([]extensions.DaemonSet, error) {
pod := &api.Pod{
ObjectMeta: api.ObjectMeta{
Name: "pod1",
@ -228,21 +228,21 @@ func TestStoreToDaemonSetLister(t *testing.T) {
},
// Matching labels to selectors and namespace
{
inDSs: []*experimental.DaemonSet{
inDSs: []*extensions.DaemonSet{
{
ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: map[string]string{"foo": "bar"},
},
},
{
ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: map[string]string{"foo": "bar"},
},
},
},
list: func() ([]experimental.DaemonSet, error) {
list: func() ([]extensions.DaemonSet, error) {
pod := &api.Pod{
ObjectMeta: api.ObjectMeta{
Name: "pod1",

View File

@ -45,7 +45,7 @@ func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationContro
// 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.
func JobHasDesiredParallelism(c Interface, job *experimental.Job) wait.ConditionFunc {
func JobHasDesiredParallelism(c Interface, job *extensions.Job) wait.ConditionFunc {
return func() (bool, error) {
job, err := c.Experimental().Jobs(job.Namespace).Get(job.Name)

View File

@ -29,11 +29,11 @@ type DaemonSetsNamespacer interface {
}
type DaemonSetInterface interface {
List(selector labels.Selector) (*experimental.DaemonSetList, error)
Get(name string) (*experimental.DaemonSet, error)
Create(ctrl *experimental.DaemonSet) (*experimental.DaemonSet, error)
Update(ctrl *experimental.DaemonSet) (*experimental.DaemonSet, error)
UpdateStatus(ctrl *experimental.DaemonSet) (*experimental.DaemonSet, error)
List(selector labels.Selector) (*extensions.DaemonSetList, error)
Get(name string) (*extensions.DaemonSet, error)
Create(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
Update(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
UpdateStatus(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
Delete(name string) 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.
var _ DaemonSetInterface = &daemonSets{}
func (c *daemonSets) List(selector labels.Selector) (result *experimental.DaemonSetList, err error) {
result = &experimental.DaemonSetList{}
func (c *daemonSets) List(selector labels.Selector) (result *extensions.DaemonSetList, err error) {
result = &extensions.DaemonSetList{}
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").LabelsSelectorParam(selector).Do().Into(result)
return
}
// Get returns information about a particular daemon set.
func (c *daemonSets) Get(name string) (result *experimental.DaemonSet, err error) {
result = &experimental.DaemonSet{}
func (c *daemonSets) Get(name string) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").Name(name).Do().Into(result)
return
}
// Create creates a new daemon set.
func (c *daemonSets) Create(daemon *experimental.DaemonSet) (result *experimental.DaemonSet, err error) {
result = &experimental.DaemonSet{}
func (c *daemonSets) Create(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
err = c.r.Post().Namespace(c.ns).Resource("daemonsets").Body(daemon).Do().Into(result)
return
}
// Update updates an existing daemon set.
func (c *daemonSets) Update(daemon *experimental.DaemonSet) (result *experimental.DaemonSet, err error) {
result = &experimental.DaemonSet{}
func (c *daemonSets) Update(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
err = c.r.Put().Namespace(c.ns).Resource("daemonsets").Name(daemon.Name).Body(daemon).Do().Into(result)
return
}
// UpdateStatus updates an existing daemon set status
func (c *daemonSets) UpdateStatus(daemon *experimental.DaemonSet) (result *experimental.DaemonSet, err error) {
result = &experimental.DaemonSet{}
func (c *daemonSets) UpdateStatus(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
err = c.r.Put().Namespace(c.ns).Resource("daemonsets").Name(daemon.Name).SubResource("status").Body(daemon).Do().Into(result)
return
}

View File

@ -37,8 +37,8 @@ func TestListDaemonSets(t *testing.T) {
Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""),
},
Response: Response{StatusCode: 200,
Body: &experimental.DaemonSetList{
Items: []experimental.DaemonSet{
Body: &extensions.DaemonSetList{
Items: []extensions.DaemonSet{
{
ObjectMeta: api.ObjectMeta{
Name: "foo",
@ -47,7 +47,7 @@ func TestListDaemonSets(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
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)},
Response: Response{
StatusCode: 200,
Body: &experimental.DaemonSet{
Body: &extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -74,7 +74,7 @@ func TestGetDaemonSet(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Template: &api.PodTemplateSpec{},
},
},
@ -97,14 +97,14 @@ func TestGetDaemonSetWithNoName(t *testing.T) {
func TestUpdateDaemonSet(t *testing.T) {
ns := api.NamespaceDefault
requestDaemonSet := &experimental.DaemonSet{
requestDaemonSet := &extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
}
c := &testClient{
Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
Response: Response{
StatusCode: 200,
Body: &experimental.DaemonSet{
Body: &extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -112,7 +112,7 @@ func TestUpdateDaemonSet(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Template: &api.PodTemplateSpec{},
},
},
@ -124,14 +124,14 @@ func TestUpdateDaemonSet(t *testing.T) {
func TestUpdateDaemonSetUpdateStatus(t *testing.T) {
ns := api.NamespaceDefault
requestDaemonSet := &experimental.DaemonSet{
requestDaemonSet := &extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
}
c := &testClient{
Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo") + "/status", Query: buildQueryValues(nil)},
Response: Response{
StatusCode: 200,
Body: &experimental.DaemonSet{
Body: &extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -139,10 +139,10 @@ func TestUpdateDaemonSetUpdateStatus(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Template: &api.PodTemplateSpec{},
},
Status: experimental.DaemonSetStatus{},
Status: extensions.DaemonSetStatus{},
},
},
}
@ -162,14 +162,14 @@ func TestDeleteDaemon(t *testing.T) {
func TestCreateDaemonSet(t *testing.T) {
ns := api.NamespaceDefault
requestDaemonSet := &experimental.DaemonSet{
requestDaemonSet := &extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{Name: "foo"},
}
c := &testClient{
Request: testRequest{Method: "POST", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""), Body: requestDaemonSet, Query: buildQueryValues(nil)},
Response: Response{
StatusCode: 200,
Body: &experimental.DaemonSet{
Body: &extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -177,7 +177,7 @@ func TestCreateDaemonSet(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Template: &api.PodTemplateSpec{},
},
},

View File

@ -31,11 +31,11 @@ type DeploymentsNamespacer interface {
// DeploymentInterface has methods to work with Deployment resources.
type DeploymentInterface interface {
List(label labels.Selector, field fields.Selector) (*experimental.DeploymentList, error)
Get(name string) (*experimental.Deployment, error)
List(label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error)
Get(name string) (*extensions.Deployment, error)
Delete(name string, options *api.DeleteOptions) error
Create(Deployment *experimental.Deployment) (*experimental.Deployment, error)
Update(Deployment *experimental.Deployment) (*experimental.Deployment, error)
Create(Deployment *extensions.Deployment) (*extensions.Deployment, error)
Update(Deployment *extensions.Deployment) (*extensions.Deployment, 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.
func (c *deployments) List(label labels.Selector, field fields.Selector) (result *experimental.DeploymentList, err error) {
result = &experimental.DeploymentList{}
func (c *deployments) List(label labels.Selector, field fields.Selector) (result *extensions.DeploymentList, err error) {
result = &extensions.DeploymentList{}
err = c.client.Get().Namespace(c.ns).Resource("deployments").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}
// 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) {
result = &experimental.Deployment{}
func (c *deployments) Get(name string) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
err = c.client.Get().Namespace(c.ns).Resource("deployments").Name(name).Do().Into(result)
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.
func (c *deployments) Create(deployment *experimental.Deployment) (result *experimental.Deployment, err error) {
result = &experimental.Deployment{}
func (c *deployments) Create(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
err = c.client.Post().Namespace(c.ns).Resource("deployments").Body(deployment).Do().Into(result)
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.
func (c *deployments) Update(deployment *experimental.Deployment) (result *experimental.Deployment, err error) {
result = &experimental.Deployment{}
func (c *deployments) Update(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
err = c.client.Put().Namespace(c.ns).Resource("deployments").Name(deployment.Name).Body(deployment).Do().Into(result)
return
}

View File

@ -33,7 +33,7 @@ func getDeploymentsResoureName() string {
func TestDeploymentCreate(t *testing.T) {
ns := api.NamespaceDefault
deployment := experimental.Deployment{
deployment := extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: "abc",
Namespace: ns,
@ -58,7 +58,7 @@ func TestDeploymentCreate(t *testing.T) {
func TestDeploymentGet(t *testing.T) {
ns := api.NamespaceDefault
deployment := &experimental.Deployment{
deployment := &extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: "abc",
Namespace: ns,
@ -80,8 +80,8 @@ func TestDeploymentGet(t *testing.T) {
func TestDeploymentList(t *testing.T) {
ns := api.NamespaceDefault
deploymentList := &experimental.DeploymentList{
Items: []experimental.Deployment{
deploymentList := &extensions.DeploymentList{
Items: []extensions.Deployment{
{
ObjectMeta: api.ObjectMeta{
Name: "foo",
@ -105,7 +105,7 @@ func TestDeploymentList(t *testing.T) {
func TestDeploymentUpdate(t *testing.T) {
ns := api.NamespaceDefault
deployment := &experimental.Deployment{
deployment := &extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: "abc",
Namespace: ns,

View File

@ -31,11 +31,11 @@ type HorizontalPodAutoscalersNamespacer interface {
// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources.
type HorizontalPodAutoscalerInterface interface {
List(label labels.Selector, field fields.Selector) (*experimental.HorizontalPodAutoscalerList, error)
Get(name string) (*experimental.HorizontalPodAutoscaler, error)
List(label labels.Selector, field fields.Selector) (*extensions.HorizontalPodAutoscalerList, error)
Get(name string) (*extensions.HorizontalPodAutoscaler, error)
Delete(name string, options *api.DeleteOptions) error
Create(horizontalPodAutoscaler *experimental.HorizontalPodAutoscaler) (*experimental.HorizontalPodAutoscaler, error)
Update(horizontalPodAutoscaler *experimental.HorizontalPodAutoscaler) (*experimental.HorizontalPodAutoscaler, error)
Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error)
Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, 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.
func (c *horizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (result *experimental.HorizontalPodAutoscalerList, err error) {
result = &experimental.HorizontalPodAutoscalerList{}
func (c *horizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (result *extensions.HorizontalPodAutoscalerList, err error) {
result = &extensions.HorizontalPodAutoscalerList{}
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}
// 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) {
result = &experimental.HorizontalPodAutoscaler{}
func (c *horizontalPodAutoscalers) Get(name string) (result *extensions.HorizontalPodAutoscaler, err error) {
result = &extensions.HorizontalPodAutoscaler{}
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Do().Into(result)
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.
func (c *horizontalPodAutoscalers) Create(horizontalPodAutoscaler *experimental.HorizontalPodAutoscaler) (result *experimental.HorizontalPodAutoscaler, err error) {
result = &experimental.HorizontalPodAutoscaler{}
func (c *horizontalPodAutoscalers) Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) {
result = &extensions.HorizontalPodAutoscaler{}
err = c.client.Post().Namespace(c.ns).Resource("horizontalPodAutoscalers").Body(horizontalPodAutoscaler).Do().Into(result)
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.
func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *experimental.HorizontalPodAutoscaler) (result *experimental.HorizontalPodAutoscaler, err error) {
result = &experimental.HorizontalPodAutoscaler{}
func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) {
result = &extensions.HorizontalPodAutoscaler{}
err = c.client.Put().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(horizontalPodAutoscaler.Name).Body(horizontalPodAutoscaler).Do().Into(result)
return
}

View File

@ -33,7 +33,7 @@ func getHorizontalPodAutoscalersResoureName() string {
func TestHorizontalPodAutoscalerCreate(t *testing.T) {
ns := api.NamespaceDefault
horizontalPodAutoscaler := experimental.HorizontalPodAutoscaler{
horizontalPodAutoscaler := extensions.HorizontalPodAutoscaler{
ObjectMeta: api.ObjectMeta{
Name: "abc",
Namespace: ns,
@ -58,7 +58,7 @@ func TestHorizontalPodAutoscalerCreate(t *testing.T) {
func TestHorizontalPodAutoscalerGet(t *testing.T) {
ns := api.NamespaceDefault
horizontalPodAutoscaler := &experimental.HorizontalPodAutoscaler{
horizontalPodAutoscaler := &extensions.HorizontalPodAutoscaler{
ObjectMeta: api.ObjectMeta{
Name: "abc",
Namespace: ns,
@ -80,8 +80,8 @@ func TestHorizontalPodAutoscalerGet(t *testing.T) {
func TestHorizontalPodAutoscalerList(t *testing.T) {
ns := api.NamespaceDefault
horizontalPodAutoscalerList := &experimental.HorizontalPodAutoscalerList{
Items: []experimental.HorizontalPodAutoscaler{
horizontalPodAutoscalerList := &extensions.HorizontalPodAutoscalerList{
Items: []extensions.HorizontalPodAutoscaler{
{
ObjectMeta: api.ObjectMeta{
Name: "foo",
@ -105,7 +105,7 @@ func TestHorizontalPodAutoscalerList(t *testing.T) {
func TestHorizontalPodAutoscalerUpdate(t *testing.T) {
ns := api.NamespaceDefault
horizontalPodAutoscaler := &experimental.HorizontalPodAutoscaler{
horizontalPodAutoscaler := &extensions.HorizontalPodAutoscaler{
ObjectMeta: api.ObjectMeta{
Name: "abc",
Namespace: ns,

View File

@ -31,13 +31,13 @@ type IngressNamespacer interface {
// IngressInterface exposes methods to work on Ingress resources.
type IngressInterface interface {
List(label labels.Selector, field fields.Selector) (*experimental.IngressList, error)
Get(name string) (*experimental.Ingress, error)
Create(ingress *experimental.Ingress) (*experimental.Ingress, error)
Update(ingress *experimental.Ingress) (*experimental.Ingress, error)
List(label labels.Selector, field fields.Selector) (*extensions.IngressList, error)
Get(name string) (*extensions.Ingress, error)
Create(ingress *extensions.Ingress) (*extensions.Ingress, error)
Update(ingress *extensions.Ingress) (*extensions.Ingress, error)
Delete(name string, options *api.DeleteOptions) 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
@ -52,29 +52,29 @@ func newIngress(c *ExperimentalClient, namespace string) *ingress {
}
// 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) {
result = &experimental.IngressList{}
func (c *ingress) List(label labels.Selector, field fields.Selector) (result *extensions.IngressList, err error) {
result = &extensions.IngressList{}
err = c.r.Get().Namespace(c.ns).Resource("ingress").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}
// Get returns information about a particular ingress.
func (c *ingress) Get(name string) (result *experimental.Ingress, err error) {
result = &experimental.Ingress{}
func (c *ingress) Get(name string) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Get().Namespace(c.ns).Resource("ingress").Name(name).Do().Into(result)
return
}
// Create creates a new ingress.
func (c *ingress) Create(ingress *experimental.Ingress) (result *experimental.Ingress, err error) {
result = &experimental.Ingress{}
func (c *ingress) Create(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Post().Namespace(c.ns).Resource("ingress").Body(ingress).Do().Into(result)
return
}
// Update updates an existing ingress.
func (c *ingress) Update(ingress *experimental.Ingress) (result *experimental.Ingress, err error) {
result = &experimental.Ingress{}
func (c *ingress) Update(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).Body(ingress).Do().Into(result)
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.
func (c *ingress) UpdateStatus(ingress *experimental.Ingress) (result *experimental.Ingress, err error) {
result = &experimental.Ingress{}
func (c *ingress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).SubResource("status").Body(ingress).Do().Into(result)
return
}

View File

@ -38,8 +38,8 @@ func TestListIngress(t *testing.T) {
Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, ""),
},
Response: Response{StatusCode: 200,
Body: &experimental.IngressList{
Items: []experimental.Ingress{
Body: &extensions.IngressList{
Items: []extensions.Ingress{
{
ObjectMeta: api.ObjectMeta{
Name: "foo",
@ -48,8 +48,8 @@ func TestListIngress(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.IngressSpec{
Rules: []experimental.IngressRule{},
Spec: extensions.IngressSpec{
Rules: []extensions.IngressRule{},
},
},
},
@ -70,7 +70,7 @@ func TestGetIngress(t *testing.T) {
},
Response: Response{
StatusCode: 200,
Body: &experimental.Ingress{
Body: &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -78,8 +78,8 @@ func TestGetIngress(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.IngressSpec{
Rules: []experimental.IngressRule{},
Spec: extensions.IngressSpec{
Rules: []extensions.IngressRule{},
},
},
},
@ -101,7 +101,7 @@ func TestGetIngressWithNoName(t *testing.T) {
func TestUpdateIngress(t *testing.T) {
ns := api.NamespaceDefault
requestIngress := &experimental.Ingress{
requestIngress := &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: ns,
@ -116,7 +116,7 @@ func TestUpdateIngress(t *testing.T) {
},
Response: Response{
StatusCode: 200,
Body: &experimental.Ingress{
Body: &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -124,8 +124,8 @@ func TestUpdateIngress(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.IngressSpec{
Rules: []experimental.IngressRule{},
Spec: extensions.IngressSpec{
Rules: []extensions.IngressRule{},
},
},
},
@ -141,13 +141,13 @@ func TestUpdateIngressStatus(t *testing.T) {
{IP: "127.0.0.1"},
},
}
requestIngress := &experimental.Ingress{
requestIngress := &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: ns,
ResourceVersion: "1",
},
Status: experimental.IngressStatus{
Status: extensions.IngressStatus{
LoadBalancer: lbStatus,
},
}
@ -159,7 +159,7 @@ func TestUpdateIngressStatus(t *testing.T) {
},
Response: Response{
StatusCode: 200,
Body: &experimental.Ingress{
Body: &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -167,10 +167,10 @@ func TestUpdateIngressStatus(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.IngressSpec{
Rules: []experimental.IngressRule{},
Spec: extensions.IngressSpec{
Rules: []extensions.IngressRule{},
},
Status: experimental.IngressStatus{
Status: extensions.IngressStatus{
LoadBalancer: lbStatus,
},
},
@ -196,7 +196,7 @@ func TestDeleteIngress(t *testing.T) {
func TestCreateIngress(t *testing.T) {
ns := api.NamespaceDefault
requestIngress := &experimental.Ingress{
requestIngress := &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: ns,
@ -211,7 +211,7 @@ func TestCreateIngress(t *testing.T) {
},
Response: Response{
StatusCode: 200,
Body: &experimental.Ingress{
Body: &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -219,8 +219,8 @@ func TestCreateIngress(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.IngressSpec{
Rules: []experimental.IngressRule{},
Spec: extensions.IngressSpec{
Rules: []extensions.IngressRule{},
},
},
},

View File

@ -32,13 +32,13 @@ type JobsNamespacer interface {
// JobInterface exposes methods to work on Job resources.
type JobInterface interface {
List(label labels.Selector, field fields.Selector) (*experimental.JobList, error)
Get(name string) (*experimental.Job, error)
Create(job *experimental.Job) (*experimental.Job, error)
Update(job *experimental.Job) (*experimental.Job, error)
List(label labels.Selector, field fields.Selector) (*extensions.JobList, error)
Get(name string) (*extensions.Job, error)
Create(job *extensions.Job) (*extensions.Job, error)
Update(job *extensions.Job) (*extensions.Job, error)
Delete(name string, options *api.DeleteOptions) 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
@ -56,29 +56,29 @@ func newJobs(c *ExperimentalClient, namespace string) *jobs {
var _ JobInterface = &jobs{}
// 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) {
result = &experimental.JobList{}
func (c *jobs) List(label labels.Selector, field fields.Selector) (result *extensions.JobList, err error) {
result = &extensions.JobList{}
err = c.r.Get().Namespace(c.ns).Resource("jobs").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}
// Get returns information about a particular job.
func (c *jobs) Get(name string) (result *experimental.Job, err error) {
result = &experimental.Job{}
func (c *jobs) Get(name string) (result *extensions.Job, err error) {
result = &extensions.Job{}
err = c.r.Get().Namespace(c.ns).Resource("jobs").Name(name).Do().Into(result)
return
}
// Create creates a new job.
func (c *jobs) Create(job *experimental.Job) (result *experimental.Job, err error) {
result = &experimental.Job{}
func (c *jobs) Create(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
err = c.r.Post().Namespace(c.ns).Resource("jobs").Body(job).Do().Into(result)
return
}
// Update updates an existing job.
func (c *jobs) Update(job *experimental.Job) (result *experimental.Job, err error) {
result = &experimental.Job{}
func (c *jobs) Update(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).Body(job).Do().Into(result)
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.
func (c *jobs) UpdateStatus(job *experimental.Job) (result *experimental.Job, err error) {
result = &experimental.Job{}
func (c *jobs) UpdateStatus(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).SubResource("status").Body(job).Do().Into(result)
return
}

View File

@ -38,8 +38,8 @@ func TestListJobs(t *testing.T) {
Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, ""),
},
Response: Response{StatusCode: 200,
Body: &experimental.JobList{
Items: []experimental.Job{
Body: &extensions.JobList{
Items: []extensions.Job{
{
ObjectMeta: api.ObjectMeta{
Name: "foo",
@ -48,7 +48,7 @@ func TestListJobs(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Template: &api.PodTemplateSpec{},
},
},
@ -70,7 +70,7 @@ func TestGetJob(t *testing.T) {
},
Response: Response{
StatusCode: 200,
Body: &experimental.Job{
Body: &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -78,7 +78,7 @@ func TestGetJob(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Template: &api.PodTemplateSpec{},
},
},
@ -101,7 +101,7 @@ func TestGetJobWithNoName(t *testing.T) {
func TestUpdateJob(t *testing.T) {
ns := api.NamespaceDefault
requestJob := &experimental.Job{
requestJob := &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: ns,
@ -116,7 +116,7 @@ func TestUpdateJob(t *testing.T) {
},
Response: Response{
StatusCode: 200,
Body: &experimental.Job{
Body: &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -124,7 +124,7 @@ func TestUpdateJob(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Template: &api.PodTemplateSpec{},
},
},
@ -136,7 +136,7 @@ func TestUpdateJob(t *testing.T) {
func TestUpdateJobStatus(t *testing.T) {
ns := api.NamespaceDefault
requestJob := &experimental.Job{
requestJob := &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: ns,
@ -151,7 +151,7 @@ func TestUpdateJobStatus(t *testing.T) {
},
Response: Response{
StatusCode: 200,
Body: &experimental.Job{
Body: &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -159,10 +159,10 @@ func TestUpdateJobStatus(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Template: &api.PodTemplateSpec{},
},
Status: experimental.JobStatus{
Status: extensions.JobStatus{
Active: 1,
},
},
@ -188,7 +188,7 @@ func TestDeleteJob(t *testing.T) {
func TestCreateJob(t *testing.T) {
ns := api.NamespaceDefault
requestJob := &experimental.Job{
requestJob := &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: ns,
@ -203,7 +203,7 @@ func TestCreateJob(t *testing.T) {
},
Response: Response{
StatusCode: 200,
Body: &experimental.Job{
Body: &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -211,7 +211,7 @@ func TestCreateJob(t *testing.T) {
"name": "baz",
},
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Template: &api.PodTemplateSpec{},
},
},

View File

@ -27,8 +27,8 @@ type ScaleNamespacer interface {
// ScaleInterface has methods to work with Scale (sub)resources.
type ScaleInterface interface {
Get(string, string) (*experimental.Scale, error)
Update(string, *experimental.Scale) (*experimental.Scale, error)
Get(string, string) (*extensions.Scale, error)
Update(string, *extensions.Scale) (*extensions.Scale, error)
}
// 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.
func (c *scales) Get(kind string, name string) (result *experimental.Scale, err error) {
result = &experimental.Scale{}
func (c *scales) Get(kind string, name string) (result *extensions.Scale, err error) {
result = &extensions.Scale{}
resource, _ := meta.KindToResource(kind, false)
err = c.client.Get().Namespace(c.ns).Resource(resource).Name(name).SubResource("scale").Do().Into(result)
return
}
func (c *scales) Update(kind string, scale *experimental.Scale) (result *experimental.Scale, err error) {
result = &experimental.Scale{}
func (c *scales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) {
result = &extensions.Scale{}
resource, _ := meta.KindToResource(kind, false)
err = c.client.Put().
Namespace(scale.Namespace).

View File

@ -34,48 +34,48 @@ type FakeDaemonSets struct {
// Ensure statically that FakeDaemonSets implements DaemonInterface.
var _ kClientLib.DaemonSetInterface = &FakeDaemonSets{}
func (c *FakeDaemonSets) Get(name string) (*experimental.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewGetAction("daemonsets", c.Namespace, name), &experimental.DaemonSet{})
func (c *FakeDaemonSets) Get(name string) (*extensions.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewGetAction("daemonsets", c.Namespace, name), &extensions.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*experimental.DaemonSet), err
return obj.(*extensions.DaemonSet), err
}
func (c *FakeDaemonSets) List(label labels.Selector) (*experimental.DaemonSetList, error) {
obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, label, nil), &experimental.DaemonSetList{})
func (c *FakeDaemonSets) List(label labels.Selector) (*extensions.DaemonSetList, error) {
obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, label, nil), &extensions.DaemonSetList{})
if obj == nil {
return nil, err
}
return obj.(*experimental.DaemonSetList), err
return obj.(*extensions.DaemonSetList), err
}
func (c *FakeDaemonSets) Create(daemon *experimental.DaemonSet) (*experimental.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewCreateAction("daemonsets", c.Namespace, daemon), &experimental.DaemonSet{})
func (c *FakeDaemonSets) Create(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewCreateAction("daemonsets", c.Namespace, daemon), &extensions.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*experimental.DaemonSet), err
return obj.(*extensions.DaemonSet), err
}
func (c *FakeDaemonSets) Update(daemon *experimental.DaemonSet) (*experimental.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("daemonsets", c.Namespace, daemon), &experimental.DaemonSet{})
func (c *FakeDaemonSets) Update(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("daemonsets", c.Namespace, daemon), &extensions.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*experimental.DaemonSet), err
return obj.(*extensions.DaemonSet), err
}
func (c *FakeDaemonSets) UpdateStatus(daemon *experimental.DaemonSet) (*experimental.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("daemonsets", "status", c.Namespace, daemon), &experimental.DaemonSet{})
func (c *FakeDaemonSets) UpdateStatus(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("daemonsets", "status", c.Namespace, daemon), &extensions.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*experimental.DaemonSet), err
return obj.(*extensions.DaemonSet), err
}
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
}

View File

@ -31,22 +31,22 @@ type FakeDeployments struct {
Namespace string
}
func (c *FakeDeployments) Get(name string) (*experimental.Deployment, error) {
obj, err := c.Fake.Invokes(NewGetAction("deployments", c.Namespace, name), &experimental.Deployment{})
func (c *FakeDeployments) Get(name string) (*extensions.Deployment, error) {
obj, err := c.Fake.Invokes(NewGetAction("deployments", c.Namespace, name), &extensions.Deployment{})
if obj == nil {
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) {
obj, err := c.Fake.Invokes(NewListAction("deployments", c.Namespace, label, field), &experimental.DeploymentList{})
func (c *FakeDeployments) List(label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error) {
obj, err := c.Fake.Invokes(NewListAction("deployments", c.Namespace, label, field), &extensions.DeploymentList{})
if obj == nil {
return nil, err
}
list := &experimental.DeploymentList{}
for _, deployment := range obj.(*experimental.DeploymentList).Items {
list := &extensions.DeploymentList{}
for _, deployment := range obj.(*extensions.DeploymentList).Items {
if label.Matches(labels.Set(deployment.Labels)) {
list.Items = append(list.Items, deployment)
}
@ -54,26 +54,26 @@ func (c *FakeDeployments) List(label labels.Selector, field fields.Selector) (*e
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)
if obj == nil {
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)
if obj == nil {
return nil, err
}
return obj.(*experimental.Deployment), err
return obj.(*extensions.Deployment), err
}
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
}

View File

@ -31,22 +31,22 @@ type FakeHorizontalPodAutoscalers struct {
Namespace string
}
func (c *FakeHorizontalPodAutoscalers) Get(name string) (*experimental.HorizontalPodAutoscaler, error) {
obj, err := c.Fake.Invokes(NewGetAction("horizontalpodautoscalers", c.Namespace, name), &experimental.HorizontalPodAutoscaler{})
func (c *FakeHorizontalPodAutoscalers) Get(name string) (*extensions.HorizontalPodAutoscaler, error) {
obj, err := c.Fake.Invokes(NewGetAction("horizontalpodautoscalers", c.Namespace, name), &extensions.HorizontalPodAutoscaler{})
if obj == nil {
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) {
obj, err := c.Fake.Invokes(NewListAction("horizontalpodautoscalers", c.Namespace, label, field), &experimental.HorizontalPodAutoscalerList{})
func (c *FakeHorizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (*extensions.HorizontalPodAutoscalerList, error) {
obj, err := c.Fake.Invokes(NewListAction("horizontalpodautoscalers", c.Namespace, label, field), &extensions.HorizontalPodAutoscalerList{})
if obj == nil {
return nil, err
}
list := &experimental.HorizontalPodAutoscalerList{}
for _, a := range obj.(*experimental.HorizontalPodAutoscalerList).Items {
list := &extensions.HorizontalPodAutoscalerList{}
for _, a := range obj.(*extensions.HorizontalPodAutoscalerList).Items {
if label.Matches(labels.Set(a.Labels)) {
list.Items = append(list.Items, a)
}
@ -54,26 +54,26 @@ func (c *FakeHorizontalPodAutoscalers) List(label labels.Selector, field fields.
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)
if obj == nil {
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)
if obj == nil {
return nil, err
}
return obj.(*experimental.HorizontalPodAutoscaler), err
return obj.(*extensions.HorizontalPodAutoscaler), err
}
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
}

View File

@ -31,44 +31,44 @@ type FakeIngress struct {
Namespace string
}
func (c *FakeIngress) Get(name string) (*experimental.Ingress, error) {
obj, err := c.Fake.Invokes(NewGetAction("ingress", c.Namespace, name), &experimental.Ingress{})
func (c *FakeIngress) Get(name string) (*extensions.Ingress, error) {
obj, err := c.Fake.Invokes(NewGetAction("ingress", c.Namespace, name), &extensions.Ingress{})
if obj == nil {
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) {
obj, err := c.Fake.Invokes(NewListAction("ingress", c.Namespace, label, nil), &experimental.IngressList{})
func (c *FakeIngress) List(label labels.Selector, fields fields.Selector) (*extensions.IngressList, error) {
obj, err := c.Fake.Invokes(NewListAction("ingress", c.Namespace, label, nil), &extensions.IngressList{})
if obj == nil {
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)
if obj == nil {
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)
if obj == nil {
return nil, err
}
return obj.(*experimental.Ingress), err
return obj.(*extensions.Ingress), err
}
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
}
@ -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))
}
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)
if obj == nil {
return nil, err
}
return obj.(*experimental.Ingress), err
return obj.(*extensions.Ingress), err
}

View File

@ -31,44 +31,44 @@ type FakeJobs struct {
Namespace string
}
func (c *FakeJobs) Get(name string) (*experimental.Job, error) {
obj, err := c.Fake.Invokes(NewGetAction("jobs", c.Namespace, name), &experimental.Job{})
func (c *FakeJobs) Get(name string) (*extensions.Job, error) {
obj, err := c.Fake.Invokes(NewGetAction("jobs", c.Namespace, name), &extensions.Job{})
if obj == nil {
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) {
obj, err := c.Fake.Invokes(NewListAction("jobs", c.Namespace, label, nil), &experimental.JobList{})
func (c *FakeJobs) List(label labels.Selector, fields fields.Selector) (*extensions.JobList, error) {
obj, err := c.Fake.Invokes(NewListAction("jobs", c.Namespace, label, nil), &extensions.JobList{})
if obj == nil {
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)
if obj == nil {
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)
if obj == nil {
return nil, err
}
return obj.(*experimental.Job), err
return obj.(*extensions.Job), err
}
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
}
@ -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))
}
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)
if obj == nil {
return nil, err
}
return obj.(*experimental.Job), err
return obj.(*extensions.Job), err
}

View File

@ -27,19 +27,19 @@ type FakeScales struct {
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.Verb = "get"
action.Namespace = c.Namespace
action.Resource = kind
action.Subresource = "scale"
action.Name = name
obj, err := c.Fake.Invokes(action, &experimental.Scale{})
result = obj.(*experimental.Scale)
obj, err := c.Fake.Invokes(action, &extensions.Scale{})
result = obj.(*extensions.Scale)
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.Verb = "update"
action.Namespace = c.Namespace
@ -47,6 +47,6 @@ func (c *FakeScales) Update(kind string, scale *experimental.Scale) (result *exp
action.Subresource = "scale"
action.Object = scale
obj, err := c.Fake.Invokes(action, scale)
result = obj.(*experimental.Scale)
result = obj.(*extensions.Scale)
return
}

View File

@ -103,22 +103,22 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
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?
FullDaemonSetResyncPeriod,
framework.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
ds := obj.(*experimental.DaemonSet)
ds := obj.(*extensions.DaemonSet)
glog.V(4).Infof("Adding daemon set %s", ds.Name)
dsc.enqueueDaemonSet(obj)
},
UpdateFunc: func(old, cur interface{}) {
oldDS := old.(*experimental.DaemonSet)
oldDS := old.(*extensions.DaemonSet)
glog.V(4).Infof("Updating daemon set %s", oldDS.Name)
dsc.enqueueDaemonSet(cur)
},
DeleteFunc: func(obj interface{}) {
ds := obj.(*experimental.DaemonSet)
ds := obj.(*extensions.DaemonSet)
glog.V(4).Infof("Deleting daemon set %s", ds.Name)
dsc.enqueueDaemonSet(obj)
},
@ -218,7 +218,7 @@ func (dsc *DaemonSetsController) enqueueDaemonSet(obj interface{}) {
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)
if err != nil {
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.
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)
daemonPods, err := dsc.podStore.Pods(ds.Namespace).List(labels.Set(ds.Spec.Selector).AsSelector())
if err != nil {
@ -334,7 +334,7 @@ func (dsc *DaemonSetsController) getNodesToDaemonPods(ds *experimental.DaemonSet
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.
nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ds)
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 {
return nil
}
@ -426,7 +426,7 @@ func storeDaemonSetStatus(dsClient client.DaemonSetInterface, ds *experimental.D
return updateErr
}
func (dsc *DaemonSetsController) updateDaemonSetStatus(ds *experimental.DaemonSet) {
func (dsc *DaemonSetsController) updateDaemonSetStatus(ds *extensions.DaemonSet) {
glog.V(4).Infof("Updating daemon set status")
nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ds)
if err != nil {
@ -482,7 +482,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
dsc.expectations.DeleteExpectations(key)
return nil
}
ds := obj.(*experimental.DaemonSet)
ds := obj.(*extensions.DaemonSet)
if !dsc.podStoreSynced() {
// Sleep so we give the pod reflector goroutine a chance to run.
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.
type byCreationTimestamp []experimental.DaemonSet
type byCreationTimestamp []extensions.DaemonSet
func (o byCreationTimestamp) Len() int { return len(o) }
func (o byCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] }

View File

@ -42,7 +42,7 @@ func init() {
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 {
t.Errorf("Unexpected error getting key for ds %v: %v", ds.Name, err)
return ""
@ -51,14 +51,14 @@ func getKey(ds *experimental.DaemonSet, t *testing.T) string {
}
}
func newDaemonSet(name string) *experimental.DaemonSet {
return &experimental.DaemonSet{
func newDaemonSet(name string) *extensions.DaemonSet {
return &extensions.DaemonSet{
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Extensions.Version()},
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: api.NamespaceDefault,
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: simpleDaemonSetLabel,
Template: &api.PodTemplateSpec{
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)
if err != nil {
t.Errorf("Could not get key for daemon.")

View File

@ -73,22 +73,22 @@ func (d *DeploymentController) reconcileDeployments() []error {
return errs
}
func (d *DeploymentController) reconcileDeployment(deployment *experimental.Deployment) error {
func (d *DeploymentController) reconcileDeployment(deployment *extensions.Deployment) error {
switch deployment.Spec.Strategy.Type {
case experimental.RecreateDeploymentStrategyType:
case extensions.RecreateDeploymentStrategyType:
return d.reconcileRecreateDeployment(*deployment)
case experimental.RollingUpdateDeploymentStrategyType:
case extensions.RollingUpdateDeploymentStrategyType:
return d.reconcileRollingUpdateDeployment(*deployment)
}
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.
return nil
}
func (d *DeploymentController) reconcileRollingUpdateDeployment(deployment experimental.Deployment) error {
func (d *DeploymentController) reconcileRollingUpdateDeployment(deployment extensions.Deployment) error {
newRC, err := d.getNewRC(deployment)
if err != nil {
return err
@ -124,13 +124,13 @@ func (d *DeploymentController) reconcileRollingUpdateDeployment(deployment exper
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)
}
// Returns an RC that matches the intent of the given deployment.
// 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)
if err != nil || existingNewRC != nil {
return existingNewRC, err
@ -158,7 +158,7 @@ func (d *DeploymentController) getNewRC(deployment experimental.Deployment) (*ap
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 {
// Scaling not required.
return false, nil
@ -192,7 +192,7 @@ func (d *DeploymentController) reconcileNewRC(allRCs []*api.ReplicationControlle
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)
if oldPodsCount == 0 {
// Cant scale down further
@ -239,12 +239,12 @@ func (d *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControll
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)
updatedReplicas := deploymentUtil.GetReplicaCountForRCs([]*api.ReplicationController{newRC})
newDeployment := deployment
// 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,
UpdatedReplicas: updatedReplicas,
}
@ -252,7 +252,7 @@ func (d *DeploymentController) updateDeploymentStatus(allRCs []*api.ReplicationC
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"
if rc.Spec.Replicas < newScale {
scalingOperation = "up"
@ -270,7 +270,7 @@ func (d *DeploymentController) scaleRC(rc *api.ReplicationController, newScale i
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.
return d.client.Experimental().Deployments(deployment.ObjectMeta.Namespace).Update(deployment)
}

View File

@ -45,7 +45,7 @@ type JobController struct {
podControl controller.PodControlInterface
// To allow injection of updateJobStatus for testing.
updateHandler func(job *experimental.Job) error
updateHandler func(job *extensions.Job) error
syncHandler func(jobKey string) error
// 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.
@ -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)
},
},
&experimental.Job{},
&extensions.Job{},
// TODO: Can we have much longer period here?
replicationcontroller.FullControllerResyncPeriod,
framework.ResourceEventHandlerFuncs{
AddFunc: jm.enqueueController,
UpdateFunc: func(old, cur interface{}) {
if job := cur.(*experimental.Job); !isJobFinished(job) {
if job := cur.(*extensions.Job); !isJobFinished(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.
func (jm *JobController) getPodJob(pod *api.Pod) *experimental.Job {
func (jm *JobController) getPodJob(pod *api.Pod) *extensions.Job {
jobs, err := jm.jobStore.GetPodJobs(pod)
if err != nil {
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{}) {
key, err := controller.KeyFunc(obj)
if err != nil {
@ -295,7 +295,7 @@ func (jm *JobController) syncJob(key string) error {
jm.queue.Add(key)
return err
}
job := *obj.(*experimental.Job)
job := *obj.(*extensions.Job)
if !jm.podStoreSynced() {
// Sleep so we give the pod reflector goroutine a chance to run.
time.Sleep(replicationcontroller.PodStoreSyncedPollPeriod)
@ -345,9 +345,9 @@ func (jm *JobController) syncJob(key string) error {
return nil
}
func newCondition() experimental.JobCondition {
return experimental.JobCondition{
Type: experimental.JobComplete,
func newCondition() extensions.JobCondition {
return extensions.JobCondition{
Type: extensions.JobComplete,
Status: api.ConditionTrue,
LastProbeTime: unversioned.Now(),
LastTransitionTime: unversioned.Now(),
@ -360,7 +360,7 @@ func getStatus(pods []api.Pod) (succeeded, failed int) {
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
active := len(activePods)
parallelism := *job.Spec.Parallelism
@ -430,7 +430,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ex
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)
return err
}
@ -446,9 +446,9 @@ func filterPods(pods []api.Pod, phase api.PodPhase) int {
return result
}
func isJobFinished(j *experimental.Job) bool {
func isJobFinished(j *extensions.Job) bool {
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
}
}
@ -456,7 +456,7 @@ func isJobFinished(j *experimental.Job) bool {
}
// 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) Swap(i, j int) { o[i], o[j] = o[j], o[i] }

View File

@ -34,13 +34,13 @@ import (
var alwaysReady = func() bool { return true }
func newJob(parallelism, completions int) *experimental.Job {
return &experimental.Job{
func newJob(parallelism, completions int) *extensions.Job {
return &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foobar",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &parallelism,
Completions: &completions,
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 {
t.Errorf("Unexpected error getting key for job %v: %v", job.Name, err)
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
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{}
for i := 0; i < count; i++ {
newPod := api.Pod{
@ -165,8 +165,8 @@ func TestControllerSyncJob(t *testing.T) {
fakePodControl := controller.FakePodControl{Err: tc.podControllerError}
manager.podControl = &fakePodControl
manager.podStoreSynced = alwaysReady
var actual *experimental.Job
manager.updateHandler = func(job *experimental.Job) error {
var actual *extensions.Job
manager.updateHandler = func(job *extensions.Job) error {
actual = job
return nil
}
@ -211,7 +211,7 @@ func TestControllerSyncJob(t *testing.T) {
if tc.expectedComplete {
completed := false
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
break
}
@ -229,7 +229,7 @@ func TestSyncJobDeleted(t *testing.T) {
fakePodControl := controller.FakePodControl{}
manager.podControl = &fakePodControl
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)
err := manager.syncJob(getKey(job, t))
if err != nil {
@ -249,7 +249,7 @@ func TestSyncJobUpdateRequeue(t *testing.T) {
fakePodControl := controller.FakePodControl{}
manager.podControl = &fakePodControl
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)
manager.jobStore.Store.Add(job)
err := manager.syncJob(getKey(job, t))
@ -269,14 +269,14 @@ func TestJobPodLookup(t *testing.T) {
manager := NewJobController(client, controller.NoResyncPeriodFunc)
manager.podStoreSynced = alwaysReady
testCases := []struct {
job *experimental.Job
job *extensions.Job
pod *api.Pod
expectedName string
}{
// pods without labels don't match any job
{
job: &experimental.Job{
job: &extensions.Job{
ObjectMeta: api.ObjectMeta{Name: "basic"},
},
pod: &api.Pod{
@ -286,9 +286,9 @@ func TestJobPodLookup(t *testing.T) {
},
// matching labels, different namespace
{
job: &experimental.Job{
job: &extensions.Job{
ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: map[string]string{"foo": "bar"},
},
},
@ -303,9 +303,9 @@ func TestJobPodLookup(t *testing.T) {
},
// matching ns and labels returns
{
job: &experimental.Job{
job: &extensions.Job{
ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: map[string]string{"foo": "bar"},
},
},
@ -350,7 +350,7 @@ func TestSyncJobExpectations(t *testing.T) {
fakePodControl := controller.FakePodControl{}
manager.podControl = &fakePodControl
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)
manager.jobStore.Store.Add(job)
@ -386,7 +386,7 @@ func TestWatchJobs(t *testing.T) {
manager := NewJobController(client, controller.NoResyncPeriodFunc)
manager.podStoreSynced = alwaysReady
var testJob experimental.Job
var testJob extensions.Job
received := make(chan struct{})
// 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 {
t.Errorf("Expected to find job under key %v", key)
}
job := *obj.(*experimental.Job)
job := *obj.(*extensions.Job)
if !api.Semantic.DeepDerivative(job, testJob) {
t.Errorf("Expected %#v, but got %#v", testJob, job)
}
@ -419,10 +419,10 @@ func TestWatchJobs(t *testing.T) {
}
func TestIsJobFinished(t *testing.T) {
job := &experimental.Job{
Status: experimental.JobStatus{
Conditions: []experimental.JobCondition{{
Type: experimental.JobComplete,
job := &extensions.Job{
Status: extensions.JobStatus{
Conditions: []extensions.JobCondition{{
Type: extensions.JobComplete,
Status: api.ConditionTrue,
}},
},
@ -462,7 +462,7 @@ func TestWatchPods(t *testing.T) {
if !exists || err != nil {
t.Errorf("Expected to find job under key %v", key)
}
job := obj.(*experimental.Job)
job := obj.(*extensions.Job)
if !api.Semantic.DeepDerivative(job, testJob) {
t.Errorf("\nExpected %#v,\nbut got %#v", testJob, job)
}

View File

@ -29,7 +29,7 @@ const (
// 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)
// 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.

View File

@ -68,7 +68,7 @@ func (a *HorizontalController) Run(syncPeriod time.Duration) {
}, 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)
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
}
hpa.Status = experimental.HorizontalPodAutoscalerStatus{
hpa.Status = extensions.HorizontalPodAutoscalerStatus{
CurrentReplicas: currentReplicas,
DesiredReplicas: desiredReplicas,
CurrentConsumption: currentConsumption,

View File

@ -77,16 +77,16 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake {
fakeClient := &testclient.Fake{}
fakeClient.AddReactor("list", "horizontalpodautoscalers", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
obj := &experimental.HorizontalPodAutoscalerList{
Items: []experimental.HorizontalPodAutoscaler{
obj := &extensions.HorizontalPodAutoscalerList{
Items: []extensions.HorizontalPodAutoscaler{
{
ObjectMeta: api.ObjectMeta{
Name: hpaName,
Namespace: namespace,
SelfLink: "experimental/v1/namespaces/" + namespace + "/horizontalpodautoscalers/" + hpaName,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Kind: "replicationController",
Name: rcName,
Namespace: namespace,
@ -94,7 +94,7 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake {
},
MinReplicas: tc.minReplicas,
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) {
obj := &experimental.Scale{
obj := &extensions.Scale{
ObjectMeta: api.ObjectMeta{
Name: rcName,
Namespace: namespace,
},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: tc.initialReplicas,
},
Status: experimental.ScaleStatus{
Status: extensions.ScaleStatus{
Replicas: tc.initialReplicas,
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) {
obj := action.(testclient.UpdateAction).GetObject().(*experimental.Scale)
replicas := action.(testclient.UpdateAction).GetObject().(*experimental.Scale).Spec.Replicas
obj := action.(testclient.UpdateAction).GetObject().(*extensions.Scale)
replicas := action.(testclient.UpdateAction).GetObject().(*extensions.Scale).Spec.Replicas
assert.Equal(t, tc.desiredReplicas, replicas)
tc.scaleUpdated = true
return true, obj, nil
})
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, hpaName, obj.Name)
assert.Equal(t, tc.desiredReplicas, obj.Status.DesiredReplicas)

View File

@ -47,12 +47,12 @@ type MetricsClient interface {
type ResourceConsumptionClient interface {
// 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
// pods included in the aggregation.
type metricAggregator func(heapster.MetricResultList) (experimental.ResourceConsumption, int)
type metricAggregator func(heapster.MetricResultList) (extensions.ResourceConsumption, int)
type metricDefinition struct {
name string
@ -76,23 +76,23 @@ func NewHeapsterMetricsClient(client client.Interface) *HeapsterMetricsClient {
var heapsterMetricDefinitions = map[api.ResourceName]metricDefinition{
api.ResourceCPU: {"cpu-usage",
func(metrics heapster.MetricResultList) (experimental.ResourceConsumption, int) {
func(metrics heapster.MetricResultList) (extensions.ResourceConsumption, int) {
sum, count := calculateSumFromLatestSample(metrics)
value := "0"
if count > 0 {
// assumes that cpu usage is in millis
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",
func(metrics heapster.MetricResultList) (experimental.ResourceConsumption, int) {
func(metrics heapster.MetricResultList) (extensions.ResourceConsumption, int) {
sum, count := calculateSumFromLatestSample(metrics)
value := int64(0)
if count > 0 {
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).
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)
}
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]
if !metricDefined {
return nil, fmt.Errorf("heapster metric not defined for %v", resourceName)

View File

@ -122,7 +122,7 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake {
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)
if tc.desiredError != nil {
return

View File

@ -880,7 +880,7 @@ func (d *JobDescriber) Describe(namespace, name string) (string, error) {
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 {
fmt.Fprintf(out, "Name:\t%s\n", job.Name)
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)
}
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 {
fmt.Fprintf(out, "Name:\t%s\n", daemon.Name)
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).
// TODO: write an interface for controllers and fuse getReplicationControllersForLabels
// 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
// TODO: this needs a namespace scope as argument
dss, err := c.List(labels.Everything())
@ -1457,7 +1457,7 @@ func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.La
}
// Find the ones that match labelsToMatch.
var matchingDaemonSets []experimental.DaemonSet
var matchingDaemonSets []extensions.DaemonSet
for _, ds := range dss.Items {
selector := labels.SelectorFromSet(ds.Spec.Selector)
if selector.Matches(labelsToMatch) {

View File

@ -481,12 +481,12 @@ func TestPersistentVolumeDescriber(t *testing.T) {
}
func TestDescribeDeployment(t *testing.T) {
fake := testclient.NewSimpleFake(&experimental.Deployment{
fake := testclient.NewSimpleFake(&extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: "bar",
Namespace: "foo",
},
Spec: experimental.DeploymentSpec{
Spec: extensions.DeploymentSpec{
Template: &api.PodTemplateSpec{},
},
})

View File

@ -723,7 +723,7 @@ func printReplicationControllerList(list *api.ReplicationControllerList, w io.Wr
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
namespace := job.Namespace
containers := job.Spec.Template.Spec.Containers
@ -766,7 +766,7 @@ func printJob(job *experimental.Job, w io.Writer, withNamespace bool, wide bool,
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 {
if err := printJob(&job, w, withNamespace, wide, showAll, columnLabels); err != nil {
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.
func backendStringer(backend *experimental.IngressBackend) string {
func backendStringer(backend *extensions.IngressBackend) string {
if backend == nil {
return ""
}
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
namespace := ingress.Namespace
@ -912,7 +912,7 @@ func printIngress(ingress *experimental.Ingress, w io.Writer, withNamespace, wid
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 {
if err := printIngress(&ingress, w, withNamespace, wide, true, columnLabels); err != nil {
return err
@ -921,7 +921,7 @@ func printIngressList(ingressList *experimental.IngressList, w io.Writer, withNa
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
namespace := ds.Namespace
@ -966,7 +966,7 @@ func printDaemonSet(ds *experimental.DaemonSet, w io.Writer, withNamespace bool,
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 {
if err := printDaemonSet(&ds, w, withNamespace, wide, showAll, columnLabels); err != nil {
return err
@ -1330,7 +1330,7 @@ func printComponentStatusList(list *api.ComponentStatusList, w io.Writer, withNa
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))
for ix := range rsrc.Versions {
version := &rsrc.Versions[ix]
@ -1343,7 +1343,7 @@ func printThirdPartyResource(rsrc *experimental.ThirdPartyResource, w io.Writer,
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 {
if err := printThirdPartyResource(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
return err
@ -1353,7 +1353,7 @@ func printThirdPartyResourceList(list *experimental.ThirdPartyResourceList, w io
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 _, err := fmt.Fprintf(w, "%s\t", deployment.Namespace); err != nil {
return err
@ -1369,7 +1369,7 @@ func printDeployment(deployment *experimental.Deployment, w io.Writer, withNames
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 {
if err := printDeployment(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
return err
@ -1378,7 +1378,7 @@ func printDeploymentList(list *experimental.DeploymentList, w io.Writer, withNam
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
name := hpa.Name
reference := fmt.Sprintf("%s/%s/%s/%s",
@ -1415,7 +1415,7 @@ func printHorizontalPodAutoscaler(hpa *experimental.HorizontalPodAutoscaler, w i
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 {
if err := printHorizontalPodAutoscaler(&list.Items[i], w, withNamespace, wide, showAll, columnLabels); err != nil {
return err

View File

@ -1236,22 +1236,22 @@ func TestTranslateTimestamp(t *testing.T) {
func TestPrintDeployment(t *testing.T) {
tests := []struct {
deployment experimental.Deployment
deployment extensions.Deployment
expect string
}{
{
experimental.Deployment{
extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: "test1",
CreationTimestamp: unversioned.Time{Time: time.Now().Add(1.9e9)},
},
Spec: experimental.DeploymentSpec{
Spec: extensions.DeploymentSpec{
Replicas: 5,
Template: &api.PodTemplateSpec{
Spec: api.PodSpec{Containers: make([]api.Container, 2)},
},
},
Status: experimental.DeploymentStatus{
Status: extensions.DeploymentStatus{
Replicas: 10,
UpdatedReplicas: 2,
},

View File

@ -83,7 +83,7 @@ func (precondition *ScalePrecondition) ValidateReplicationController(controller
}
// 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 {
return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), "nil"}
}

View File

@ -53,17 +53,17 @@ type ErrorJobs struct {
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 {
return nil, kerrors.NewInvalid(job.Kind, job.Name, nil)
}
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
return &experimental.Job{
Spec: experimental.JobSpec{
return &extensions.Job{
Spec: extensions.JobSpec{
Parallelism: &zero,
},
}, nil
@ -325,7 +325,7 @@ func TestJobScale(t *testing.T) {
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)
}
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)
}
}
@ -351,8 +351,8 @@ func TestJobScaleInvalid(t *testing.T) {
func TestJobScaleFailsPreconditions(t *testing.T) {
ten := 10
fake := testclient.NewSimpleFake(&experimental.Job{
Spec: experimental.JobSpec{
fake := testclient.NewSimpleFake(&extensions.Job{
Spec: extensions.JobSpec{
Parallelism: &ten,
},
})
@ -375,7 +375,7 @@ func TestValidateJob(t *testing.T) {
zero, ten, twenty := 0, 10, 20
tests := []struct {
preconditions ScalePrecondition
job experimental.Job
job extensions.Job
expectError bool
test string
}{
@ -386,11 +386,11 @@ func TestValidateJob(t *testing.T) {
},
{
preconditions: ScalePrecondition{-1, ""},
job: experimental.Job{
job: extensions.Job{
ObjectMeta: api.ObjectMeta{
ResourceVersion: "foo",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &ten,
},
},
@ -399,11 +399,11 @@ func TestValidateJob(t *testing.T) {
},
{
preconditions: ScalePrecondition{0, ""},
job: experimental.Job{
job: extensions.Job{
ObjectMeta: api.ObjectMeta{
ResourceVersion: "foo",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &zero,
},
},
@ -412,11 +412,11 @@ func TestValidateJob(t *testing.T) {
},
{
preconditions: ScalePrecondition{-1, "foo"},
job: experimental.Job{
job: extensions.Job{
ObjectMeta: api.ObjectMeta{
ResourceVersion: "foo",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &ten,
},
},
@ -425,11 +425,11 @@ func TestValidateJob(t *testing.T) {
},
{
preconditions: ScalePrecondition{10, "foo"},
job: experimental.Job{
job: extensions.Job{
ObjectMeta: api.ObjectMeta{
ResourceVersion: "foo",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &ten,
},
},
@ -438,11 +438,11 @@ func TestValidateJob(t *testing.T) {
},
{
preconditions: ScalePrecondition{10, "foo"},
job: experimental.Job{
job: extensions.Job{
ObjectMeta: api.ObjectMeta{
ResourceVersion: "foo",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &twenty,
},
},
@ -451,7 +451,7 @@ func TestValidateJob(t *testing.T) {
},
{
preconditions: ScalePrecondition{10, "foo"},
job: experimental.Job{
job: extensions.Job{
ObjectMeta: api.ObjectMeta{
ResourceVersion: "foo",
},
@ -461,11 +461,11 @@ func TestValidateJob(t *testing.T) {
},
{
preconditions: ScalePrecondition{10, "foo"},
job: experimental.Job{
job: extensions.Job{
ObjectMeta: api.ObjectMeta{
ResourceVersion: "bar",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &ten,
},
},
@ -474,11 +474,11 @@ func TestValidateJob(t *testing.T) {
},
{
preconditions: ScalePrecondition{10, "foo"},
job: experimental.Job{
job: extensions.Job{
ObjectMeta: api.ObjectMeta{
ResourceVersion: "bar",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &twenty,
},
},

View File

@ -286,23 +286,23 @@ func TestJobStop(t *testing.T) {
{
Name: "OnlyOneJob",
Objs: []runtime.Object{
&experimental.Job{ // GET
&extensions.Job{ // GET
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: ns,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &zero,
Selector: map[string]string{"k1": "v1"}},
},
&experimental.JobList{ // LIST
Items: []experimental.Job{
&extensions.JobList{ // LIST
Items: []extensions.Job{
{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: ns,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &zero,
Selector: map[string]string{"k1": "v1"}},
},

View File

@ -507,11 +507,11 @@ type FooList struct {
func initThirdParty(t *testing.T, version string) (*Master, *tools.FakeEtcdClient, *httptest.Server, *assert.Assertions) {
master, _, assert := setUp(t)
master.thirdPartyResources = map[string]*thirdpartyresourcedatastorage.REST{}
api := &experimental.ThirdPartyResource{
api := &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{
Name: "foo.company.com",
},
Versions: []experimental.APIVersion{
Versions: []extensions.APIVersion{
{
APIGroup: "group",
Name: version,
@ -630,7 +630,7 @@ func encodeToThirdParty(name string, obj interface{}) ([]byte, error) {
if err != nil {
return nil, err
}
thirdPartyData := experimental.ThirdPartyResourceData{
thirdPartyData := extensions.ThirdPartyResourceData{
ObjectMeta: api.ObjectMeta{Name: name},
Data: serial,
}
@ -778,7 +778,7 @@ func testInstallThirdPartyAPIPostForVersion(t *testing.T, version string) {
if err != nil {
t.Errorf("unexpected error: %v", err)
}
thirdPartyObj, ok := obj.(*experimental.ThirdPartyResourceData)
thirdPartyObj, ok := obj.(*extensions.ThirdPartyResourceData)
if !ok {
t.Errorf("unexpected object: %v", obj)
}

View File

@ -39,10 +39,10 @@ var daemonPrefix = "/daemonsets"
// NewREST returns a RESTStorage object that will work against DaemonSets.
func NewREST(s storage.Interface) (*REST, *StatusREST) {
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: 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
// by combining the namespace in the context with the given prefix
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
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
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
@ -83,7 +83,7 @@ type StatusREST struct {
}
func (r *StatusREST) New() runtime.Object {
return &experimental.DaemonSet{}
return &extensions.DaemonSet{}
}
// Update alters the status subset of an object.

View File

@ -34,13 +34,13 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient) {
return storage, statusStorage, fakeClient
}
func newValidDaemonSet() *experimental.DaemonSet {
return &experimental.DaemonSet{
func newValidDaemonSet() *extensions.DaemonSet {
return &extensions.DaemonSet{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: api.NamespaceDefault,
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: map[string]string{"a": "b"},
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{
@ -73,8 +73,8 @@ func TestCreate(t *testing.T) {
// valid
ds,
// invalid (invalid selector)
&experimental.DaemonSet{
Spec: experimental.DaemonSetSpec{
&extensions.DaemonSet{
Spec: extensions.DaemonSetSpec{
Selector: map[string]string{},
Template: validDaemonSet.Spec.Template,
},
@ -90,28 +90,28 @@ func TestUpdate(t *testing.T) {
newValidDaemonSet(),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.DaemonSet)
object := obj.(*extensions.DaemonSet)
object.Spec.Template.Spec.NodeSelector = map[string]string{"c": "d"}
return object
},
// invalid updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.DaemonSet)
object := obj.(*extensions.DaemonSet)
object.UID = "newUID"
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.DaemonSet)
object := obj.(*extensions.DaemonSet)
object.Name = ""
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.DaemonSet)
object := obj.(*extensions.DaemonSet)
object.Spec.Template.Spec.RestartPolicy = api.RestartPolicyOnFailure
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.DaemonSet)
object := obj.(*extensions.DaemonSet)
object.Spec.Selector = map[string]string{}
return object
},

View File

@ -46,16 +46,16 @@ func (daemonSetStrategy) NamespaceScoped() bool {
// PrepareForCreate clears the status of a daemon set before creation.
func (daemonSetStrategy) PrepareForCreate(obj runtime.Object) {
daemonSet := obj.(*experimental.DaemonSet)
daemonSet.Status = experimental.DaemonSetStatus{}
daemonSet := obj.(*extensions.DaemonSet)
daemonSet.Status = extensions.DaemonSetStatus{}
daemonSet.Generation = 1
}
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
func (daemonSetStrategy) PrepareForUpdate(obj, old runtime.Object) {
newDaemonSet := obj.(*experimental.DaemonSet)
oldDaemonSet := old.(*experimental.DaemonSet)
newDaemonSet := obj.(*extensions.DaemonSet)
oldDaemonSet := old.(*extensions.DaemonSet)
// update is not allowed to set status
newDaemonSet.Status = oldDaemonSet.Status
@ -78,7 +78,7 @@ func (daemonSetStrategy) PrepareForUpdate(obj, old runtime.Object) {
// Validate validates a new daemon set.
func (daemonSetStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
daemonSet := obj.(*experimental.DaemonSet)
daemonSet := obj.(*extensions.DaemonSet)
return validation.ValidateDaemonSet(daemonSet)
}
@ -90,8 +90,8 @@ func (daemonSetStrategy) AllowCreateOnUpdate() bool {
// ValidateUpdate is the default update validation for an end user.
func (daemonSetStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
validationErrorList := validation.ValidateDaemonSet(obj.(*experimental.DaemonSet))
updateErrorList := validation.ValidateDaemonSetUpdate(old.(*experimental.DaemonSet), obj.(*experimental.DaemonSet))
validationErrorList := validation.ValidateDaemonSet(obj.(*extensions.DaemonSet))
updateErrorList := validation.ValidateDaemonSetUpdate(old.(*extensions.DaemonSet), obj.(*extensions.DaemonSet))
return append(validationErrorList, updateErrorList...)
}
@ -101,7 +101,7 @@ func (daemonSetStrategy) AllowUnconditionalUpdate() bool {
}
// 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{
"metadata.name": daemon.Name,
}
@ -115,7 +115,7 @@ func MatchDaemonSet(label labels.Selector, field fields.Selector) generic.Matche
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
ds, ok := obj.(*experimental.DaemonSet)
ds, ok := obj.(*extensions.DaemonSet)
if !ok {
return nil, nil, fmt.Errorf("given object is not a ds.")
}
@ -131,11 +131,11 @@ type daemonSetStatusStrategy struct {
var StatusStrategy = daemonSetStatusStrategy{Strategy}
func (daemonSetStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
newDaemonSet := obj.(*experimental.DaemonSet)
oldDaemonSet := old.(*experimental.DaemonSet)
newDaemonSet := obj.(*extensions.DaemonSet)
oldDaemonSet := old.(*extensions.DaemonSet)
newDaemonSet.Spec = oldDaemonSet.Spec
}
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))
}

View File

@ -56,9 +56,9 @@ type REST struct {
func NewREST(s storage.Interface) *REST {
prefix := "/deployments"
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: 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
// by combining the namespace in the context with the given prefix.
KeyRootFunc: func(ctx api.Context) string {
@ -71,7 +71,7 @@ func NewREST(s storage.Interface) *REST {
},
// Retrieve the name field of a deployment.
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.
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
@ -99,7 +99,7 @@ var _ = rest.Patcher(&ScaleREST{})
// New creates a new Scale 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) {
@ -107,16 +107,16 @@ func (r *ScaleREST) Get(ctx api.Context, name string) (runtime.Object, error) {
if err != nil {
return nil, errors.NewNotFound("scale", name)
}
return &experimental.Scale{
return &extensions.Scale{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: deployment.Namespace,
CreationTimestamp: deployment.CreationTimestamp,
},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: deployment.Spec.Replicas,
},
Status: experimental.ScaleStatus{
Status: extensions.ScaleStatus{
Replicas: deployment.Status.Replicas,
Selector: deployment.Spec.Selector,
},
@ -127,7 +127,7 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
if obj == nil {
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
}
scale, ok := obj.(*experimental.Scale)
scale, ok := obj.(*extensions.Scale)
if !ok {
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 {
return nil, false, errors.NewConflict("scale", scale.Name, err)
}
return &experimental.Scale{
return &extensions.Scale{
ObjectMeta: api.ObjectMeta{
Name: deployment.Name,
Namespace: deployment.Namespace,
CreationTimestamp: deployment.CreationTimestamp,
},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: deployment.Spec.Replicas,
},
Status: experimental.ScaleStatus{
Status: extensions.ScaleStatus{
Replicas: deployment.Status.Replicas,
Selector: deployment.Spec.Selector,
},

View File

@ -40,13 +40,13 @@ func newStorage(t *testing.T) (*DeploymentStorage, *tools.FakeEtcdClient) {
var namespace = "foo-namespace"
var name = "foo-deployment"
func validNewDeployment() *experimental.Deployment {
return &experimental.Deployment{
func validNewDeployment() *extensions.Deployment {
return &extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: experimental.DeploymentSpec{
Spec: extensions.DeploymentSpec{
Selector: map[string]string{"a": "b"},
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{
@ -67,7 +67,7 @@ func validNewDeployment() *experimental.Deployment {
UniqueLabelKey: "my-label",
Replicas: 7,
},
Status: experimental.DeploymentStatus{
Status: extensions.DeploymentStatus{
Replicas: 5,
},
}
@ -75,13 +75,13 @@ func validNewDeployment() *experimental.Deployment {
var validDeployment = *validNewDeployment()
func validNewScale() *experimental.Scale {
return &experimental.Scale{
func validNewScale() *extensions.Scale {
return &extensions.Scale{
ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: validDeployment.Spec.Replicas,
},
Status: experimental.ScaleStatus{
Status: extensions.ScaleStatus{
Replicas: validDeployment.Status.Replicas,
Selector: validDeployment.Spec.Template.Labels,
},
@ -99,8 +99,8 @@ func TestCreate(t *testing.T) {
// valid
deployment,
// invalid (invalid selector)
&experimental.Deployment{
Spec: experimental.DeploymentSpec{
&extensions.Deployment{
Spec: extensions.DeploymentSpec{
Selector: map[string]string{},
Template: validDeployment.Spec.Template,
},
@ -116,28 +116,28 @@ func TestUpdate(t *testing.T) {
validNewDeployment(),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Deployment)
object := obj.(*extensions.Deployment)
object.Spec.Template.Spec.NodeSelector = map[string]string{"c": "d"}
return object
},
// invalid updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Deployment)
object := obj.(*extensions.Deployment)
object.UID = "newUID"
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Deployment)
object := obj.(*extensions.Deployment)
object.Name = ""
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Deployment)
object := obj.(*extensions.Deployment)
object.Spec.Template.Spec.RestartPolicy = api.RestartPolicyOnFailure
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Deployment)
object := obj.(*extensions.Deployment)
object.Spec.Selector = map[string]string{}
return object
},
@ -197,7 +197,7 @@ func TestScaleGet(t *testing.T) {
expect := &validScale
obj, err := storage.Scale.Get(ctx, name)
scale := obj.(*experimental.Scale)
scale := obj.(*extensions.Scale)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -215,9 +215,9 @@ func TestScaleUpdate(t *testing.T) {
t.Fatalf("unexpected error: %v", err)
}
replicas := 12
update := experimental.Scale{
update := extensions.Scale{
ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: replicas,
},
}
@ -230,7 +230,7 @@ func TestScaleUpdate(t *testing.T) {
t.Fatalf("unexpected error: %v", err)
}
var deployment experimental.Deployment
var deployment extensions.Deployment
testapi.Extensions.Codec().DecodeInto([]byte(response.Node.Value), &deployment)
if deployment.Spec.Replicas != replicas {
t.Errorf("wrong replicas count expected: %d got: %d", replicas, deployment.Spec.Replicas)

View File

@ -28,10 +28,10 @@ import (
// Registry is an interface for things that know how to store Deployments.
type Registry interface {
ListDeployments(ctx api.Context, label labels.Selector, field fields.Selector) (*experimental.DeploymentList, error)
GetDeployment(ctx api.Context, deploymentID string) (*experimental.Deployment, error)
CreateDeployment(ctx api.Context, deployment *experimental.Deployment) (*experimental.Deployment, error)
UpdateDeployment(ctx api.Context, deployment *experimental.Deployment) (*experimental.Deployment, error)
ListDeployments(ctx api.Context, label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error)
GetDeployment(ctx api.Context, deploymentID string) (*extensions.Deployment, error)
CreateDeployment(ctx api.Context, deployment *extensions.Deployment) (*extensions.Deployment, error)
UpdateDeployment(ctx api.Context, deployment *extensions.Deployment) (*extensions.Deployment, 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.
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() {
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 {
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)
if err != nil {
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)
if err != nil {
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)
if err != nil {
return nil, err
}
return obj.(*experimental.Deployment), nil
return obj.(*extensions.Deployment), nil
}
func (s *storage) DeleteDeployment(ctx api.Context, deploymentID string) error {

View File

@ -50,7 +50,7 @@ func (deploymentStrategy) PrepareForCreate(obj runtime.Object) {
// Validate validates a new deployment.
func (deploymentStrategy) Validate(ctx api.Context, obj runtime.Object) errs.ValidationErrorList {
deployment := obj.(*experimental.Deployment)
deployment := obj.(*extensions.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.
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 {
@ -73,7 +73,7 @@ func (deploymentStrategy) AllowUnconditionalUpdate() bool {
}
// 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{
"metadata.name": deployment.Name,
}
@ -87,7 +87,7 @@ func MatchDeployment(label labels.Selector, field fields.Selector) generic.Match
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
deployment, ok := obj.(*experimental.Deployment)
deployment, ok := obj.(*extensions.Deployment)
if !ok {
return nil, nil, fmt.Errorf("given object is not a deployment.")
}

View File

@ -57,7 +57,7 @@ var _ = rest.Patcher(&ScaleREST{})
// New creates a new Scale 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) {
@ -65,16 +65,16 @@ func (r *ScaleREST) Get(ctx api.Context, name string) (runtime.Object, error) {
if err != nil {
return nil, errors.NewNotFound("scale", name)
}
return &experimental.Scale{
return &extensions.Scale{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: rc.Namespace,
CreationTimestamp: rc.CreationTimestamp,
},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: rc.Spec.Replicas,
},
Status: experimental.ScaleStatus{
Status: extensions.ScaleStatus{
Replicas: rc.Status.Replicas,
Selector: rc.Spec.Selector,
},
@ -85,7 +85,7 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
if obj == nil {
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
}
scale, ok := obj.(*experimental.Scale)
scale, ok := obj.(*extensions.Scale)
if !ok {
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 {
return nil, false, errors.NewConflict("scale", scale.Name, err)
}
return &experimental.Scale{
return &extensions.Scale{
ObjectMeta: api.ObjectMeta{
Name: rc.Name,
Namespace: rc.Namespace,
CreationTimestamp: rc.CreationTimestamp,
},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: rc.Spec.Replicas,
},
Status: experimental.ScaleStatus{
Status: extensions.ScaleStatus{
Replicas: rc.Status.Replicas,
Selector: rc.Spec.Selector,
},
@ -118,5 +118,5 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
type RcREST struct{}
func (r *RcREST) New() runtime.Object {
return &experimental.ReplicationControllerDummy{}
return &extensions.ReplicationControllerDummy{}
}

View File

@ -66,12 +66,12 @@ var validController = api.ReplicationController{
Spec: validControllerSpec,
}
var validScale = experimental.Scale{
var validScale = extensions.Scale{
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test"},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: validReplicas,
},
Status: experimental.ScaleStatus{
Status: extensions.ScaleStatus{
Replicas: 0,
Selector: validPodTemplate.Template.Labels,
},
@ -88,7 +88,7 @@ func TestGet(t *testing.T) {
expect := &validScale
obj, err := storage.Get(ctx, "foo")
scale := obj.(*experimental.Scale)
scale := obj.(*extensions.Scale)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -106,9 +106,9 @@ func TestUpdate(t *testing.T) {
t.Fatalf("unexpected error: %v", err)
}
replicas := 12
update := experimental.Scale{
update := extensions.Scale{
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test"},
Spec: experimental.ScaleSpec{
Spec: extensions.ScaleSpec{
Replicas: replicas,
},
}

View File

@ -36,9 +36,9 @@ type REST struct {
func NewREST(s storage.Interface) *REST {
prefix := "/horizontalpodautoscalers"
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: 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
// by combining the namespace in the context with the given prefix
KeyRootFunc: func(ctx api.Context) string {
@ -51,7 +51,7 @@ func NewREST(s storage.Interface) *REST {
},
// Retrieve the name field of an autoscaler
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
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {

View File

@ -36,19 +36,19 @@ func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient) {
return NewREST(etcdStorage), fakeClient
}
func validNewHorizontalPodAutoscaler(name string) *experimental.HorizontalPodAutoscaler {
return &experimental.HorizontalPodAutoscaler{
func validNewHorizontalPodAutoscaler(name string) *extensions.HorizontalPodAutoscaler {
return &extensions.HorizontalPodAutoscaler{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: api.NamespaceDefault,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Subresource: "scale",
},
MinReplicas: 1,
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
autoscaler,
// invalid
&experimental.HorizontalPodAutoscaler{},
&extensions.HorizontalPodAutoscaler{},
)
}
@ -74,7 +74,7 @@ func TestUpdate(t *testing.T) {
validNewHorizontalPodAutoscaler("foo"),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.HorizontalPodAutoscaler)
object := obj.(*extensions.HorizontalPodAutoscaler)
object.Spec.MaxReplicas = object.Spec.MaxReplicas + 1
return object
},

View File

@ -46,12 +46,12 @@ func (autoscalerStrategy) NamespaceScoped() bool {
// PrepareForCreate clears fields that are not allowed to be set by end users on creation.
func (autoscalerStrategy) PrepareForCreate(obj runtime.Object) {
_ = obj.(*experimental.HorizontalPodAutoscaler)
_ = obj.(*extensions.HorizontalPodAutoscaler)
}
// Validate validates a new autoscaler.
func (autoscalerStrategy) Validate(ctx api.Context, obj runtime.Object) errs.ValidationErrorList {
autoscaler := obj.(*experimental.HorizontalPodAutoscaler)
autoscaler := obj.(*extensions.HorizontalPodAutoscaler)
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.
func (autoscalerStrategy) PrepareForUpdate(obj, old runtime.Object) {
_ = obj.(*experimental.HorizontalPodAutoscaler)
_ = obj.(*extensions.HorizontalPodAutoscaler)
}
// ValidateUpdate is the default update validation for an end user.
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 {
return true
}
func AutoscalerToSelectableFields(limitRange *experimental.HorizontalPodAutoscaler) fields.Set {
func AutoscalerToSelectableFields(limitRange *extensions.HorizontalPodAutoscaler) fields.Set {
return fields.Set{}
}
@ -83,7 +83,7 @@ func MatchAutoscaler(label labels.Selector, field fields.Selector) generic.Match
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
hpa, ok := obj.(*experimental.HorizontalPodAutoscaler)
hpa, ok := obj.(*extensions.HorizontalPodAutoscaler)
if !ok {
return nil, nil, fmt.Errorf("given object is not a horizontal pod autoscaler.")
}

View File

@ -40,10 +40,10 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against replication controllers.
func NewREST(s storage.Interface) *REST {
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: 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
// by combining the namespace in the context with the given prefix
KeyRootFunc: func(ctx api.Context) string {
@ -56,7 +56,7 @@ func NewREST(s storage.Interface) *REST {
},
// Retrieve the name field of a replication controller
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
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {

View File

@ -48,12 +48,12 @@ var (
type IngressRuleValues map[string]string
func toHTTPIngressPaths(pathMap map[string]string) []experimental.HTTPIngressPath {
httpPaths := []experimental.HTTPIngressPath{}
func toHTTPIngressPaths(pathMap map[string]string) []extensions.HTTPIngressPath {
httpPaths := []extensions.HTTPIngressPath{}
for path, backend := range pathMap {
httpPaths = append(httpPaths, experimental.HTTPIngressPath{
httpPaths = append(httpPaths, extensions.HTTPIngressPath{
Path: path,
Backend: experimental.IngressBackend{
Backend: extensions.IngressBackend{
ServiceName: backend,
ServicePort: defaultBackendPort,
},
@ -62,13 +62,13 @@ func toHTTPIngressPaths(pathMap map[string]string) []experimental.HTTPIngressPat
return httpPaths
}
func toIngressRules(hostRules map[string]IngressRuleValues) []experimental.IngressRule {
rules := []experimental.IngressRule{}
func toIngressRules(hostRules map[string]IngressRuleValues) []extensions.IngressRule {
rules := []extensions.IngressRule{}
for host, pathMap := range hostRules {
rules = append(rules, experimental.IngressRule{
rules = append(rules, extensions.IngressRule{
Host: host,
IngressRuleValue: experimental.IngressRuleValue{
HTTP: &experimental.HTTPIngressRuleValue{
IngressRuleValue: extensions.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{
Paths: toHTTPIngressPaths(pathMap),
},
},
@ -77,14 +77,14 @@ func toIngressRules(hostRules map[string]IngressRuleValues) []experimental.Ingre
return rules
}
func newIngress(pathMap map[string]string) *experimental.Ingress {
return &experimental.Ingress{
func newIngress(pathMap map[string]string) *extensions.Ingress {
return &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: experimental.IngressSpec{
Backend: &experimental.IngressBackend{
Spec: extensions.IngressSpec{
Backend: &extensions.IngressBackend{
ServiceName: defaultBackendName,
ServicePort: defaultBackendPort,
},
@ -92,7 +92,7 @@ func newIngress(pathMap map[string]string) *experimental.Ingress {
defaultHostname: pathMap,
}),
},
Status: experimental.IngressStatus{
Status: extensions.IngressStatus{
LoadBalancer: api.LoadBalancerStatus{
Ingress: []api.LoadBalancerIngress{
{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)
}
@ -111,8 +111,8 @@ func TestCreate(t *testing.T) {
test := registrytest.New(t, fakeClient, storage.Etcd)
ingress := validIngress()
noDefaultBackendAndRules := validIngress()
noDefaultBackendAndRules.Spec.Backend = &experimental.IngressBackend{}
noDefaultBackendAndRules.Spec.Rules = []experimental.IngressRule{}
noDefaultBackendAndRules.Spec.Backend = &extensions.IngressBackend{}
noDefaultBackendAndRules.Spec.Rules = []extensions.IngressRule{}
badPath := validIngress()
badPath.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
"foo.bar.com": {"/invalid[": "svc"}})
@ -132,7 +132,7 @@ func TestUpdate(t *testing.T) {
validIngress(),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Ingress)
object := obj.(*extensions.Ingress)
object.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
"bar.foo.com": {"/bar": defaultBackendName},
})
@ -140,19 +140,19 @@ func TestUpdate(t *testing.T) {
},
// invalid updateFunc: ObjeceMeta is not to be tampered with.
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Ingress)
object := obj.(*extensions.Ingress)
object.UID = "newUID"
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Ingress)
object := obj.(*extensions.Ingress)
object.Name = ""
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Ingress)
object := obj.(*extensions.Ingress)
object.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
"foo.bar.com": {"/invalid[": "svc"}})
return object

View File

@ -46,16 +46,16 @@ func (ingressStrategy) NamespaceScoped() bool {
// PrepareForCreate clears the status of an Ingress before creation.
func (ingressStrategy) PrepareForCreate(obj runtime.Object) {
ingress := obj.(*experimental.Ingress)
ingress.Status = experimental.IngressStatus{}
ingress := obj.(*extensions.Ingress)
ingress.Status = extensions.IngressStatus{}
ingress.Generation = 1
}
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
func (ingressStrategy) PrepareForUpdate(obj, old runtime.Object) {
newIngress := obj.(*experimental.Ingress)
oldIngress := old.(*experimental.Ingress)
newIngress := obj.(*extensions.Ingress)
oldIngress := old.(*extensions.Ingress)
//TODO: Clear Ingress status once we have a sub-resource.
// 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.
func (ingressStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
ingress := obj.(*experimental.Ingress)
ingress := obj.(*extensions.Ingress)
err := validation.ValidateIngress(ingress)
return err
}
@ -81,8 +81,8 @@ func (ingressStrategy) AllowCreateOnUpdate() bool {
// ValidateUpdate is the default update validation for an end user.
func (ingressStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
validationErrorList := validation.ValidateIngress(obj.(*experimental.Ingress))
updateErrorList := validation.ValidateIngressUpdate(old.(*experimental.Ingress), obj.(*experimental.Ingress))
validationErrorList := validation.ValidateIngress(obj.(*extensions.Ingress))
updateErrorList := validation.ValidateIngressUpdate(old.(*extensions.Ingress), obj.(*extensions.Ingress))
return append(validationErrorList, updateErrorList...)
}
@ -92,7 +92,7 @@ func (ingressStrategy) AllowUnconditionalUpdate() bool {
}
// 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{
"metadata.name": ingress.Name,
}
@ -106,7 +106,7 @@ func MatchIngress(label labels.Selector, field fields.Selector) generic.Matcher
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
ingress, ok := obj.(*experimental.Ingress)
ingress, ok := obj.(*extensions.Ingress)
if !ok {
return nil, nil, fmt.Errorf("Given object is not an Ingress.")
}

View File

@ -40,10 +40,10 @@ var jobPrefix = "/jobs"
// NewREST returns a RESTStorage object that will work against Jobs.
func NewREST(s storage.Interface) (*REST, *StatusREST) {
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: 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
// by combining the namespace in the context with the given prefix
KeyRootFunc: func(ctx api.Context) string {
@ -56,7 +56,7 @@ func NewREST(s storage.Interface) (*REST, *StatusREST) {
},
// Retrieve the name field of a job
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
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
@ -85,7 +85,7 @@ type StatusREST struct {
}
func (r *StatusREST) New() runtime.Object {
return &experimental.Job{}
return &extensions.Job{}
}
// Update alters the status subset of an object.

View File

@ -36,15 +36,15 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient) {
return storage, statusStorage, fakeClient
}
func validNewJob() *experimental.Job {
func validNewJob() *extensions.Job {
completions := 1
parallelism := 1
return &experimental.Job{
return &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: "default",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Completions: &completions,
Parallelism: &parallelism,
Selector: map[string]string{"a": "b"},
@ -77,8 +77,8 @@ func TestCreate(t *testing.T) {
// valid
validJob,
// invalid (empty selector)
&experimental.Job{
Spec: experimental.JobSpec{
&extensions.Job{
Spec: extensions.JobSpec{
Completions: validJob.Spec.Completions,
Selector: map[string]string{},
Template: validJob.Spec.Template,
@ -96,18 +96,18 @@ func TestUpdate(t *testing.T) {
validNewJob(),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Job)
object := obj.(*extensions.Job)
object.Spec.Parallelism = &two
return object
},
// invalid updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Job)
object := obj.(*extensions.Job)
object.Spec.Selector = map[string]string{}
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Job)
object := obj.(*extensions.Job)
object.Spec.Completions = &two
return object
},

View File

@ -30,15 +30,15 @@ import (
// Registry is an interface for things that know how to store Jobs.
type Registry interface {
// 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(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
// 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(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(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(ctx api.Context, name string) error
}
@ -54,7 +54,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
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() {
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 {
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) {
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)
if err != nil {
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)
if err != nil {
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)
if err != nil {
return nil, err
}
return obj.(*experimental.Job), nil
return obj.(*extensions.Job), nil
}
func (s *storage) DeleteJob(ctx api.Context, name string) error {

View File

@ -46,20 +46,20 @@ func (jobStrategy) NamespaceScoped() bool {
// PrepareForCreate clears the status of a job before creation.
func (jobStrategy) PrepareForCreate(obj runtime.Object) {
job := obj.(*experimental.Job)
job.Status = experimental.JobStatus{}
job := obj.(*extensions.Job)
job.Status = extensions.JobStatus{}
}
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
func (jobStrategy) PrepareForUpdate(obj, old runtime.Object) {
newJob := obj.(*experimental.Job)
oldJob := old.(*experimental.Job)
newJob := obj.(*extensions.Job)
oldJob := old.(*extensions.Job)
newJob.Status = oldJob.Status
}
// Validate validates a new job.
func (jobStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
job := obj.(*experimental.Job)
job := obj.(*extensions.Job)
return validation.ValidateJob(job)
}
@ -74,8 +74,8 @@ func (jobStrategy) AllowCreateOnUpdate() bool {
// ValidateUpdate is the default update validation for an end user.
func (jobStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
validationErrorList := validation.ValidateJob(obj.(*experimental.Job))
updateErrorList := validation.ValidateJobUpdate(old.(*experimental.Job), obj.(*experimental.Job))
validationErrorList := validation.ValidateJob(obj.(*extensions.Job))
updateErrorList := validation.ValidateJobUpdate(old.(*extensions.Job), obj.(*extensions.Job))
return append(validationErrorList, updateErrorList...)
}
@ -86,17 +86,17 @@ type jobStatusStrategy struct {
var StatusStrategy = jobStatusStrategy{Strategy}
func (jobStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
newJob := obj.(*experimental.Job)
oldJob := old.(*experimental.Job)
newJob := obj.(*extensions.Job)
oldJob := old.(*extensions.Job)
newJob.Spec = oldJob.Spec
}
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.
func JobToSelectableFields(job *experimental.Job) fields.Set {
func JobToSelectableFields(job *extensions.Job) fields.Set {
return fields.Set{
"metadata.name": job.Name,
"status.successful": strconv.Itoa(job.Status.Succeeded),
@ -111,7 +111,7 @@ func MatchJob(label labels.Selector, field fields.Selector) generic.Matcher {
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
job, ok := obj.(*experimental.Job)
job, ok := obj.(*extensions.Job)
if !ok {
return nil, nil, fmt.Errorf("Given object is not a job.")
}

View File

@ -43,16 +43,16 @@ func TestJobStrategy(t *testing.T) {
Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}},
},
}
job := &experimental.Job{
job := &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "myjob",
Namespace: api.NamespaceDefault,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: validSelector,
Template: &validPodTemplateSpec,
},
Status: experimental.JobStatus{
Status: extensions.JobStatus{
Active: 11,
},
}
@ -66,12 +66,12 @@ func TestJobStrategy(t *testing.T) {
t.Errorf("Unexpected error validating %v", errs)
}
parallelism := 10
updatedJob := &experimental.Job{
updatedJob := &extensions.Job{
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "4"},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &parallelism,
},
Status: experimental.JobStatus{
Status: extensions.JobStatus{
Active: 11,
},
}
@ -108,33 +108,33 @@ func TestJobStatusStrategy(t *testing.T) {
}
oldParallelism := 10
newParallelism := 11
oldJob := &experimental.Job{
oldJob := &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "myjob",
Namespace: api.NamespaceDefault,
ResourceVersion: "10",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: validSelector,
Template: &validPodTemplateSpec,
Parallelism: &oldParallelism,
},
Status: experimental.JobStatus{
Status: extensions.JobStatus{
Active: 11,
},
}
newJob := &experimental.Job{
newJob := &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: "myjob",
Namespace: api.NamespaceDefault,
ResourceVersion: "9",
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Selector: validSelector,
Template: &validPodTemplateSpec,
Parallelism: &newParallelism,
},
Status: experimental.JobStatus{
Status: extensions.JobStatus{
Active: 12,
},
}

View File

@ -38,8 +38,8 @@ func NewREST(s storage.Interface) *REST {
prefix := "/thirdpartyresources"
store := &etcdgeneric.Etcd{
NewFunc: func() runtime.Object { return &experimental.ThirdPartyResource{} },
NewListFunc: func() runtime.Object { return &experimental.ThirdPartyResourceList{} },
NewFunc: func() runtime.Object { return &extensions.ThirdPartyResource{} },
NewListFunc: func() runtime.Object { return &extensions.ThirdPartyResourceList{} },
KeyRootFunc: func(ctx api.Context) string {
return etcdgeneric.NamespaceKeyRootFunc(ctx, prefix)
},
@ -47,7 +47,7 @@ func NewREST(s storage.Interface) *REST {
return etcdgeneric.NamespaceKeyFunc(ctx, prefix, id)
},
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 {
return thirdpartyresource.Matcher(label, field)

View File

@ -35,13 +35,13 @@ func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient) {
return NewREST(etcdStorage), fakeClient
}
func validNewThirdPartyResource(name string) *experimental.ThirdPartyResource {
return &experimental.ThirdPartyResource{
func validNewThirdPartyResource(name string) *extensions.ThirdPartyResource {
return &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: api.NamespaceDefault,
},
Versions: []experimental.APIVersion{
Versions: []extensions.APIVersion{
{
Name: "stable/v1",
},
@ -58,7 +58,7 @@ func TestCreate(t *testing.T) {
// valid
rsrc,
// invalid
&experimental.ThirdPartyResource{},
&extensions.ThirdPartyResource{},
)
}
@ -70,7 +70,7 @@ func TestUpdate(t *testing.T) {
validNewThirdPartyResource("foo"),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.ThirdPartyResource)
object := obj.(*extensions.ThirdPartyResource)
object.Description = "new description"
return object
},

View File

@ -52,7 +52,7 @@ func (strategy) PrepareForCreate(obj runtime.Object) {
}
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 {
@ -63,7 +63,7 @@ func (strategy) PrepareForUpdate(obj, old runtime.Object) {
}
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 {
@ -73,7 +73,7 @@ func (strategy) AllowUnconditionalUpdate() bool {
// Matcher returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
sa, ok := obj.(*experimental.ThirdPartyResource)
sa, ok := obj.(*extensions.ThirdPartyResource)
if !ok {
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
func SelectableFields(obj *experimental.ThirdPartyResource) labels.Set {
func SelectableFields(obj *extensions.ThirdPartyResource) labels.Set {
return labels.Set{}
}

View File

@ -105,7 +105,7 @@ func NewCodec(codec runtime.Codec, kind string) runtime.Codec {
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{}
if err := json.Unmarshal(data, &obj); err != nil {
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)
}
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{}
if err := json.Unmarshal(data, &typeMeta); err != nil {
return err
@ -146,7 +146,7 @@ func (t *thirdPartyResourceDataCodec) populateFromObject(objIn *experimental.Thi
}
func (t *thirdPartyResourceDataCodec) Decode(data []byte) (runtime.Object, error) {
result := &experimental.ThirdPartyResourceData{}
result := &extensions.ThirdPartyResourceData{}
if err := t.populate(result, data); err != nil {
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 {
thirdParty, ok := obj.(*experimental.ThirdPartyResourceData)
thirdParty, ok := obj.(*extensions.ThirdPartyResourceData)
if !ok {
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 {
thirdParty, ok := obj.(*experimental.ThirdPartyResourceData)
thirdParty, ok := obj.(*extensions.ThirdPartyResourceData)
if !ok {
return fmt.Errorf("unexpected object: %#v", obj)
}
@ -226,7 +226,7 @@ const template = `{
"items": [ %s ]
}`
func encodeToJSON(obj *experimental.ThirdPartyResourceData, stream io.Writer) error {
func encodeToJSON(obj *extensions.ThirdPartyResourceData, stream io.Writer) error {
var objOut interface{}
if err := json.Unmarshal(obj.Data, &objOut); err != nil {
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) {
switch obj := obj.(type) {
case *experimental.ThirdPartyResourceData:
case *extensions.ThirdPartyResourceData:
return encodeToJSON(obj, stream)
case *experimental.ThirdPartyResourceDataList:
case *extensions.ThirdPartyResourceDataList:
// TODO: There must be a better way to do this...
dataStrings := make([]string, len(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 {
return nil, fmt.Errorf("unknown version %s for kind %s", groupVersion, kind)
}
return &experimental.ThirdPartyResourceData{}, nil
return &extensions.ThirdPartyResourceData{}, nil
case "ThirdPartyResourceDataList":
if apiutil.GetGroupVersion(t.group, t.version) != groupVersion {
return nil, fmt.Errorf("unknown version %s for kind %s", groupVersion, kind)
}
return &experimental.ThirdPartyResourceDataList{}, nil
return &extensions.ThirdPartyResourceDataList{}, nil
default:
return t.delegate.New(groupVersion, kind)
}

View File

@ -103,7 +103,7 @@ func TestCodec(t *testing.T) {
}
continue
}
rsrcObj, ok := obj.(*experimental.ThirdPartyResourceData)
rsrcObj, ok := obj.(*extensions.ThirdPartyResourceData)
if !ok {
t.Errorf("[%s] unexpected object: %v", test.name, obj)
continue
@ -149,7 +149,7 @@ func TestCreater(t *testing.T) {
name: "valid ThirdPartyResourceData creation",
version: "creater group/creater version",
kind: "ThirdPartyResourceData",
expectedObj: &experimental.ThirdPartyResourceData{},
expectedObj: &extensions.ThirdPartyResourceData{},
expectErr: false,
},
{

View File

@ -40,8 +40,8 @@ func NewREST(s storage.Interface, group, kind string) *REST {
prefix := "/ThirdPartyResourceData/" + group + "/" + strings.ToLower(kind) + "s"
store := &etcdgeneric.Etcd{
NewFunc: func() runtime.Object { return &experimental.ThirdPartyResourceData{} },
NewListFunc: func() runtime.Object { return &experimental.ThirdPartyResourceDataList{} },
NewFunc: func() runtime.Object { return &extensions.ThirdPartyResourceData{} },
NewListFunc: func() runtime.Object { return &extensions.ThirdPartyResourceDataList{} },
KeyRootFunc: func(ctx api.Context) string {
return etcdgeneric.NamespaceKeyRootFunc(ctx, prefix)
},
@ -49,7 +49,7 @@ func NewREST(s storage.Interface, group, kind string) *REST {
return etcdgeneric.NamespaceKeyFunc(ctx, prefix, id)
},
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 {
return thirdpartyresourcedata.Matcher(label, field)

View File

@ -35,8 +35,8 @@ func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient) {
return NewREST(etcdStorage, "foo", "bar"), fakeClient
}
func validNewThirdPartyResourceData(name string) *experimental.ThirdPartyResourceData {
return &experimental.ThirdPartyResourceData{
func validNewThirdPartyResourceData(name string) *extensions.ThirdPartyResourceData {
return &extensions.ThirdPartyResourceData{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: api.NamespaceDefault,
@ -54,7 +54,7 @@ func TestCreate(t *testing.T) {
// valid
rsrc,
// invalid
&experimental.ThirdPartyResourceData{},
&extensions.ThirdPartyResourceData{},
)
}
@ -66,7 +66,7 @@ func TestUpdate(t *testing.T) {
validNewThirdPartyResourceData("foo"),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.ThirdPartyResourceData)
object := obj.(*extensions.ThirdPartyResourceData)
object.Data = []byte("new description")
return object
},

View File

@ -28,15 +28,15 @@ import (
// Registry is an interface implemented by things that know how to store ThirdPartyResourceData objects.
type Registry interface {
// 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
WatchThirdPartyResourceData(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
// 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.
CreateThirdPartyResourceData(ctx api.Context, resource *experimental.ThirdPartyResourceData) (*experimental.ThirdPartyResourceData, error)
CreateThirdPartyResourceData(ctx api.Context, resource *extensions.ThirdPartyResourceData) (*extensions.ThirdPartyResourceData, error)
// 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
DeleteThirdPartyResourceData(ctx api.Context, name string) error
}
@ -52,34 +52,34 @@ func NewRegistry(s rest.StandardStorage) Registry {
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())
if err != nil {
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) {
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)
if err != nil {
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)
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)
return obj.(*experimental.ThirdPartyResourceData), err
return obj.(*extensions.ThirdPartyResourceData), err
}
func (s *storage) DeleteThirdPartyResourceData(ctx api.Context, name string) error {

View File

@ -52,7 +52,7 @@ func (strategy) PrepareForCreate(obj runtime.Object) {
}
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 {
@ -63,7 +63,7 @@ func (strategy) PrepareForUpdate(obj, old runtime.Object) {
}
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 {
@ -73,7 +73,7 @@ func (strategy) AllowUnconditionalUpdate() bool {
// Matcher returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
sa, ok := obj.(*experimental.ThirdPartyResourceData)
sa, ok := obj.(*extensions.ThirdPartyResourceData)
if !ok {
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
func SelectableFields(obj *experimental.ThirdPartyResourceData) labels.Set {
func SelectableFields(obj *extensions.ThirdPartyResourceData) labels.Set {
return labels.Set{}
}

View File

@ -40,7 +40,7 @@ func convertToCamelCase(input string) string {
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, ".")
if len(parts) < 3 {
return "", "", fmt.Errorf("unexpectedly short resource name: %s, expected at least <kind>.<domain>.<tld>", rsrc.Name)

View File

@ -47,7 +47,7 @@ func TestExtractAPIGroupAndKind(t *testing.T) {
}
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 {
t.Errorf("unexpected error: %v", err)
continue

View File

@ -29,7 +29,7 @@ import (
)
// 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
// 1. Find all pods whose labels match deployment.Spec.Selector
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 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
rcList, err := c.ReplicationControllers(namespace).List(labels.Everything())
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.
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.
newRCTemplate := &api.PodTemplateSpec{
ObjectMeta: deployment.Spec.Template.ObjectMeta,

View File

@ -74,11 +74,11 @@ var _ = Describe("Daemon set", func() {
label := map[string]string{daemonsetNameLabel: 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{
Name: dsName,
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{
Labels: label,
@ -129,11 +129,11 @@ var _ = Describe("Daemon set", func() {
complexLabel := map[string]string{daemonsetNameLabel: dsName}
nodeSelector := map[string]string{daemonsetColorLabel: "blue"}
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{
Name: dsName,
},
Spec: experimental.DaemonSetSpec{
Spec: extensions.DaemonSetSpec{
Selector: complexLabel,
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{

View File

@ -46,11 +46,11 @@ func testNewDeployment(f *Framework) {
deploymentName := "nginx-deployment"
podLabels := map[string]string{"name": "nginx"}
Logf("Creating simple deployment %s", deploymentName)
_, err := c.Deployments(ns).Create(&experimental.Deployment{
_, err := c.Deployments(ns).Create(&extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: deploymentName,
},
Spec: experimental.DeploymentSpec{
Spec: extensions.DeploymentSpec{
Replicas: 1,
Selector: podLabels,
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.
deploymentName := "redis-deployment"
Logf("Creating deployment %s", deploymentName)
newDeployment := experimental.Deployment{
newDeployment := extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: deploymentName,
},
Spec: experimental.DeploymentSpec{
Spec: extensions.DeploymentSpec{
Replicas: 3,
Selector: deploymentPodLabels,
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.
deploymentName := "redis-deployment"
Logf("Creating deployment %s", deploymentName)
newDeployment := experimental.Deployment{
newDeployment := extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: deploymentName,
},
Spec: experimental.DeploymentSpec{
Spec: extensions.DeploymentSpec{
Replicas: 1,
Selector: deploymentPodLabels,
UniqueLabelKey: "deployment.kubernetes.io/podTemplateHash",

View File

@ -152,13 +152,13 @@ var _ = Describe("Horizontal pod autoscaling", func() {
})
func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) {
hpa := &experimental.HorizontalPodAutoscaler{
hpa := &extensions.HorizontalPodAutoscaler{
ObjectMeta: api.ObjectMeta{
Name: rc.name,
Namespace: rc.framework.Namespace.Name,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Kind: kind,
Name: rc.name,
Namespace: rc.framework.Namespace.Name,
@ -166,7 +166,7 @@ func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) {
},
MinReplicas: 1,
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)
@ -175,13 +175,13 @@ func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) {
// argument memory is in megabytes
func createMemoryHorizontalPodAutoscaler(rc *ResourceConsumer, memory string) {
hpa := &experimental.HorizontalPodAutoscaler{
hpa := &extensions.HorizontalPodAutoscaler{
ObjectMeta: api.ObjectMeta{
Name: rc.name,
Namespace: rc.framework.Namespace.Name,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
ScaleRef: &experimental.SubresourceReference{
Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: &extensions.SubresourceReference{
Kind: kind,
Name: rc.name,
Namespace: rc.framework.Namespace.Name,
@ -189,7 +189,7 @@ func createMemoryHorizontalPodAutoscaler(rc *ResourceConsumer, memory string) {
},
MinReplicas: 1,
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)

View File

@ -183,12 +183,12 @@ var _ = Describe("Job", func() {
})
// newTestJob returns a job which does one of several testing behaviors.
func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, completions int) *experimental.Job {
job := &experimental.Job{
func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, completions int) *extensions.Job {
job := &extensions.Job{
ObjectMeta: api.ObjectMeta{
Name: name,
},
Spec: experimental.JobSpec{
Spec: extensions.JobSpec{
Parallelism: &parallelism,
Completions: &completions,
Template: &api.PodTemplateSpec{
@ -223,7 +223,7 @@ func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, comp
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)
}