Skip to content

Commit

Permalink
Merge pull request #3927 from yastij/relax-validation-kcp
Browse files Browse the repository at this point in the history
🐛 Relax update validation to allow rotating ssh keys for KCP
  • Loading branch information
k8s-ci-robot committed Nov 19, 2020
2 parents f926f16 + e5e3777 commit e9cf684
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const (
preKubeadmCommands = "preKubeadmCommands"
postKubeadmCommands = "postKubeadmCommands"
files = "files"
users = "users"
)

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
Expand All @@ -106,6 +107,7 @@ func (in *KubeadmControlPlane) ValidateUpdate(old runtime.Object) error {
{spec, kubeadmConfigSpec, postKubeadmCommands},
{spec, kubeadmConfigSpec, files},
{spec, kubeadmConfigSpec, "verbosity"},
{spec, kubeadmConfigSpec, users},
{spec, "infrastructureTemplate", "name"},
{spec, "replicas"},
{spec, "version"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
Path: "test",
},
},
Users: []bootstrapv1.User{
{
Name: "user",
SSHAuthorizedKeys: []string{
"ssh-rsa foo",
},
},
},
},
Version: "v1.16.6",
},
Expand Down Expand Up @@ -242,6 +250,15 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
},
}
validUpdate.Spec.Version = "v1.17.1"
validUpdate.Spec.KubeadmConfigSpec.Users = []bootstrapv1.User{
{
Name: "bar",
SSHAuthorizedKeys: []string{
"ssh-rsa bar",
"ssh-rsa foo",
},
},
}
validUpdate.Spec.InfrastructureTemplate.Name = "orange"
validUpdate.Spec.Replicas = pointer.Int32Ptr(5)
now := metav1.NewTime(time.Now())
Expand Down

0 comments on commit e9cf684

Please sign in to comment.