Merge pull request #20765 from janetkuo/remove-podtemplate-key

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2016-02-06 00:44:47 -08:00
commit b45a94bc78
23 changed files with 12455 additions and 12668 deletions

View File

@ -71,7 +71,7 @@ type DeploymentSpec struct {
// Label selector for pods. Existing ReplicationControllers whose pods are // Label selector for pods. Existing ReplicationControllers whose pods are
// selected by this will be scaled down. New ReplicationControllers will be // selected by this will be scaled down. New ReplicationControllers will be
// created with this selector, with a unique label as defined by UniqueLabelKey. // created with this selector, with a unique label `pod-template-hash`.
// If Selector is empty, it is defaulted to the labels present on the Pod template. // If Selector is empty, it is defaulted to the labels present on the Pod template.
Selector map[string]string Selector map[string]string
@ -80,15 +80,6 @@ type DeploymentSpec struct {
// The deployment strategy to use to replace existing pods with new ones. // The deployment strategy to use to replace existing pods with new ones.
Strategy DeploymentStrategy Strategy DeploymentStrategy
// Key of the selector that is added to existing RCs (and label key that is
// added to its pods) to prevent the existing RCs to select new pods (and old
// pods being selected by new RC).
// Users can set this to an empty string to indicate that the system should
// not add any selector and label. If unspecified, system uses
// "deployment.kubernetes.io/podTemplateHash".
// Value of this key is hash of DeploymentSpec.PodTemplateSpec.
UniqueLabelKey *string
} }
type DeploymentStrategy struct { type DeploymentStrategy struct {
@ -170,7 +161,7 @@ For each pending deployment, it will:
selector to all these RCs (and the corresponding label to their pods) to ensure selector to all these RCs (and the corresponding label to their pods) to ensure
that they do not select the newly created pods (or old pods get selected by that they do not select the newly created pods (or old pods get selected by
new RC). new RC).
- The label key will be "deployment.kubernetes.io/podTemplateHash". - The label key will be "pod-template-hash".
- The label value will be hash of the podTemplateSpec for that RC without - The label value will be hash of the podTemplateSpec for that RC without
this label. This value will be unique for all RCs, since PodTemplateSpec should be unique. this label. This value will be unique for all RCs, since PodTemplateSpec should be unique.
- If the RCs and pods dont already have this label and selector: - If the RCs and pods dont already have this label and selector:
@ -178,10 +169,10 @@ For each pending deployment, it will:
ensure that all new pods that they create will have this label. ensure that all new pods that they create will have this label.
- Then we will add this label to their existing pods and then add this as a selector - Then we will add this label to their existing pods and then add this as a selector
to that RC. to that RC.
3. Find if there exists an RC for which value of "deployment.kubernetes.io/podTemplateHash" label 3. Find if there exists an RC for which value of "pod-template-hash" label
is same as hash of DeploymentSpec.PodTemplateSpec. If it exists already, then is same as hash of DeploymentSpec.PodTemplateSpec. If it exists already, then
this is the RC that will be ramped up. If there is no such RC, then we create this is the RC that will be ramped up. If there is no such RC, then we create
a new one using DeploymentSpec and then add a "deployment.kubernetes.io/podTemplateHash" label a new one using DeploymentSpec and then add a "pod-template-hash" label
to it. RCSpec.replicas = 0 for a newly created RC. to it. RCSpec.replicas = 0 for a newly created RC.
4. Scale up the new RC and scale down the olds ones as per the DeploymentStrategy. 4. Scale up the new RC and scale down the olds ones as per the DeploymentStrategy.
- Raise an event if we detect an error, like new pods failing to come up. - Raise an event if we detect an error, like new pods failing to come up.

View File

@ -47,7 +47,6 @@ Documentation for other releases can be found at
- [Pod Template](#pod-template) - [Pod Template](#pod-template)
- [Replicas](#replicas) - [Replicas](#replicas)
- [Selector](#selector) - [Selector](#selector)
- [Unique Label Key](#unique-label-key)
- [Strategy](#strategy) - [Strategy](#strategy)
- [Recreate Deployment](#recreate-deployment) - [Recreate Deployment](#recreate-deployment)
- [Rolling Update Deployment](#rolling-update-deployment) - [Rolling Update Deployment](#rolling-update-deployment)
@ -153,7 +152,7 @@ Running ```kubectl get rc``` and ```kubectl get pods``` will show the replicatio
$ kubectl get rc $ kubectl get rc
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE
REPLICAS AGE REPLICAS AGE
deploymentrc-1975012602 nginx nginx:1.7.9 deployment.kubernetes.io/podTemplateHash=1975012602,app=nginx 3 2m deploymentrc-1975012602 nginx nginx:1.7.9 pod-template-hash=1975012602,app=nginx 3 2m
``` ```
```console ```console
@ -237,8 +236,8 @@ which it scaled up to 3 replicas, and has scaled down the old RC to 0 replicas.
```console ```console
kubectl get rc kubectl get rc
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE
deploymentrc-1562004724 nginx nginx:1.9.1 deployment.kubernetes.io/podTemplateHash=1562004724,app=nginx 3 5m deploymentrc-1562004724 nginx nginx:1.9.1 pod-template-hash=1562004724,app=nginx 3 5m
deploymentrc-1975012602 nginx nginx:1.7.9 deployment.kubernetes.io/podTemplateHash=1975012602,app=nginx 0 7m deploymentrc-1975012602 nginx nginx:1.7.9 pod-template-hash=1975012602,app=nginx 0 7m
``` ```
Running `get pods` should now show only the new pods: Running `get pods` should now show only the new pods:
@ -335,17 +334,6 @@ template is different than `.spec.template` or if the total number of such pods
exceeds `.spec.replicas`. It will bring up new pods with `.spec.template` if exceeds `.spec.replicas`. It will bring up new pods with `.spec.template` if
number of pods are less than the desired number. number of pods are less than the desired number.
### Unique Label Key
`.spec.uniqueLabelKey` is an optional field specifying key of the selector that
is added to existing RCs (and label key that is added to its pods) to prevent
the existing RCs to select new pods (and old pods being selected by new RC).
Users can set this to an empty string to indicate that the system should
not add any selector and label. If unspecified, the system uses
`deployment.kubernetes.io/podTemplateHash`.
The value of this key is the hash of `.spec.template`.
No label is added if this is set to the empty string.
### Strategy ### Strategy
`.spec.strategy` specifies the strategy used to replace old pods by new ones. `.spec.strategy` specifies the strategy used to replace old pods by new ones.

View File

@ -678,7 +678,7 @@ runTests() {
kube::test::get_object_assert deployment "{{range.items}}{{$id_field}}:{{end}}" 'nginx:' kube::test::get_object_assert deployment "{{range.items}}{{$id_field}}:{{end}}" 'nginx:'
# Clean up # Clean up
kubectl delete deployment nginx "${kube_flags[@]}" kubectl delete deployment nginx "${kube_flags[@]}"
kubectl delete rc -l deployment.kubernetes.io/podTemplateHash "${kube_flags[@]}" kubectl delete rc -l pod-template-hash "${kube_flags[@]}"
############## ##############
# Namespaces # # Namespaces #
@ -1102,7 +1102,7 @@ __EOF__
# Clean up # Clean up
kubectl delete hpa nginx-deployment "${kube_flags[@]}" kubectl delete hpa nginx-deployment "${kube_flags[@]}"
kubectl delete deployment nginx-deployment "${kube_flags[@]}" kubectl delete deployment nginx-deployment "${kube_flags[@]}"
kubectl delete rc -l deployment.kubernetes.io/podTemplateHash "${kube_flags[@]}" kubectl delete rc -l pod-template-hash "${kube_flags[@]}"
### Rollback a deployment ### Rollback a deployment
# Pre-condition: no deployment exists # Pre-condition: no deployment exists
@ -1131,7 +1131,7 @@ __EOF__
kube::test::get_object_assert deployment "{{range.items}}{{$deployment_image_field}}:{{end}}" 'nginx:latest:' kube::test::get_object_assert deployment "{{range.items}}{{$deployment_image_field}}:{{end}}" 'nginx:latest:'
# Clean up # Clean up
kubectl delete deployment nginx-deployment "${kube_flags[@]}" kubectl delete deployment nginx-deployment "${kube_flags[@]}"
kubectl delete rc -l deployment.kubernetes.io/podTemplateHash "${kube_flags[@]}" kubectl delete rc -l pod-template-hash "${kube_flags[@]}"
###################### ######################
# ConfigMap # # ConfigMap #

File diff suppressed because it is too large Load Diff

View File

@ -252,16 +252,6 @@ type DeploymentSpec struct {
// This is a pointer to distinguish between explicit zero and not specified. // This is a pointer to distinguish between explicit zero and not specified.
RevisionHistoryLimit *int `json:"revisionHistoryLimit,omitempty"` RevisionHistoryLimit *int `json:"revisionHistoryLimit,omitempty"`
// Key of the selector that is added to existing RCs (and label key that is
// added to its pods) to prevent the existing RCs to select new pods (and old
// pods being selected by new RC).
// Users can set this to an empty string to indicate that the system should
// not add any selector and label. If unspecified, system uses
// DefaultDeploymentUniqueLabelKey("deployment.kubernetes.io/podTemplateHash").
// Value of this key is hash of DeploymentSpec.PodTemplateSpec.
// No label is added if this is set to empty string.
UniqueLabelKey string `json:"uniqueLabelKey,omitempty"`
// Indicates that the deployment is paused and will not be processed by the // Indicates that the deployment is paused and will not be processed by the
// deployment controller. // deployment controller.
Paused bool `json:"paused,omitempty"` Paused bool `json:"paused,omitempty"`
@ -288,9 +278,8 @@ type RollbackConfig struct {
const ( const (
// DefaultDeploymentUniqueLabelKey is the default key of the selector that is added // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added
// to existing RCs (and label key that is added to its pods) to prevent the existing RCs // to existing RCs (and label key that is added to its pods) to prevent the existing RCs
// to select new pods (and old pods being select by new RC). See DeploymentSpec's UniqueLabelKey // to select new pods (and old pods being select by new RC).
// field for more information. DefaultDeploymentUniqueLabelKey string = "pod-template-hash"
DefaultDeploymentUniqueLabelKey string = "deployment.kubernetes.io/podTemplateHash"
) )
type DeploymentStrategy struct { type DeploymentStrategy struct {

View File

@ -121,8 +121,6 @@ func Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.
out.RevisionHistoryLimit = new(int32) out.RevisionHistoryLimit = new(int32)
*out.RevisionHistoryLimit = int32(*in.RevisionHistoryLimit) *out.RevisionHistoryLimit = int32(*in.RevisionHistoryLimit)
} }
out.UniqueLabelKey = new(string)
*out.UniqueLabelKey = in.UniqueLabelKey
out.MinReadySeconds = int32(in.MinReadySeconds) out.MinReadySeconds = int32(in.MinReadySeconds)
out.Paused = in.Paused out.Paused = in.Paused
if in.RollbackTo != nil { if in.RollbackTo != nil {
@ -159,9 +157,6 @@ func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentS
out.RevisionHistoryLimit = new(int) out.RevisionHistoryLimit = new(int)
*out.RevisionHistoryLimit = int(*in.RevisionHistoryLimit) *out.RevisionHistoryLimit = int(*in.RevisionHistoryLimit)
} }
if in.UniqueLabelKey != nil {
out.UniqueLabelKey = *in.UniqueLabelKey
}
out.MinReadySeconds = int(in.MinReadySeconds) out.MinReadySeconds = int(in.MinReadySeconds)
out.Paused = in.Paused out.Paused = in.Paused
if in.RollbackTo != nil { if in.RollbackTo != nil {

View File

@ -2830,9 +2830,6 @@ func autoConvert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensi
} else { } else {
out.RevisionHistoryLimit = nil out.RevisionHistoryLimit = nil
} }
if err := api.Convert_string_To_string_ref(&in.UniqueLabelKey, &out.UniqueLabelKey, s); err != nil {
return err
}
out.Paused = in.Paused out.Paused = in.Paused
// unable to generate simple pointer conversion for extensions.RollbackConfig -> v1beta1.RollbackConfig // unable to generate simple pointer conversion for extensions.RollbackConfig -> v1beta1.RollbackConfig
if in.RollbackTo != nil { if in.RollbackTo != nil {
@ -4148,9 +4145,6 @@ func autoConvert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *Deploym
} else { } else {
out.RevisionHistoryLimit = nil out.RevisionHistoryLimit = nil
} }
if err := api.Convert_string_ref_To_string(&in.UniqueLabelKey, &out.UniqueLabelKey, s); err != nil {
return err
}
out.Paused = in.Paused out.Paused = in.Paused
// unable to generate simple pointer conversion for v1beta1.RollbackConfig -> extensions.RollbackConfig // unable to generate simple pointer conversion for v1beta1.RollbackConfig -> extensions.RollbackConfig
if in.RollbackTo != nil { if in.RollbackTo != nil {

View File

@ -1190,12 +1190,6 @@ func deepCopy_v1beta1_DeploymentSpec(in DeploymentSpec, out *DeploymentSpec, c *
} else { } else {
out.RevisionHistoryLimit = nil out.RevisionHistoryLimit = nil
} }
if in.UniqueLabelKey != nil {
out.UniqueLabelKey = new(string)
*out.UniqueLabelKey = *in.UniqueLabelKey
} else {
out.UniqueLabelKey = nil
}
out.Paused = in.Paused out.Paused = in.Paused
if in.RollbackTo != nil { if in.RollbackTo != nil {
out.RollbackTo = new(RollbackConfig) out.RollbackTo = new(RollbackConfig)

View File

@ -100,10 +100,6 @@ func addDefaultingFuncs(scheme *runtime.Scheme) {
strategy.RollingUpdate.MaxSurge = &maxSurge strategy.RollingUpdate.MaxSurge = &maxSurge
} }
} }
if obj.Spec.UniqueLabelKey == nil {
obj.Spec.UniqueLabelKey = new(string)
*obj.Spec.UniqueLabelKey = DefaultDeploymentUniqueLabelKey
}
}, },
func(obj *Job) { func(obj *Job) {
labels := obj.Spec.Template.Labels labels := obj.Spec.Template.Labels

View File

@ -198,7 +198,6 @@ func TestSetDefaultDaemonSet(t *testing.T) {
func TestSetDefaultDeployment(t *testing.T) { func TestSetDefaultDeployment(t *testing.T) {
defaultIntOrString := intstr.FromInt(1) defaultIntOrString := intstr.FromInt(1)
differentIntOrString := intstr.FromInt(5) differentIntOrString := intstr.FromInt(5)
deploymentLabelKey := DefaultDeploymentUniqueLabelKey
period := int64(v1.DefaultTerminationGracePeriodSeconds) period := int64(v1.DefaultTerminationGracePeriodSeconds)
defaultTemplate := v1.PodTemplateSpec{ defaultTemplate := v1.PodTemplateSpec{
Spec: v1.PodSpec{ Spec: v1.PodSpec{
@ -225,7 +224,6 @@ func TestSetDefaultDeployment(t *testing.T) {
}, },
}, },
Template: defaultTemplate, Template: defaultTemplate,
UniqueLabelKey: newString(deploymentLabelKey),
}, },
}, },
}, },
@ -251,7 +249,6 @@ func TestSetDefaultDeployment(t *testing.T) {
}, },
}, },
Template: defaultTemplate, Template: defaultTemplate,
UniqueLabelKey: newString(deploymentLabelKey),
}, },
}, },
}, },
@ -271,7 +268,6 @@ func TestSetDefaultDeployment(t *testing.T) {
Type: RecreateDeploymentStrategyType, Type: RecreateDeploymentStrategyType,
}, },
Template: defaultTemplate, Template: defaultTemplate,
UniqueLabelKey: newString(deploymentLabelKey),
}, },
}, },
}, },
@ -282,7 +278,6 @@ func TestSetDefaultDeployment(t *testing.T) {
Strategy: DeploymentStrategy{ Strategy: DeploymentStrategy{
Type: RecreateDeploymentStrategyType, Type: RecreateDeploymentStrategyType,
}, },
UniqueLabelKey: newString("customDeploymentKey"),
}, },
}, },
expected: &Deployment{ expected: &Deployment{
@ -292,7 +287,6 @@ func TestSetDefaultDeployment(t *testing.T) {
Type: RecreateDeploymentStrategyType, Type: RecreateDeploymentStrategyType,
}, },
Template: defaultTemplate, Template: defaultTemplate,
UniqueLabelKey: newString("customDeploymentKey"),
}, },
}, },
}, },

