-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ KCP: Allow mutation of all fields that should be mutable #9871
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -380,18 +380,12 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { | |
wrongReplicaCountForScaleIn := before.DeepCopy() | ||
wrongReplicaCountForScaleIn.Spec.RolloutStrategy.RollingUpdate.MaxSurge.IntVal = int32(0) | ||
|
||
invalidUpdateKubeadmConfigInit := before.DeepCopy() | ||
invalidUpdateKubeadmConfigInit.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{} | ||
|
||
validUpdateKubeadmConfigInit := before.DeepCopy() | ||
validUpdateKubeadmConfigInit.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration = bootstrapv1.NodeRegistrationOptions{} | ||
|
||
invalidUpdateKubeadmConfigCluster := before.DeepCopy() | ||
invalidUpdateKubeadmConfigCluster.Spec.KubeadmConfigSpec.ClusterConfiguration = &bootstrapv1.ClusterConfiguration{} | ||
|
||
invalidUpdateKubeadmConfigJoin := before.DeepCopy() | ||
invalidUpdateKubeadmConfigJoin.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} | ||
|
||
validUpdateKubeadmConfigJoin := before.DeepCopy() | ||
validUpdateKubeadmConfigJoin.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration = bootstrapv1.NodeRegistrationOptions{} | ||
|
||
|
@@ -586,8 +580,6 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { | |
localDataDir.Spec.KubeadmConfigSpec.ClusterConfiguration.Etcd.Local = &bootstrapv1.LocalEtcd{ | ||
DataDir: "some local data dir", | ||
} | ||
modifyLocalDataDir := localDataDir.DeepCopy() | ||
modifyLocalDataDir.Spec.KubeadmConfigSpec.ClusterConfiguration.Etcd.Local.DataDir = "a different local data dir" | ||
|
||
localPeerCertSANs := before.DeepCopy() | ||
localPeerCertSANs.Spec.KubeadmConfigSpec.ClusterConfiguration.Etcd.Local = &bootstrapv1.LocalEtcd{ | ||
|
@@ -726,12 +718,6 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { | |
before: before, | ||
kcp: validUpdate, | ||
}, | ||
{ | ||
name: "should return error when trying to mutate the kubeadmconfigspec initconfiguration", | ||
expectErr: true, | ||
before: before, | ||
kcp: invalidUpdateKubeadmConfigInit, | ||
}, | ||
{ | ||
name: "should not return an error when trying to mutate the kubeadmconfigspec initconfiguration noderegistration", | ||
expectErr: false, | ||
|
@@ -744,12 +730,6 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { | |
before: before, | ||
kcp: invalidUpdateKubeadmConfigCluster, | ||
}, | ||
{ | ||
name: "should return error when trying to mutate the kubeadmconfigspec joinconfiguration", | ||
expectErr: true, | ||
before: before, | ||
kcp: invalidUpdateKubeadmConfigJoin, | ||
}, | ||
{ | ||
name: "should not return an error when trying to mutate the kubeadmconfigspec joinconfiguration noderegistration", | ||
expectErr: false, | ||
|
@@ -912,20 +892,20 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { | |
kcp: featureGates, | ||
}, | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy to make some of these etcd fields immutable again. I just don't understand why it shouldn't be possible to mutate them. Does anyone have more context? @fabriziopandini @vincepri maybe? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no specific reason AFAIK. we just started with everything immutable and relaxed things slowly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand that in general we added new mutable fields iteratively. I got confused that we explicitly had unit tests ensuring that these fields are immutable |
||
name: "should fail when making a change to the cluster config's local etcd's configuration localDataDir field", | ||
expectErr: true, | ||
name: "should succeed when making a change to the cluster config's local etcd's configuration localDataDir field", | ||
expectErr: false, | ||
before: before, | ||
kcp: localDataDir, | ||
}, | ||
{ | ||
name: "should fail when making a change to the cluster config's local etcd's configuration localPeerCertSANs field", | ||
expectErr: true, | ||
name: "should succeed when making a change to the cluster config's local etcd's configuration localPeerCertSANs field", | ||
expectErr: false, | ||
before: before, | ||
kcp: localPeerCertSANs, | ||
}, | ||
{ | ||
name: "should fail when making a change to the cluster config's local etcd's configuration localServerCertSANs field", | ||
expectErr: true, | ||
name: "should succeed when making a change to the cluster config's local etcd's configuration localServerCertSANs field", | ||
expectErr: false, | ||
before: before, | ||
kcp: localServerCertSANs, | ||
}, | ||
|
@@ -936,8 +916,8 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { | |
kcp: localExtraArgs, | ||
}, | ||
{ | ||
name: "should fail when making a change to the cluster config's external etcd's configuration", | ||
expectErr: true, | ||
name: "should succeed when making a change to the cluster config's external etcd's configuration", | ||
expectErr: false, | ||
before: before, | ||
kcp: externalEtcd, | ||
}, | ||
|
@@ -947,12 +927,6 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { | |
before: etcdLocalImageTag, | ||
kcp: unsetEtcd, | ||
}, | ||
{ | ||
name: "should fail when modifying a field that is not the local etcd image metadata", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is duplicate to the one above |
||
expectErr: true, | ||
before: localDataDir, | ||
kcp: modifyLocalDataDir, | ||
}, | ||
{ | ||
name: "should fail if both local and external etcd are set", | ||
expectErr: true, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now all fields in initconfiguration and joinconfiguration are mutable. This test effectively tested before that it wasn't possible to mutate some of the fields