Skip to content

Commit

Permalink
Add Patches field to InitConfiguration and JoinConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
asifdxtreme committed Jan 18, 2022
1 parent f85ebec commit b5ceebe
Show file tree
Hide file tree
Showing 21 changed files with 503 additions and 64 deletions.
13 changes: 13 additions & 0 deletions bootstrap/kubeadm/api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.Ignition = restored.Spec.Ignition
if restored.Spec.InitConfiguration != nil {
dst.Spec.InitConfiguration.Patches = restored.Spec.InitConfiguration.Patches
}
if restored.Spec.JoinConfiguration != nil {
dst.Spec.JoinConfiguration.Patches = restored.Spec.JoinConfiguration.Patches
}

return nil
}
Expand Down Expand Up @@ -112,6 +118,12 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.Template.Spec.Ignition = restored.Spec.Template.Spec.Ignition
if restored.Spec.Template.Spec.InitConfiguration != nil {
dst.Spec.Template.Spec.InitConfiguration.Patches = restored.Spec.Template.Spec.InitConfiguration.Patches
}
if restored.Spec.Template.Spec.JoinConfiguration != nil {
dst.Spec.Template.Spec.JoinConfiguration.Patches = restored.Spec.Template.Spec.JoinConfiguration.Patches
}

return nil
}
Expand Down Expand Up @@ -187,3 +199,4 @@ func Convert_v1beta1_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *bootstr
// KubeadmConfigSpec.Ignition does not exist in kubeadm v1alpha3 API.
return autoConvert_v1beta1_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in, out, s)
}

22 changes: 22 additions & 0 deletions bootstrap/kubeadm/api/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.Ignition = restored.Spec.Ignition
if restored.Spec.InitConfiguration != nil {
dst.Spec.InitConfiguration.Patches = restored.Spec.InitConfiguration.Patches
}
if restored.Spec.JoinConfiguration != nil {
dst.Spec.JoinConfiguration.Patches = restored.Spec.JoinConfiguration.Patches
}

return nil
}
Expand Down Expand Up @@ -78,6 +84,12 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.Template.Spec.Ignition = restored.Spec.Template.Spec.Ignition
if restored.Spec.Template.Spec.InitConfiguration != nil {
dst.Spec.Template.Spec.InitConfiguration.Patches = restored.Spec.Template.Spec.InitConfiguration.Patches
}
if restored.Spec.Template.Spec.JoinConfiguration != nil {
dst.Spec.Template.Spec.JoinConfiguration.Patches = restored.Spec.Template.Spec.JoinConfiguration.Patches
}

return nil
}
Expand Down Expand Up @@ -109,3 +121,13 @@ func Convert_v1beta1_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in *bootstr
// KubeadmConfigSpec.Ignition does not exist in kubeadm v1alpha4 API.
return autoConvert_v1beta1_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in, out, s)
}

func Convert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(in *bootstrapv1.InitConfiguration, out *InitConfiguration, s apiconversion.Scope) error {
// InitConfiguration.Patches does not exist in kubeadm v1alpha4 API.
return autoConvert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(in, out, s)
}

func Convert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(in *bootstrapv1.JoinConfiguration, out *JoinConfiguration, s apiconversion.Scope) error {
// InitConfiguration.Patches does not exist in kubeadm v1alpha4 API.
return autoConvert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(in, out, s)
}
72 changes: 48 additions & 24 deletions bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions bootstrap/kubeadm/api/v1beta1/kubeadm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ type InitConfiguration struct {
// fails you may set the desired value here.
// +optional
LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"`

// Patches contains options related to applying patches to components deployed by kubeadm during
// "kubeadm init". The minimum kubernetes version needed to support Patches is v1.22
// +optional
Patches *Patches `json:"patches,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -360,6 +365,11 @@ type JoinConfiguration struct {
// If nil, no additional control plane instance will be deployed.
// +optional
ControlPlane *JoinControlPlane `json:"controlPlane,omitempty"`

// Patches contains options related to applying patches to components deployed by kubeadm during
// "kubeadm join". The minimum kubernetes version needed to support Patches is v1.22
// +optional
Patches *Patches `json:"patches,omitempty"`
}

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

return &BootstrapTokenString{ID: substrs[1], Secret: substrs[2]}, nil
}

// Patches contains options related to applying patches to components deployed by kubeadm.
type Patches struct {
// Directory is a path to a directory that contains files named "target[suffix][+patchtype].extension".
// For example, "kube-apiserver0+merge.yaml" or just "etcd.json". "target" can be one of
// "kube-apiserver", "kube-controller-manager", "kube-scheduler", "etcd". "patchtype" can be one
// of "strategic" "merge" or "json" and they match the patch formats supported by kubectl.
// The default "patchtype" is "strategic". "extension" must be either "json" or "yaml".
// "suffix" is an optional string that can be used to determine which patches are applied
// first alpha-numerically.
// These files can be written into the target directory via KubeadmConfig.Files which
// specifies additional files to be created on the machine, either with content inline or
// by referencing a secret.
// +optional
Directory string `json:"directory,omitempty"`
}
25 changes: 25 additions & 0 deletions bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,27 @@ spec:
type: object
type: array
type: object
patches:
description: Patches contains options related to applying patches
to components deployed by kubeadm during "kubeadm init". The
minimum kubernetes version needed to support Patches is v1.22
properties:
directory:
description: Directory is a path to a directory that contains
files named "target[suffix][+patchtype].extension". For
example, "kube-apiserver0+merge.yaml" or just "etcd.json".
"target" can be one of "kube-apiserver", "kube-controller-manager",
"kube-scheduler", "etcd". "patchtype" can be one of "strategic"
"merge" or "json" and they match the patch formats supported
by kubectl. The default "patchtype" is "strategic". "extension"
must be either "json" or "yaml". "suffix" is an optional
string that can be used to determine which patches are applied
first alpha-numerically. These files can be written into
the target directory via KubeadmConfig.Files which specifies
additional files to be created on the machine, either with
content inline or by referencing a secret.
type: string
type: object
type: object
joinConfiguration:
description: JoinConfiguration is the kubeadm configuration for the
Expand Down Expand Up @@ -2827,6 +2848,27 @@ spec:
type: object
type: array
type: object
patches:
description: Patches contains options related to applying patches
to components deployed by kubeadm during "kubeadm join". The
minimum kubernetes version needed to support Patches is v1.22
properties:
directory:
description: Directory is a path to a directory that contains
files named "target[suffix][+patchtype].extension". For
example, "kube-apiserver0+merge.yaml" or just "etcd.json".
"target" can be one of "kube-apiserver", "kube-controller-manager",
"kube-scheduler", "etcd". "patchtype" can be one of "strategic"
"merge" or "json" and they match the patch formats supported
by kubectl. The default "patchtype" is "strategic". "extension"
must be either "json" or "yaml". "suffix" is an optional
string that can be used to determine which patches are applied
first alpha-numerically. These files can be written into
the target directory via KubeadmConfig.Files which specifies
additional files to be created on the machine, either with
content inline or by referencing a secret.
type: string
type: object
type: object
mounts:
description: Mounts specifies a list of mount points to be setup.
Expand Down
Loading

0 comments on commit b5ceebe

Please sign in to comment.