Skip to content

Commit

Permalink
Merge pull request #5993 from dntosas/kubeadm-add-support-init-phases
Browse files Browse the repository at this point in the history
✨ CABPK: Add support for kubeadm skipPhases field
  • Loading branch information
k8s-ci-robot authored Feb 22, 2022
2 parents bb5bfd1 + 541d94d commit cb1d1e3
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bootstrap/kubeadm/api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{}
}
dst.Spec.InitConfiguration.Patches = restored.Spec.InitConfiguration.Patches
dst.Spec.InitConfiguration.SkipPhases = restored.Spec.InitConfiguration.SkipPhases
}
if restored.Spec.JoinConfiguration != nil {
if dst.Spec.JoinConfiguration == nil {
dst.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
}
dst.Spec.JoinConfiguration.Patches = restored.Spec.JoinConfiguration.Patches
dst.Spec.JoinConfiguration.SkipPhases = restored.Spec.JoinConfiguration.SkipPhases
}

return nil
Expand Down Expand Up @@ -129,12 +131,14 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Template.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{}
}
dst.Spec.Template.Spec.InitConfiguration.Patches = restored.Spec.Template.Spec.InitConfiguration.Patches
dst.Spec.Template.Spec.InitConfiguration.SkipPhases = restored.Spec.Template.Spec.InitConfiguration.SkipPhases
}
if restored.Spec.Template.Spec.JoinConfiguration != nil {
if dst.Spec.Template.Spec.JoinConfiguration == nil {
dst.Spec.Template.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
}
dst.Spec.Template.Spec.JoinConfiguration.Patches = restored.Spec.Template.Spec.JoinConfiguration.Patches
dst.Spec.Template.Spec.JoinConfiguration.SkipPhases = restored.Spec.Template.Spec.JoinConfiguration.SkipPhases
}

return nil
Expand Down
4 changes: 4 additions & 0 deletions bootstrap/kubeadm/api/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{}
}
dst.Spec.InitConfiguration.Patches = restored.Spec.InitConfiguration.Patches
dst.Spec.InitConfiguration.SkipPhases = restored.Spec.InitConfiguration.SkipPhases
}
if restored.Spec.JoinConfiguration != nil {
if dst.Spec.JoinConfiguration == nil {
dst.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
}
dst.Spec.JoinConfiguration.Patches = restored.Spec.JoinConfiguration.Patches
dst.Spec.JoinConfiguration.SkipPhases = restored.Spec.JoinConfiguration.SkipPhases
}

return nil
Expand Down Expand Up @@ -95,12 +97,14 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Template.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{}
}
dst.Spec.Template.Spec.InitConfiguration.Patches = restored.Spec.Template.Spec.InitConfiguration.Patches
dst.Spec.Template.Spec.InitConfiguration.SkipPhases = restored.Spec.Template.Spec.InitConfiguration.SkipPhases
}
if restored.Spec.Template.Spec.JoinConfiguration != nil {
if dst.Spec.Template.Spec.JoinConfiguration == nil {
dst.Spec.Template.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
}
dst.Spec.Template.Spec.JoinConfiguration.Patches = restored.Spec.Template.Spec.JoinConfiguration.Patches
dst.Spec.Template.Spec.JoinConfiguration.SkipPhases = restored.Spec.Template.Spec.JoinConfiguration.SkipPhases
}

return nil
Expand Down
2 changes: 2 additions & 0 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.

