@@ -207,10 +207,15 @@ type ClusterConfiguration struct {
207207
208208// ControlPlaneComponent holds settings common to control plane component of the cluster.
209209type ControlPlaneComponent struct {
210- // extraArgs is an extra set of flags to pass to the control plane component.
211- // TODO: This is temporary and ideally we would like to switch all components to use ComponentConfig + ConfigMaps.
210+ // extraArgs is a list of args to pass to the control plane component.
211+ // The arg name must match be the command line flag name except without leading dash(es).
212+ // Extra arguments will override existing default arguments set by kubeadm.
212213 // +optional
213- ExtraArgs map [string ]string `json:"extraArgs,omitempty"`
214+ // +listType=atomic
215+ // +kubebuilder:validation:MinItems=1
216+ // +kubebuilder:validation:MaxItems=100
217+ // +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x == y))",message="extraArgs name must be unique"
218+ ExtraArgs []Arg `json:"extraArgs,omitempty"`
214219
215220 // extraVolumes is an extra set of host volumes, mounted to the control plane component.
216221 // +optional
@@ -322,13 +327,18 @@ type NodeRegistrationOptions struct {
322327 // +kubebuilder:validation:MaxItems=100
323328 Taints []corev1.Taint `json:"taints,omitempty"`
324329
325- // kubeletExtraArgs passes through extra arguments to the kubelet. The arguments here are passed to the kubelet command line via the environment file
326- // kubeadm writes at runtime for the kubelet to source. This overrides the generic base-level configuration in the kubelet-config-1.X ConfigMap
327- // Flags have higher priority when parsing. These values are local and specific to the node kubeadm is executing on .
330+ // kubeletExtraArgs is a list of args to pass to kubelet.
331+ // The arg name must match be the command line flag name except without leading dash(es).
332+ // Extra arguments will override existing default arguments set by kubeadm.
328333 // +optional
329- KubeletExtraArgs map [string ]string `json:"kubeletExtraArgs,omitempty"`
334+ // +listType=atomic
335+ // +kubebuilder:validation:MinItems=1
336+ // +kubebuilder:validation:MaxItems=100
337+ // +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x == y))",message="kubeletExtraArgs name must be unique"
338+ KubeletExtraArgs []Arg `json:"kubeletExtraArgs,omitempty"`
330339
331- // ignorePreflightErrors provides a slice of pre-flight errors to be ignored when the current node is registered.
340+ // ignorePreflightErrors provides a slice of pre-flight errors to be ignored when the current node is registered, e.g. 'IsPrivilegedUser,Swap'.
341+ // // Value 'all' ignores errors from all checks.
332342 // +optional
333343 // +kubebuilder:validation:MaxItems=50
334344 // +kubebuilder:validation:items:MinLength=1
@@ -364,13 +374,13 @@ func (n *NodeRegistrationOptions) MarshalJSON() ([]byte, error) {
364374 // Marshal an empty Taints slice array without omitempty so it's preserved.
365375 if n .Taints != nil && len (n .Taints ) == 0 {
366376 return json .Marshal (struct {
367- Name string `json:"name,omitempty"`
368- CRISocket string `json:"criSocket,omitempty"`
369- Taints []corev1.Taint `json:"taints"`
370- KubeletExtraArgs map [ string ] string `json:"kubeletExtraArgs,omitempty"`
371- IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
372- ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
373- ImagePullSerial * bool `json:"imagePullSerial,omitempty"`
377+ Name string `json:"name,omitempty"`
378+ CRISocket string `json:"criSocket,omitempty"`
379+ Taints []corev1.Taint `json:"taints"`
380+ KubeletExtraArgs [] Arg `json:"kubeletExtraArgs,omitempty"`
381+ IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
382+ ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
383+ ImagePullSerial * bool `json:"imagePullSerial,omitempty"`
374384 }{
375385 Name : n .Name ,
376386 CRISocket : n .CRISocket ,
@@ -384,13 +394,13 @@ func (n *NodeRegistrationOptions) MarshalJSON() ([]byte, error) {
384394
385395 // If Taints is nil or not empty we can use omitempty.
386396 return json .Marshal (struct {
387- Name string `json:"name,omitempty"`
388- CRISocket string `json:"criSocket,omitempty"`
389- Taints []corev1.Taint `json:"taints,omitempty"`
390- KubeletExtraArgs map [ string ] string `json:"kubeletExtraArgs,omitempty"`
391- IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
392- ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
393- ImagePullSerial * bool `json:"imagePullSerial,omitempty"`
397+ Name string `json:"name,omitempty"`
398+ CRISocket string `json:"criSocket,omitempty"`
399+ Taints []corev1.Taint `json:"taints,omitempty"`
400+ KubeletExtraArgs [] Arg `json:"kubeletExtraArgs,omitempty"`
401+ IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
402+ ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
403+ ImagePullSerial * bool `json:"imagePullSerial,omitempty"`
394404 }{
395405 Name : n .Name ,
396406 CRISocket : n .CRISocket ,
@@ -487,12 +497,17 @@ type LocalEtcd struct {
487497 // +kubebuilder:validation:MaxLength=512
488498 DataDir string `json:"dataDir,omitempty"`
489499
490- // extraArgs are extra arguments provided to the etcd binary
491- // when run inside a static pod.
500+ // extraArgs is a list of args to pass to etcd.
501+ // The arg name must match be the command line flag name except without leading dash(es).
502+ // Extra arguments will override existing default arguments set by kubeadm.
492503 // +optional
493- ExtraArgs map [string ]string `json:"extraArgs,omitempty"`
504+ // +listType=atomic
505+ // +kubebuilder:validation:MinItems=1
506+ // +kubebuilder:validation:MaxItems=100
507+ // +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x == y))",message="extraArgs name must be unique"
508+ ExtraArgs []Arg `json:"extraArgs,omitempty"`
494509
495- // extraEnvs is an extra set of environment variables to pass to the control plane component .
510+ // extraEnvs is an extra set of environment variables to pass to etcd .
496511 // Environment variables passed using ExtraEnvs will override any existing environment variables, or *_proxy environment variables that kubeadm adds by default.
497512 // This option takes effect only on Kubernetes >=1.31.0.
498513 // +optional
@@ -559,7 +574,7 @@ type JoinConfiguration struct {
559574 NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"`
560575
561576 // caCertPath is the path to the SSL certificate authority used to
562- // secure comunications between node and control-plane.
577+ // secure communications between node and control-plane.
563578 // Defaults to "/etc/kubernetes/pki/ca.crt".
564579 // +optional
565580 // TODO: revisit when there is defaulting from k/k
@@ -931,6 +946,21 @@ type Patches struct {
931946 Directory string `json:"directory,omitempty"`
932947}
933948
949+ // Arg represents an argument with a name and a value.
950+ type Arg struct {
951+ // name is the Name of the extraArg.
952+ // +required
953+ // +kubebuilder:validation:MinLength=1
954+ // +kubebuilder:validation:MaxLength=256
955+ Name string `json:"name"`
956+
957+ // value is the Value of the extraArg.
958+ // +required
959+ // +kubebuilder:validation:MinLength=1
960+ // +kubebuilder:validation:MaxLength=1024
961+ Value string `json:"value"`
962+ }
963+
934964// EnvVar represents an environment variable present in a Container.
935965type EnvVar struct {
936966 corev1.EnvVar `json:",inline"`
0 commit comments