Skip to content

Commit cb1d1e3

Browse files
authored
Merge pull request #5993 from dntosas/kubeadm-add-support-init-phases
✨ CABPK: Add support for kubeadm skipPhases field
2 parents bb5bfd1 + 541d94d commit cb1d1e3

16 files changed

+126
-2
lines changed

bootstrap/kubeadm/api/v1alpha3/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
5858
dst.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{}
5959
}
6060
dst.Spec.InitConfiguration.Patches = restored.Spec.InitConfiguration.Patches
61+
dst.Spec.InitConfiguration.SkipPhases = restored.Spec.InitConfiguration.SkipPhases
6162
}
6263
if restored.Spec.JoinConfiguration != nil {
6364
if dst.Spec.JoinConfiguration == nil {
6465
dst.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
6566
}
6667
dst.Spec.JoinConfiguration.Patches = restored.Spec.JoinConfiguration.Patches
68+
dst.Spec.JoinConfiguration.SkipPhases = restored.Spec.JoinConfiguration.SkipPhases
6769
}
6870

6971
return nil
@@ -129,12 +131,14 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error {
129131
dst.Spec.Template.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{}
130132
}
131133
dst.Spec.Template.Spec.InitConfiguration.Patches = restored.Spec.Template.Spec.InitConfiguration.Patches
134+
dst.Spec.Template.Spec.InitConfiguration.SkipPhases = restored.Spec.Template.Spec.InitConfiguration.SkipPhases
132135
}
133136
if restored.Spec.Template.Spec.JoinConfiguration != nil {
134137
if dst.Spec.Template.Spec.JoinConfiguration == nil {
135138
dst.Spec.Template.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
136139
}
137140
dst.Spec.Template.Spec.JoinConfiguration.Patches = restored.Spec.Template.Spec.JoinConfiguration.Patches
141+
dst.Spec.Template.Spec.JoinConfiguration.SkipPhases = restored.Spec.Template.Spec.JoinConfiguration.SkipPhases
138142
}
139143

140144
return nil

bootstrap/kubeadm/api/v1alpha4/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
4343
dst.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{}
4444
}
4545
dst.Spec.InitConfiguration.Patches = restored.Spec.InitConfiguration.Patches
46+
dst.Spec.InitConfiguration.SkipPhases = restored.Spec.InitConfiguration.SkipPhases
4647
}
4748
if restored.Spec.JoinConfiguration != nil {
4849
if dst.Spec.JoinConfiguration == nil {
4950
dst.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
5051
}
5152
dst.Spec.JoinConfiguration.Patches = restored.Spec.JoinConfiguration.Patches
53+
dst.Spec.JoinConfiguration.SkipPhases = restored.Spec.JoinConfiguration.SkipPhases
5254
}
5355

5456
return nil
@@ -95,12 +97,14 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error {
9597
dst.Spec.Template.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{}
9698
}
9799
dst.Spec.Template.Spec.InitConfiguration.Patches = restored.Spec.Template.Spec.InitConfiguration.Patches
100+
dst.Spec.Template.Spec.InitConfiguration.SkipPhases = restored.Spec.Template.Spec.InitConfiguration.SkipPhases
98101
}
99102
if restored.Spec.Template.Spec.JoinConfiguration != nil {
100103
if dst.Spec.Template.Spec.JoinConfiguration == nil {
101104
dst.Spec.Template.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
102105
}
103106
dst.Spec.Template.Spec.JoinConfiguration.Patches = restored.Spec.Template.Spec.JoinConfiguration.Patches
107+
dst.Spec.Template.Spec.JoinConfiguration.SkipPhases = restored.Spec.Template.Spec.JoinConfiguration.SkipPhases
104108
}
105109

106110
return nil

bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/api/v1beta1/kubeadm_types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ type InitConfiguration struct {
5454
// +optional
5555
LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"`
5656

57+
// SkipPhases is a list of phases to skip during command execution.
58+
// The list of phases can be obtained with the "kubeadm init --help" command.
59+
// This option takes effect only on Kubernetes >=1.22.0.
60+
// +optional
61+
SkipPhases []string `json:"skipPhases,omitempty"`
62+
5763
// Patches contains options related to applying patches to components deployed by kubeadm during
5864
// "kubeadm init". The minimum kubernetes version needed to support Patches is v1.22
5965
// +optional
@@ -366,6 +372,12 @@ type JoinConfiguration struct {
366372
// +optional
367373
ControlPlane *JoinControlPlane `json:"controlPlane,omitempty"`
368374

375+
// SkipPhases is a list of phases to skip during command execution.
376+
// The list of phases can be obtained with the "kubeadm init --help" command.
377+
// This option takes effect only on Kubernetes >=1.22.0.
378+
// +optional
379+
SkipPhases []string `json:"skipPhases,omitempty"`
380+
369381
// Patches contains options related to applying patches to components deployed by kubeadm during
370382
// "kubeadm join". The minimum kubernetes version needed to support Patches is v1.22
371383
// +optional

bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,6 +2665,14 @@ spec:
26652665
content inline or by referencing a secret.
26662666
type: string
26672667
type: object
2668+
skipPhases:
2669+
description: SkipPhases is a list of phases to skip during command
2670+
execution. The list of phases can be obtained with the "kubeadm
2671+
init --help" command. This option takes effect only on Kubernetes
2672+
>=1.22.0.
2673+
items:
2674+
type: string
2675+
type: array
26682676
type: object
26692677
joinConfiguration:
26702678
description: JoinConfiguration is the kubeadm configuration for the
@@ -2868,6 +2876,14 @@ spec:
28682876
content inline or by referencing a secret.
28692877
type: string
28702878
type: object
2879+
skipPhases:
2880+
description: SkipPhases is a list of phases to skip during command
2881+
execution. The list of phases can be obtained with the "kubeadm
2882+
init --help" command. This option takes effect only on Kubernetes
2883+
>=1.22.0.
2884+
items:
2885+
type: string
2886+
type: array
28712887
type: object
28722888
mounts:
28732889
description: Mounts specifies a list of mount points to be setup.

bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,6 +2697,14 @@ spec:
26972697
content inline or by referencing a secret.
26982698
type: string
26992699
type: object
2700+
skipPhases:
2701+
description: SkipPhases is a list of phases to skip during
2702+
command execution. The list of phases can be obtained
2703+
with the "kubeadm init --help" command. This option
2704+
takes effect only on Kubernetes >=1.22.0.
2705+
items:
2706+
type: string
2707+
type: array
27002708
type: object
27012709
joinConfiguration:
27022710
description: JoinConfiguration is the kubeadm configuration
@@ -2915,6 +2923,14 @@ spec:
29152923
content inline or by referencing a secret.
29162924
type: string
29172925
type: object
2926+
skipPhases:
2927+
description: SkipPhases is a list of phases to skip during
2928+
command execution. The list of phases can be obtained
2929+
with the "kubeadm init --help" command. This option
2930+
takes effect only on Kubernetes >=1.22.0.
2931+
items:
2932+
type: string
2933+
type: array
29182934
type: object
29192935
mounts:
29202936
description: Mounts specifies a list of mount points to be

bootstrap/kubeadm/types/upstreamv1beta1/conversion_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ func kubeadmInitConfigurationFuzzer(obj *bootstrapv1.InitConfiguration, c fuzz.C
9696
// InitConfiguration.Patches does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
9797
// v1beta1 --> upstream v1beta1 -> v1beta1 round trip errors.
9898
obj.Patches = nil
99+
100+
// InitConfiguration.SkipPhases does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
101+
// v1beta1 --> upstream v1beta1 -> v1beta1 round trip errors.
102+
obj.SkipPhases = nil
99103
}
100104

101105
func kubeadmJoinConfigurationFuzzer(obj *bootstrapv1.JoinConfiguration, c fuzz.Continue) {
@@ -104,4 +108,8 @@ func kubeadmJoinConfigurationFuzzer(obj *bootstrapv1.JoinConfiguration, c fuzz.C
104108
// JoinConfiguration.Patches does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
105109
// v1beta1 --> upstream v1beta1 -> v1beta1 round trip errors.
106110
obj.Patches = nil
111+
112+
// JoinConfiguration.SkipPhases does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
113+
// v1beta1 --> upstream v1beta1 -> v1beta1 round trip errors.
114+
obj.SkipPhases = nil
107115
}

bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/types/upstreamv1beta2/conversion_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ func kubeadmInitConfigurationFuzzer(obj *bootstrapv1.InitConfiguration, c fuzz.C
103103
// InitConfiguration.Patches does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
104104
// v1beta1 --> upstream v1beta2 -> v1beta1 round trip errors.
105105
obj.Patches = nil
106+
107+
// InitConfiguration.SkipPhases does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
108+
// v1beta1 --> upstream v1beta2 -> v1beta1 round trip errors.
109+
obj.SkipPhases = nil
106110
}
107111

108112
func kubeadmJoinConfigurationFuzzer(obj *bootstrapv1.JoinConfiguration, c fuzz.Continue) {
@@ -111,4 +115,8 @@ func kubeadmJoinConfigurationFuzzer(obj *bootstrapv1.JoinConfiguration, c fuzz.C
111115
// JoinConfiguration.Patches does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
112116
// v1beta1 --> upstream v1beta2 -> v1beta1 round trip errors.
113117
obj.Patches = nil
118+
119+
// JoinConfiguration.SkipPhases does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
120+
// v1beta1 --> upstream v1beta2 -> v1beta1 round trip errors.
121+
obj.SkipPhases = nil
114122
}

0 commit comments

Comments
 (0)