Skip to content

Commit

Permalink
[e2e framework] Avoid NPE when KCP does not specify ClusterConfiguration
Browse files Browse the repository at this point in the history
KubeadmControlPlane.Spec.KubeadmConfigSpec.ClusterConfiguration is not
a required field, avoid assuming it is set in the e2e framework.
  • Loading branch information
detiber committed Aug 31, 2021
1 parent a4f56dd commit 7601ebd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/framework/controlplane_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ func UpgradeControlPlaneAndWaitForUpgrade(ctx context.Context, input UpgradeCont
Expect(err).ToNot(HaveOccurred())

input.ControlPlane.Spec.Version = input.KubernetesUpgradeVersion

// If the ClusterConfiguration is not specified, create an empty one.
if input.ControlPlane.Spec.KubeadmConfigSpec.ClusterConfiguration == nil {
input.ControlPlane.Spec.KubeadmConfigSpec.ClusterConfiguration = new(bootstrapv1.ClusterConfiguration)
}

input.ControlPlane.Spec.KubeadmConfigSpec.ClusterConfiguration.Etcd = bootstrapv1.Etcd{
Local: &bootstrapv1.LocalEtcd{
ImageMeta: bootstrapv1.ImageMeta{
Expand Down

0 comments on commit 7601ebd

Please sign in to comment.