Skip to content

Commit b5ceebe

Browse files
committed
Add Patches field to InitConfiguration and JoinConfiguration
1 parent f85ebec commit b5ceebe

21 files changed

+503
-64
lines changed

bootstrap/kubeadm/api/v1alpha3/conversion.go

+13
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
5353
}
5454

5555
dst.Spec.Ignition = restored.Spec.Ignition
56+
if restored.Spec.InitConfiguration != nil {
57+
dst.Spec.InitConfiguration.Patches = restored.Spec.InitConfiguration.Patches
58+
}
59+
if restored.Spec.JoinConfiguration != nil {
60+
dst.Spec.JoinConfiguration.Patches = restored.Spec.JoinConfiguration.Patches
61+
}
5662

5763
return nil
5864
}
@@ -112,6 +118,12 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error {
112118
}
113119

114120
dst.Spec.Template.Spec.Ignition = restored.Spec.Template.Spec.Ignition
121+
if restored.Spec.Template.Spec.InitConfiguration != nil {
122+
dst.Spec.Template.Spec.InitConfiguration.Patches = restored.Spec.Template.Spec.InitConfiguration.Patches
123+
}
124+
if restored.Spec.Template.Spec.JoinConfiguration != nil {
125+
dst.Spec.Template.Spec.JoinConfiguration.Patches = restored.Spec.Template.Spec.JoinConfiguration.Patches
126+
}
115127

116128
return nil
117129
}
@@ -187,3 +199,4 @@ func Convert_v1beta1_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *bootstr
187199
// KubeadmConfigSpec.Ignition does not exist in kubeadm v1alpha3 API.
188200
return autoConvert_v1beta1_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in, out, s)
189201
}
202+

bootstrap/kubeadm/api/v1alpha4/conversion.go

+22
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
3838
}
3939

4040
dst.Spec.Ignition = restored.Spec.Ignition
41+
if restored.Spec.InitConfiguration != nil {
42+
dst.Spec.InitConfiguration.Patches = restored.Spec.InitConfiguration.Patches
43+
}
44+
if restored.Spec.JoinConfiguration != nil {
45+
dst.Spec.JoinConfiguration.Patches = restored.Spec.JoinConfiguration.Patches
46+
}
4147

4248
return nil
4349
}
@@ -78,6 +84,12 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error {
7884
}
7985

8086
dst.Spec.Template.Spec.Ignition = restored.Spec.Template.Spec.Ignition
87+
if restored.Spec.Template.Spec.InitConfiguration != nil {
88+
dst.Spec.Template.Spec.InitConfiguration.Patches = restored.Spec.Template.Spec.InitConfiguration.Patches
89+
}
90+
if restored.Spec.Template.Spec.JoinConfiguration != nil {
91+
dst.Spec.Template.Spec.JoinConfiguration.Patches = restored.Spec.Template.Spec.JoinConfiguration.Patches
92+
}
8193

8294
return nil
8395
}
@@ -109,3 +121,13 @@ func Convert_v1beta1_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in *bootstr
109121
// KubeadmConfigSpec.Ignition does not exist in kubeadm v1alpha4 API.
110122
return autoConvert_v1beta1_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in, out, s)
111123
}
124+
125+
func Convert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(in *bootstrapv1.InitConfiguration, out *InitConfiguration, s apiconversion.Scope) error {
126+
// InitConfiguration.Patches does not exist in kubeadm v1alpha4 API.
127+
return autoConvert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(in, out, s)
128+
}
129+
130+
func Convert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(in *bootstrapv1.JoinConfiguration, out *JoinConfiguration, s apiconversion.Scope) error {
131+
// InitConfiguration.Patches does not exist in kubeadm v1alpha4 API.
132+
return autoConvert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(in, out, s)
133+
}

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

+48-24
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

+26
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ type InitConfiguration struct {
5353
// fails you may set the desired value here.
5454
// +optional
5555
LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"`
56+
57+
// Patches contains options related to applying patches to components deployed by kubeadm during
58+
// "kubeadm init". The minimum kubernetes version needed to support Patches is v1.22
59+
// +optional
60+
Patches *Patches `json:"patches,omitempty"`
5661
}
5762

