Skip to content

Commit 86bbf38

Browse files
committed
Add CertificateValidityPeriod type to KubeadmConfig
1 parent 6f31905 commit 86bbf38

23 files changed

+115
-58
lines changed

api/bootstrap/kubeadm/v1beta1/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,7 @@ func Convert_v1_Condition_To_v1beta1_Condition(in *metav1.Condition, out *cluste
309309
func Convert_v1beta1_Condition_To_v1_Condition(in *clusterv1beta1.Condition, out *metav1.Condition, s apimachineryconversion.Scope) error {
310310
return clusterv1beta1.Convert_v1beta1_Condition_To_v1_Condition(in, out, s)
311311
}
312+
313+
func Convert_v1beta2_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in *bootstrapv1.ClusterConfiguration, out *ClusterConfiguration, s apimachineryconversion.Scope) error {
314+
return autoConvert_v1beta2_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in, out, s)
315+
}

api/bootstrap/kubeadm/v1beta1/conversion_test.go

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

127132
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
@@ -207,6 +207,11 @@ type ClusterConfiguration struct {
207207
// +kubebuilder:validation:MinLength=1
208208
// +kubebuilder:validation:MaxLength=63
209209
ClusterName string `json:"clusterName,omitempty"`
210+
211+
// CertificateValidityPeriod specifies the validity period for a non-CA certificate generated by kubeadm.
212+
// Default value: 8760h (365 days * 24 hours = 1 year)
213+
// +optional
214+
CertificateValidityPeriod *metav1.Duration `json:"certificateValidityPeriod,omitempty"`
210215
}
211216

212217
// 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
@@ -96,6 +96,9 @@ func hubKubeadmConfigSpec(in *bootstrapv1.KubeadmConfigSpec, c randfill.Continue
9696
}
9797
in.JoinConfiguration.Timeouts.ControlPlaneComponentHealthCheckSeconds = initControlPlaneComponentHealthCheckSeconds
9898
}
99+
if in.ClusterConfiguration != nil {
100+
in.ClusterConfiguration.CertificateValidityPeriod = nil
101+
}
99102
}
100103

101104
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
@@ -180,3 +180,7 @@ func (src *ClusterConfiguration) ConvertToInitConfiguration(initConfiguration *b
180180
initConfiguration.Timeouts.ControlPlaneComponentHealthCheckSeconds = bootstrapv1.ConvertToSeconds(src.APIServer.TimeoutForControlPlane)
181181
return nil
182182
}
183+
184+
func Convert_v1beta2_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(in *bootstrapv1.ClusterConfiguration, out *ClusterConfiguration, s apimachineryconversion.Scope) error {
185+
return autoConvert_v1beta2_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(in, out, s)
186+
}

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

@@ -163,3 +164,9 @@ func hubInitConfigurationFuzzer(obj *bootstrapv1.InitConfiguration, c randfill.C
163164

164165
obj.Timeouts = nil
165166
}
167+
168+
func hubClusterConfigurationFuzzer(obj *bootstrapv1.ClusterConfiguration, c randfill.Continue) {
169+
c.FillNoCustom(obj)
170+
171+
obj.CertificateValidityPeriod = nil
172+
}

0 commit comments

Comments
 (0)