Skip to content

Commit 58d06f0

Browse files
committed
Add CertificateValidityPeriod type to KubeadmConfig
1 parent db916ae commit 58d06f0

23 files changed

+119
-62
lines changed

api/bootstrap/kubeadm/v1beta1/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,7 @@ func Convert_v1_Condition_To_v1beta1_Condition(in *metav1.Condition, out *cluste
313313
func Convert_v1beta1_Condition_To_v1_Condition(in *clusterv1beta1.Condition, out *metav1.Condition, s apimachineryconversion.Scope) error {
314314
return clusterv1beta1.Convert_v1beta1_Condition_To_v1_Condition(in, out, s)
315315
}
316+
317+
func Convert_v1beta2_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in *bootstrapv1.ClusterConfiguration, out *ClusterConfiguration, s apimachineryconversion.Scope) error {
318+
return autoConvert_v1beta2_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in, out, s)
319+
}

api/bootstrap/kubeadm/v1beta1/conversion_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ func hubKubeadmConfigSpec(in *bootstrapv1.KubeadmConfigSpec, c randfill.Continue
124124
}
125125
in.JoinConfiguration.Timeouts.ControlPlaneComponentHealthCheckSeconds = initControlPlaneComponentHealthCheckSeconds
126126
}
127+
128+
// Drop the field to avoid round trip errors as it exists only in v1beta2.
129+
if in.ClusterConfiguration != nil {
130+
in.ClusterConfiguration.CertificateValidityPeriod = nil
131+
}
127132
}
128133

129134
func spokeKubeadmConfigSpec(in *KubeadmConfigSpec, c randfill.Continue) {

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

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

api/bootstrap/kubeadm/v1beta2/kubeadm_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ type ClusterConfiguration struct {
172172
// featureGates enabled by the user.
173173
// +optional
174174
FeatureGates map[string]bool `json:"featureGates,omitempty"`
175+
176+
// certificateValidityPeriod specifies the validity period for a non-CA certificate generated by kubeadm.
177+
// Default value: 8760h (365 days * 24 hours = 1 year)
178+
// +optional
179+
CertificateValidityPeriod *metav1.Duration `json:"certificateValidityPeriod,omitempty"`
175180
}
176181

177182
// ControlPlaneComponent holds settings common to control plane component of the cluster.

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

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

api/controlplane/kubeadm/v1beta1/conversion_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func hubKubeadmConfigSpec(in *bootstrapv1.KubeadmConfigSpec, c randfill.Continue
9898
}
9999
in.JoinConfiguration.Timeouts.ControlPlaneComponentHealthCheckSeconds = initControlPlaneComponentHealthCheckSeconds
100100
}
101+
if in.ClusterConfiguration != nil {
102+
in.ClusterConfiguration.CertificateValidityPeriod = nil
103+
}
101104
}
102105

103106
func hubBootstrapTokenString(in *bootstrapv1.BootstrapTokenString, _ randfill.Continue) {

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

Lines changed: 5 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_kubeadmconfigtemplates.yaml

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

bootstrap/kubeadm/types/upstreamv1beta3/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,7 @@ func (src *ClusterConfiguration) GetAdditionalData(data *upstream.AdditionalData
224224
data.ControlPlaneComponentHealthCheckSeconds = bootstrapv1.ConvertToSeconds(src.APIServer.TimeoutForControlPlane)
225225
}
226226
}
227+
228+
func Convert_v1beta2_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(in *bootstrapv1.ClusterConfiguration, out *ClusterConfiguration, s apimachineryconversion.Scope) error {
229+
return autoConvert_v1beta2_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(in, out, s)
230+
}

bootstrap/kubeadm/types/upstreamv1beta3/conversion_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
8080
hubControlPlaneComponentFuzzer,
8181
hubLocalEtcdFuzzer,
8282
hubNodeRegistrationOptionsFuzzer,
83+
hubClusterConfigurationFuzzer,
8384
}
8485
}
8586

@@ -181,3 +182,9 @@ func hubInitConfigurationFuzzer(obj *bootstrapv1.InitConfiguration, c randfill.C
181182

182183
obj.Timeouts = nil
183184
}
185+
186+
func hubClusterConfigurationFuzzer(obj *bootstrapv1.ClusterConfiguration, c randfill.Continue) {
187+
c.FillNoCustom(obj)
188+
189+
obj.CertificateValidityPeriod = nil
190+
}

0 commit comments

Comments
 (0)