File diff suppressed because it is too large Load Diff

View File

@ -237,16 +237,6 @@ type DeploymentSpec struct {
// This is a pointer to distinguish between explicit zero and not specified. // This is a pointer to distinguish between explicit zero and not specified.
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
// Key of the selector that is added to existing RCs (and label key that is
// added to its pods) to prevent the existing RCs to select new pods (and old
// pods being selected by new RC).
// Users can set this to an empty string to indicate that the system should
// not add any selector and label. If unspecified, system uses
// DefaultDeploymentUniqueLabelKey("deployment.kubernetes.io/podTemplateHash").
// Value of this key is hash of DeploymentSpec.PodTemplateSpec.
// No label is added if this is set to empty string.
UniqueLabelKey *string `json:"uniqueLabelKey,omitempty"`
// Indicates that the deployment is paused and will not be processed by the // Indicates that the deployment is paused and will not be processed by the
// deployment controller. // deployment controller.
Paused bool `json:"paused,omitempty"` Paused bool `json:"paused,omitempty"`
@ -273,9 +263,8 @@ type RollbackConfig struct {
const ( const (
// DefaultDeploymentUniqueLabelKey is the default key of the selector that is added // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added
// to existing RCs (and label key that is added to its pods) to prevent the existing RCs // to existing RCs (and label key that is added to its pods) to prevent the existing RCs
// to select new pods (and old pods being select by new RC). See DeploymentSpec's UniqueLabelKey // to select new pods (and old pods being select by new RC).
// field for more information. DefaultDeploymentUniqueLabelKey string = "pod-template-hash"
DefaultDeploymentUniqueLabelKey string = "deployment.kubernetes.io/podTemplateHash"
) )
// DeploymentStrategy describes how to replace existing pods with new ones. // DeploymentStrategy describes how to replace existing pods with new ones.

View File

@ -186,7 +186,6 @@ var map_DeploymentSpec = map[string]string{
"strategy": "The deployment strategy to use to replace existing pods with new ones.", "strategy": "The deployment strategy to use to replace existing pods with new ones.",
"minReadySeconds": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)", "minReadySeconds": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)",
"revisionHistoryLimit": "The number of old ReplicationControllers to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified.", "revisionHistoryLimit": "The number of old ReplicationControllers to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified.",
"uniqueLabelKey": "Key of the selector that is added to existing RCs (and label key that is added to its pods) to prevent the existing RCs to select new pods (and old pods being selected by new RC). Users can set this to an empty string to indicate that the system should not add any selector and label. If unspecified, system uses DefaultDeploymentUniqueLabelKey(\"deployment.kubernetes.io/podTemplateHash\"). Value of this key is hash of DeploymentSpec.PodTemplateSpec. No label is added if this is set to empty string.",
"paused": "Indicates that the deployment is paused and will not be processed by the deployment controller.", "paused": "Indicates that the deployment is paused and will not be processed by the deployment controller.",
"rollbackTo": "The config this deployment is rolling back to. Will be cleared after rollback is done.", "rollbackTo": "The config this deployment is rolling back to. Will be cleared after rollback is done.",
} }