5863
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -360,6 +365,11 @@ type JoinConfiguration struct {
360365
// If nil, no additional control plane instance will be deployed.
361366
// +optional
362367
ControlPlane *JoinControlPlane `json:"controlPlane,omitempty"`
368+
369+
// Patches contains options related to applying patches to components deployed by kubeadm during
370+
// "kubeadm join". The minimum kubernetes version needed to support Patches is v1.22
371+
// +optional
372+
Patches *Patches `json:"patches,omitempty"`
363373
}
364374

365375
// JoinControlPlane contains elements describing an additional control plane instance to be deployed on the joining node.
@@ -500,3 +510,19 @@ func NewBootstrapTokenString(token string) (*BootstrapTokenString, error) {
500510

501511
return &BootstrapTokenString{ID: substrs[1], Secret: substrs[2]}, nil
502512
}
513+
514+
// Patches contains options related to applying patches to components deployed by kubeadm.
515+
type Patches struct {
516+
// Directory is a path to a directory that contains files named "target[suffix][+patchtype].extension".
517+
// For example, "kube-apiserver0+merge.yaml" or just "etcd.json". "target" can be one of
518+
// "kube-apiserver", "kube-controller-manager", "kube-scheduler", "etcd". "patchtype" can be one
519+
// of "strategic" "merge" or "json" and they match the patch formats supported by kubectl.
520+
// The default "patchtype" is "strategic". "extension" must be either "json" or "yaml".
521+
// "suffix" is an optional string that can be used to determine which patches are applied
522+
// first alpha-numerically.
523+
// These files can be written into the target directory via KubeadmConfig.Files which
524+
// specifies additional files to be created on the machine, either with content inline or
525+
// by referencing a secret.
526+
// +optional
527+
Directory string `json:"directory,omitempty"`
528+
}

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

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

+42
Original file line numberDiff line numberDiff line change
@@ -2645,6 +2645,27 @@ spec:
26452645
type: object
26462646
type: array
26472647
type: object
2648+
patches:
2649+
description: Patches contains options related to applying patches
2650+
to components deployed by kubeadm during "kubeadm init". The
2651+
minimum kubernetes version needed to support Patches is v1.22
2652+
properties:
2653+
directory:
2654+
description: Directory is a path to a directory that contains
2655+
files named "target[suffix][+patchtype].extension". For
2656+
example, "kube-apiserver0+merge.yaml" or just "etcd.json".
2657+
"target" can be one of "kube-apiserver", "kube-controller-manager",
2658+
"kube-scheduler", "etcd". "patchtype" can be one of "strategic"
2659+
"merge" or "json" and they match the patch formats supported
2660+
by kubectl. The default "patchtype" is "strategic". "extension"
2661+
must be either "json" or "yaml". "suffix" is an optional
2662+
string that can be used to determine which patches are applied
2663+
first alpha-numerically. These files can be written into
2664+
the target directory via KubeadmConfig.Files which specifies
2665+
additional files to be created on the machine, either with
2666+
content inline or by referencing a secret.
2667+
type: string
2668+
type: object
26482669
type: object
26492670
joinConfiguration:
26502671
description: JoinConfiguration is the kubeadm configuration for the
@@ -2827,6 +2848,27 @@ spec:
28272848
type: object
28282849
type: array
28292850
type: object
2851+
patches:
2852+
description: Patches contains options related to applying patches
2853+
to components deployed by kubeadm during "kubeadm join". The
2854+
minimum kubernetes version needed to support Patches is v1.22
2855+
properties:
2856+
directory:
2857+
description: Directory is a path to a directory that contains
2858+
files named "target[suffix][+patchtype].extension". For
2859+
example, "kube-apiserver0+merge.yaml" or just "etcd.json".
2860+
"target" can be one of "kube-apiserver", "kube-controller-manager",
2861+
"kube-scheduler", "etcd". "patchtype" can be one of "strategic"
2862+
"merge" or "json" and they match the patch formats supported
2863+
by kubectl. The default "patchtype" is "strategic". "extension"
2864+
must be either "json" or "yaml". "suffix" is an optional
2865+
string that can be used to determine which patches are applied
2866+
first alpha-numerically. These files can be written into
2867+
the target directory via KubeadmConfig.Files which specifies
2868+
additional files to be created on the machine, either with
2869+
content inline or by referencing a secret.
2870+
type: string
2871+
type: object
28302872
type: object
28312873
mounts:
28322874
description: Mounts specifies a list of mount points to be setup.

0 commit comments

Comments
 (0)