12 changes: 12 additions & 0 deletions bootstrap/kubeadm/api/v1beta1/kubeadm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ type InitConfiguration struct {
// +optional
LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"`

// SkipPhases is a list of phases to skip during command execution.
// The list of phases can be obtained with the "kubeadm init --help" command.
// This option takes effect only on Kubernetes >=1.22.0.
// +optional
SkipPhases []string `json:"skipPhases,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
Expand Down Expand Up @@ -366,6 +372,12 @@ type JoinConfiguration struct {
// +optional
ControlPlane *JoinControlPlane `json:"controlPlane,omitempty"`

// SkipPhases is a list of phases to skip during command execution.
// The list of phases can be obtained with the "kubeadm init --help" command.
// This option takes effect only on Kubernetes >=1.22.0.
// +optional
SkipPhases []string `json:"skipPhases,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
Expand Down
10 changes: 10 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 @@ -2665,6 +2665,14 @@ spec:
content inline or by referencing a secret.
type: string
type: object
skipPhases:
description: SkipPhases is a list of phases to skip during command
execution. The list of phases can be obtained with the "kubeadm
init --help" command. This option takes effect only on Kubernetes
>=1.22.0.
items:
type: string
type: array
type: object
joinConfiguration:
description: JoinConfiguration is the kubeadm configuration for the
Expand Down Expand Up @@ -2868,6 +2876,14 @@ spec:
content inline or by referencing a secret.
type: string
type: object
skipPhases:
description: SkipPhases is a list of phases to skip during command
execution. The list of phases can be obtained with the "kubeadm
init --help" command. This option takes effect only on Kubernetes
>=1.22.0.
items:
type: string
type: array
type: object
mounts:
description: Mounts specifies a list of mount points to be setup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2697,6 +2697,14 @@ spec:
content inline or by referencing a secret.
type: string
type: object
skipPhases:
description: SkipPhases is a list of phases to skip during
command execution. The list of phases can be obtained
with the "kubeadm init --help" command. This option
takes effect only on Kubernetes >=1.22.0.
items:
type: string
type: array
type: object
joinConfiguration:
description: JoinConfiguration is the kubeadm configuration
Expand Down Expand Up @@ -2915,6 +2923,14 @@ spec:
content inline or by referencing a secret.
type: string
type: object
skipPhases:
description: SkipPhases is a list of phases to skip during
command execution. The list of phases can be obtained
with the "kubeadm init --help" command. This option
takes effect only on Kubernetes >=1.22.0.
items:
type: string
type: array
type: object
mounts:
description: Mounts specifies a list of mount points to be
Expand Down
8 changes: 8 additions & 0 deletions bootstrap/kubeadm/types/upstreamv1beta1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func kubeadmInitConfigurationFuzzer(obj *bootstrapv1.InitConfiguration, c fuzz.C
// InitConfiguration.Patches does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1beta1 --> upstream v1beta1 -> v1beta1 round trip errors.
obj.Patches = nil

// InitConfiguration.SkipPhases does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1beta1 --> upstream v1beta1 -> v1beta1 round trip errors.
obj.SkipPhases = nil
}

func kubeadmJoinConfigurationFuzzer(obj *bootstrapv1.JoinConfiguration, c fuzz.Continue) {
Expand All @@ -104,4 +108,8 @@ func kubeadmJoinConfigurationFuzzer(obj *bootstrapv1.JoinConfiguration, c fuzz.C
// JoinConfiguration.Patches does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1beta1 --> upstream v1beta1 -> v1beta1 round trip errors.
obj.Patches = nil

// JoinConfiguration.SkipPhases does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1beta1 --> upstream v1beta1 -> v1beta1 round trip errors.
obj.SkipPhases = nil
}

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

8 changes: 8 additions & 0 deletions bootstrap/kubeadm/types/upstreamv1beta2/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func kubeadmInitConfigurationFuzzer(obj *bootstrapv1.InitConfiguration, c fuzz.C
// InitConfiguration.Patches does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1beta1 --> upstream v1beta2 -> v1beta1 round trip errors.
obj.Patches = nil

// InitConfiguration.SkipPhases does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1beta1 --> upstream v1beta2 -> v1beta1 round trip errors.
obj.SkipPhases = nil
}

func kubeadmJoinConfigurationFuzzer(obj *bootstrapv1.JoinConfiguration, c fuzz.Continue) {
Expand All @@ -111,4 +115,8 @@ func kubeadmJoinConfigurationFuzzer(obj *bootstrapv1.JoinConfiguration, c fuzz.C
// JoinConfiguration.Patches does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1beta1 --> upstream v1beta2 -> v1beta1 round trip errors.
obj.Patches = nil

// JoinConfiguration.SkipPhases does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1beta1 --> upstream v1beta2 -> v1beta1 round trip errors.
obj.SkipPhases = nil
}

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

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

2 changes: 2 additions & 0 deletions controlplane/kubeadm/api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{}
}
dst.Spec.KubeadmConfigSpec.InitConfiguration.Patches = restored.Spec.KubeadmConfigSpec.InitConfiguration.Patches
dst.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases = restored.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases
}
if restored.Spec.KubeadmConfigSpec.JoinConfiguration != nil {
if dst.Spec.KubeadmConfigSpec.JoinConfiguration == nil {
dst.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
}
dst.Spec.KubeadmConfigSpec.JoinConfiguration.Patches = restored.Spec.KubeadmConfigSpec.JoinConfiguration.Patches
dst.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases = restored.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases
}

return nil
Expand Down
4 changes: 4 additions & 0 deletions controlplane/kubeadm/api/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{}
}
dst.Spec.KubeadmConfigSpec.InitConfiguration.Patches = restored.Spec.KubeadmConfigSpec.InitConfiguration.Patches
dst.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases = restored.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases
}
if restored.Spec.KubeadmConfigSpec.JoinConfiguration != nil {
if dst.Spec.KubeadmConfigSpec.JoinConfiguration == nil {
dst.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
}
dst.Spec.KubeadmConfigSpec.JoinConfiguration.Patches = restored.Spec.KubeadmConfigSpec.JoinConfiguration.Patches
dst.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases = restored.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases
}

dst.Spec.MachineTemplate.NodeDeletionTimeout = restored.Spec.MachineTemplate.NodeDeletionTimeout
Expand Down Expand Up @@ -101,12 +103,14 @@ func (src *KubeadmControlPlaneTemplate) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{}
}
dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.Patches = restored.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.Patches
dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases = restored.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases
}
if restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration != nil {
if dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration == nil {
dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{}
}
dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.Patches = restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.Patches
dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases = restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases
}
if dst.Spec.Template.Spec.MachineTemplate == nil {
dst.Spec.Template.Spec.MachineTemplate = restored.Spec.Template.Spec.MachineTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,14 @@ spec:
or by referencing a secret.
type: string
type: object
skipPhases:
description: SkipPhases is a list of phases to skip during
command execution. The list of phases can be obtained with
the "kubeadm init --help" command. This option takes effect
only on Kubernetes >=1.22.0.
items:
type: string
type: array
type: object
joinConfiguration:
description: JoinConfiguration is the kubeadm configuration for
Expand Down Expand Up @@ -3346,6 +3354,14 @@ spec:
or by referencing a secret.
type: string
type: object
skipPhases:
description: SkipPhases is a list of phases to skip during
command execution. The list of phases can be obtained with
the "kubeadm init --help" command. This option takes effect
only on Kubernetes >=1.22.0.
items:
type: string
type: array
type: object
mounts:
description: Mounts specifies a list of mount points to be setup.
Expand Down
Loading

0 comments on commit cb1d1e3

Please sign in to comment.