View File

@ -328,10 +328,6 @@ func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path
// zero is a valid RevisionHistoryLimit // zero is a valid RevisionHistoryLimit
allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(*spec.RevisionHistoryLimit), fldPath.Child("revisionHistoryLimit"))...) allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(*spec.RevisionHistoryLimit), fldPath.Child("revisionHistoryLimit"))...)
} }
// empty string is a valid UniqueLabelKey
if len(spec.UniqueLabelKey) > 0 {
allErrs = append(allErrs, apivalidation.ValidateLabelName(spec.UniqueLabelKey, fldPath.Child("uniqueLabel"))...)
}
if spec.RollbackTo != nil { if spec.RollbackTo != nil {
allErrs = append(allErrs, ValidateRollback(spec.RollbackTo, fldPath.Child("rollback"))...) allErrs = append(allErrs, ValidateRollback(spec.RollbackTo, fldPath.Child("rollback"))...)
} }

View File

@ -872,7 +872,6 @@ func validDeployment() *extensions.Deployment {
}, },
}, },
}, },
UniqueLabelKey: "my-label",
RollbackTo: &extensions.RollbackConfig{ RollbackTo: &extensions.RollbackConfig{
Revision: 1, Revision: 1,
}, },
@ -908,11 +907,6 @@ func TestValidateDeployment(t *testing.T) {
invalidRestartPolicyDeployment.Spec.Template.Spec.RestartPolicy = api.RestartPolicyNever invalidRestartPolicyDeployment.Spec.Template.Spec.RestartPolicy = api.RestartPolicyNever
errorCases["Unsupported value: \"Never\""] = invalidRestartPolicyDeployment errorCases["Unsupported value: \"Never\""] = invalidRestartPolicyDeployment
// invalid unique label key.
invalidUniqueLabelDeployment := validDeployment()
invalidUniqueLabelDeployment.Spec.UniqueLabelKey = "abc/def/ghi"
errorCases["spec.uniqueLabel: Invalid value"] = invalidUniqueLabelDeployment
// rollingUpdate should be nil for recreate. // rollingUpdate should be nil for recreate.
invalidRecreateDeployment := validDeployment() invalidRecreateDeployment := validDeployment()
invalidRecreateDeployment.Spec.Strategy = extensions.DeploymentStrategy{ invalidRecreateDeployment.Spec.Strategy = extensions.DeploymentStrategy{

View File

@ -695,8 +695,8 @@ func (dc *DeploymentController) getNewRC(deployment extensions.Deployment, maxOl
namespace := deployment.ObjectMeta.Namespace namespace := deployment.ObjectMeta.Namespace
podTemplateSpecHash := podutil.GetPodTemplateSpecHash(deployment.Spec.Template) podTemplateSpecHash := podutil.GetPodTemplateSpecHash(deployment.Spec.Template)
newRCTemplate := deploymentutil.GetNewRCTemplate(deployment) newRCTemplate := deploymentutil.GetNewRCTemplate(deployment)
// Add podTemplateHash label to selector. // Add pod-template-hash label to selector.
newRCSelector := labelsutil.CloneAndAddLabel(deployment.Spec.Selector, deployment.Spec.UniqueLabelKey, podTemplateSpecHash) newRCSelector := labelsutil.CloneAndAddLabel(deployment.Spec.Selector, extensions.DefaultDeploymentUniqueLabelKey, podTemplateSpecHash)
// Set RC expectations (1 rc should be created) // Set RC expectations (1 rc should be created)
dKey, err = controller.KeyFunc(&deployment) dKey, err = controller.KeyFunc(&deployment)

View File

@ -110,7 +110,6 @@ func (DeploymentV1Beta1) Generate(genericParams map[string]interface{}) (runtime
}, },
Spec: *podSpec, Spec: *podSpec,
}, },
UniqueLabelKey: extensions.DefaultDeploymentUniqueLabelKey,
}, },
} }
return &deployment, nil return &deployment, nil

