Skip to content

Commit 541d94d

Browse files
committed
[kubeadm] Add support for skipPhases field
In this commit, we enable users to exclude specific phases of their choice during init/join command execution. This can be helpful in cases like provisioning a cluster without kube-proxy deployed. Note: This option takes effect only only on Kubernetes >=1.22.0. Signed-off-by: dntosas <[email protected]>
1 parent 82a6513 commit 541d94d

16 files changed

+126
-2
lines changed

bootstrap/kubeadm/api/v1alpha3/conversion.go

+4
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

+4
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

+2
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

+12
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

+10
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

+16
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

+16
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

+8
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

+2
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

+8
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
}

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

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controlplane/kubeadm/api/v1alpha3/conversion.go

+2
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error {
6161
dst.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{}
6262
}
6363
dst.Spec.KubeadmConfigSpec.InitConfiguration.Patches = restored.Spec.KubeadmConfigSpec.InitConfiguration.Patches
64+
dst.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases = restored.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases
6465
}
6566
if restored.Spec.KubeadmConfigSpec.JoinConfiguration != nil {
6667
if dst.Spec.KubeadmConfigSpec.JoinConfiguration == nil {
6768
dst.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
6869
}
6970
dst.Spec.KubeadmConfigSpec.JoinConfiguration.Patches = restored.Spec.KubeadmConfigSpec.JoinConfiguration.Patches
71+
dst.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases = restored.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases
7072
}
7173

7274
return nil

controlplane/kubeadm/api/v1alpha4/conversion.go

+4
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error {
4545
dst.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{}
4646
}
4747
dst.Spec.KubeadmConfigSpec.InitConfiguration.Patches = restored.Spec.KubeadmConfigSpec.InitConfiguration.Patches
48+
dst.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases = restored.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases
4849
}
4950
if restored.Spec.KubeadmConfigSpec.JoinConfiguration != nil {
5051
if dst.Spec.KubeadmConfigSpec.JoinConfiguration == nil {
5152
dst.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
5253
}
5354
dst.Spec.KubeadmConfigSpec.JoinConfiguration.Patches = restored.Spec.KubeadmConfigSpec.JoinConfiguration.Patches
55+
dst.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases = restored.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases
5456
}
5557

5658
return nil
@@ -99,12 +101,14 @@ func (src *KubeadmControlPlaneTemplate) ConvertTo(dstRaw conversion.Hub) error {
99101
dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{}
100102
}
101103
dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.Patches = restored.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.Patches
104+
dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases = restored.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases
102105
}
103106
if restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration != nil {
104107
if dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration == nil {
105108
dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
106109
}
107110
dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.Patches = restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.Patches
111+
dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases = restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases
108112
}
109113

110114
return nil

controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -3134,6 +3134,14 @@ spec:
31343134
or by referencing a secret.
31353135
type: string
31363136
type: object
3137+
skipPhases:
3138+
description: SkipPhases is a list of phases to skip during
3139+
command execution. The list of phases can be obtained with
3140+
the "kubeadm init --help" command. This option takes effect
3141+
only on Kubernetes >=1.22.0.
3142+
items:
3143+
type: string
3144+
type: array
31373145
type: object
31383146
joinConfiguration:
31393147
description: JoinConfiguration is the kubeadm configuration for
@@ -3346,6 +3354,14 @@ spec:
33463354
or by referencing a secret.
33473355
type: string
33483356
type: object
3357+
skipPhases:
3358+
description: SkipPhases is a list of phases to skip during
3359+
command execution. The list of phases can be obtained with
3360+
the "kubeadm init --help" command. This option takes effect
3361+
only on Kubernetes >=1.22.0.
3362+
items:
3363+
type: string
3364+
type: array
33493365
type: object
33503366
mounts:
33513367
description: Mounts specifies a list of mount points to be setup.

controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,14 @@ spec:
19351935
by referencing a secret.
19361936
type: string
19371937
type: object
1938+
skipPhases:
1939+
description: SkipPhases is a list of phases to skip
1940+
during command execution. The list of phases can
1941+
be obtained with the "kubeadm init --help" command.
1942+
This option takes effect only on Kubernetes >=1.22.0.
1943+
items:
1944+
type: string
1945+
type: array
19381946
type: object
19391947
joinConfiguration:
19401948
description: JoinConfiguration is the kubeadm configuration
@@ -2163,6 +2171,14 @@ spec:
21632171
by referencing a secret.
21642172
type: string
21652173
type: object
2174+
skipPhases:
2175+
description: SkipPhases is a list of phases to skip
2176+
during command execution. The list of phases can
2177+
be obtained with the "kubeadm init --help" command.
2178+
This option takes effect only on Kubernetes >=1.22.0.
2179+
items:
2180+
type: string
2181+
type: array
21662182
type: object
21672183
mounts:
21682184
description: Mounts specifies a list of mount points to

0 commit comments

Comments
 (0)