Move Deployments to ReplicaSets and switch the Deployment selector to the new LabelSelector.
Update the Deployments' API types, defaulting code, conversions, helpers and validation to use ReplicaSets instead of ReplicationControllers and LabelSelector instead of map[string]string for selectors. Also update the Deployment controller, registry, kubectl subcommands, client listers package and e2e tests to use ReplicaSets and LabelSelector for Deployments.
This commit is contained in:
@@ -952,8 +952,10 @@ func validDeployment() *extensions.Deployment {
|
||||
Namespace: api.NamespaceDefault,
|
||||
},
|
||||
Spec: extensions.DeploymentSpec{
|
||||
Selector: map[string]string{
|
||||
"name": "abc",
|
||||
Selector: &extensions.LabelSelector{
|
||||
MatchLabels: map[string]string{
|
||||
"name": "abc",
|
||||
},
|
||||
},
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
@@ -1000,8 +1002,10 @@ func TestValidateDeployment(t *testing.T) {
|
||||
}
|
||||
// selector should match the labels in pod template.
|
||||
invalidSelectorDeployment := validDeployment()
|
||||
invalidSelectorDeployment.Spec.Selector = map[string]string{
|
||||
"name": "def",
|
||||
invalidSelectorDeployment.Spec.Selector = &extensions.LabelSelector{
|
||||
MatchLabels: map[string]string{
|
||||
"name": "def",
|
||||
},
|
||||
}
|
||||
errorCases["`selector` does not match template `labels`"] = invalidSelectorDeployment
|
||||
|
||||
|
Reference in New Issue
Block a user