View File

@ -657,7 +657,6 @@ func TestGenerateDeployment(t *testing.T) {
Spec: extensions.DeploymentSpec{ Spec: extensions.DeploymentSpec{
Replicas: 3, Replicas: 3,
Selector: map[string]string{"foo": "bar", "baz": "blah"}, Selector: map[string]string{"foo": "bar", "baz": "blah"},
UniqueLabelKey: extensions.DefaultDeploymentUniqueLabelKey,
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: map[string]string{"foo": "bar", "baz": "blah"}, Labels: map[string]string{"foo": "bar", "baz": "blah"},

View File

@ -67,7 +67,6 @@ func validNewDeployment() *extensions.Deployment {
DNSPolicy: api.DNSClusterFirst, DNSPolicy: api.DNSClusterFirst,
}, },
}, },
UniqueLabelKey: "my-label",
Replicas: 7, Replicas: 7,
}, },
Status: extensions.DeploymentStatus{ Status: extensions.DeploymentStatus{

View File

@ -138,7 +138,7 @@ func GetNewRCTemplate(deployment extensions.Deployment) api.PodTemplateSpec {
} }
newRCTemplate.ObjectMeta.Labels = labelsutil.CloneAndAddLabel( newRCTemplate.ObjectMeta.Labels = labelsutil.CloneAndAddLabel(
deployment.Spec.Template.ObjectMeta.Labels, deployment.Spec.Template.ObjectMeta.Labels,
deployment.Spec.UniqueLabelKey, extensions.DefaultDeploymentUniqueLabelKey,
podutil.GetPodTemplateSpecHash(newRCTemplate)) podutil.GetPodTemplateSpecHash(newRCTemplate))
return newRCTemplate return newRCTemplate
} }
@ -149,7 +149,7 @@ func SetFromRCTemplate(deployment *extensions.Deployment, template api.PodTempla
deployment.Spec.Template.Spec = template.Spec deployment.Spec.Template.Spec = template.Spec
deployment.Spec.Template.ObjectMeta.Labels = labelsutil.CloneAndRemoveLabel( deployment.Spec.Template.ObjectMeta.Labels = labelsutil.CloneAndRemoveLabel(
deployment.Spec.Template.ObjectMeta.Labels, deployment.Spec.Template.ObjectMeta.Labels,
deployment.Spec.UniqueLabelKey) extensions.DefaultDeploymentUniqueLabelKey)
return deployment return deployment
} }

View File

@ -161,7 +161,6 @@ func generateDeployment(image string) extensions.Deployment {
Spec: extensions.DeploymentSpec{ Spec: extensions.DeploymentSpec{
Replicas: 1, Replicas: 1,
Selector: podLabels, Selector: podLabels,
UniqueLabelKey: "deployment.kubernetes.io/podTemplateHash",
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: podLabels, Labels: podLabels,

View File

@ -101,7 +101,6 @@ func newDeployment(deploymentName string, replicas int, podLabels map[string]str
Type: strategyType, Type: strategyType,
}, },
RevisionHistoryLimit: revisionHistoryLimit, RevisionHistoryLimit: revisionHistoryLimit,
UniqueLabelKey: extensions.DefaultDeploymentUniqueLabelKey,
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: podLabels, Labels: podLabels,

View File

@ -1527,7 +1527,6 @@ func (config *DeploymentConfig) create() error {
Selector: map[string]string{ Selector: map[string]string{
"name": config.Name, "name": config.Name,
}, },
UniqueLabelKey: extensions.DefaultDeploymentUniqueLabelKey,
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: map[string]string{"name": config.Name}, Labels: map[string]string{"name": config.Name},