Skip to content

Commit 4e151e2

Browse files
✨ Add ExtraEnvs and ImagePullSerial to KubeadmConfig (kubernetes-sigs#10846)
* Add ExtraEnvs and ImagePullSerial to KubeadmConfig * fix diff reports for NodeRegistrationOptions
1 parent 6b3f021 commit 4e151e2

26 files changed

+2655
-583
lines changed

bootstrap/kubeadm/api/v1beta1/kubeadm_types.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ type ControlPlaneComponent struct {
158158
// ExtraVolumes is an extra set of host volumes, mounted to the control plane component.
159159
// +optional
160160
ExtraVolumes []HostPathMount `json:"extraVolumes,omitempty"`
161+
162+
// ExtraEnvs is an extra set of environment variables to pass to the control plane component.
163+
// Environment variables passed using ExtraEnvs will override any existing environment variables, or *_proxy environment variables that kubeadm adds by default.
164+
// This option takes effect only on Kubernetes >=1.31.0.
165+
// +optional
166+
ExtraEnvs []EnvVar `json:"extraEnvs,omitempty"`
161167
}
162168

163169
// APIServer holds settings necessary for API server deployments in the cluster.
@@ -192,7 +198,7 @@ type ImageMeta struct {
192198
// +optional
193199
ImageTag string `json:"imageTag,omitempty"`
194200

195-
//TODO: evaluate if we need also a ImageName based on user feedbacks
201+
// TODO: evaluate if we need also a ImageName based on user feedbacks
196202
}
197203

198204
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -260,6 +266,12 @@ type NodeRegistrationOptions struct {
260266
// +kubebuilder:validation:Enum=Always;IfNotPresent;Never
261267
// +optional
262268
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
269+
270+
// ImagePullSerial specifies if image pulling performed by kubeadm must be done serially or in parallel.
271+
// This option takes effect only on Kubernetes >=1.31.0.
272+
// Default: true (defaulted in kubeadm)
273+
// +optional
274+
ImagePullSerial *bool `json:"imagePullSerial,omitempty"`
263275
}
264276

265277
// MarshalJSON marshals NodeRegistrationOptions in a way that an empty slice in Taints is preserved.
@@ -281,13 +293,15 @@ func (n *NodeRegistrationOptions) MarshalJSON() ([]byte, error) {
281293
KubeletExtraArgs map[string]string `json:"kubeletExtraArgs,omitempty"`
282294
IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
283295
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
296+
ImagePullSerial *bool `json:"imagePullSerial,omitempty"`
284297
}{
285298
Name: n.Name,
286299
CRISocket: n.CRISocket,
287300
Taints: n.Taints,
288301
KubeletExtraArgs: n.KubeletExtraArgs,
289302
IgnorePreflightErrors: n.IgnorePreflightErrors,
290303
ImagePullPolicy: n.ImagePullPolicy,
304+
ImagePullSerial: n.ImagePullSerial,
291305
})
292306
}
293307

@@ -299,13 +313,15 @@ func (n *NodeRegistrationOptions) MarshalJSON() ([]byte, error) {
299313
KubeletExtraArgs map[string]string `json:"kubeletExtraArgs,omitempty"`
300314
IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
301315
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
316+
ImagePullSerial *bool `json:"imagePullSerial,omitempty"`
302317
}{
303318
Name: n.Name,
304319
CRISocket: n.CRISocket,
305320
Taints: n.Taints,
306321
KubeletExtraArgs: n.KubeletExtraArgs,
307322
IgnorePreflightErrors: n.IgnorePreflightErrors,
308323
ImagePullPolicy: n.ImagePullPolicy,
324+
ImagePullSerial: n.ImagePullSerial,
309325
})
310326
}
311327

@@ -382,6 +398,12 @@ type LocalEtcd struct {
382398
// +optional
383399
ExtraArgs map[string]string `json:"extraArgs,omitempty"`
384400

401+
// ExtraEnvs is an extra set of environment variables to pass to the control plane component.
402+
// Environment variables passed using ExtraEnvs will override any existing environment variables, or *_proxy environment variables that kubeadm adds by default.
403+
// This option takes effect only on Kubernetes >=1.31.0.
404+
// +optional
405+
ExtraEnvs []EnvVar `json:"extraEnvs,omitempty"`
406+
385407
// ServerCertSANs sets extra Subject Alternative Names for the etcd server signing cert.
386408
// +optional
387409
ServerCertSANs []string `json:"serverCertSANs,omitempty"`
@@ -735,3 +757,8 @@ type Patches struct {
735757
// +optional
736758
Directory string `json:"directory,omitempty"`
737759
}
760+
761+
// EnvVar represents an environment variable present in a Container.
762+
type EnvVar struct {
763+
corev1.EnvVar `json:",inline"`
764+
}

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

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

0 commit comments

Comments
 (0)