Skip to content

Commit

Permalink
Add ExtraEnvs and ImagePullSerial to KubeadmConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Jul 8, 2024
1 parent d79694c commit fccad65
Show file tree
Hide file tree
Showing 26 changed files with 2,606 additions and 534 deletions.
29 changes: 28 additions & 1 deletion bootstrap/kubeadm/api/v1beta1/kubeadm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ type ControlPlaneComponent struct {
// ExtraVolumes is an extra set of host volumes, mounted to the control plane component.
// +optional
ExtraVolumes []HostPathMount `json:"extraVolumes,omitempty"`

// ExtraEnvs is an extra set of environment variables to pass to the control plane component.
// Environment variables passed using ExtraEnvs will override any existing environment variables, or *_proxy environment variables that kubeadm adds by default.
// This option takes effect only on Kubernetes >=1.31.0.
// +optional
ExtraEnvs []EnvVar `json:"extraEnvs,omitempty"`
}

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

//TODO: evaluate if we need also a ImageName based on user feedbacks
// TODO: evaluate if we need also a ImageName based on user feedbacks
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -260,6 +266,12 @@ type NodeRegistrationOptions struct {
// +kubebuilder:validation:Enum=Always;IfNotPresent;Never
// +optional
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`

// ImagePullSerial specifies if image pulling performed by kubeadm must be done serially or in parallel.
// This option takes effect only on Kubernetes >=1.31.0.
// Default: true (defaulted in kubeadm)
// +optional
ImagePullSerial *bool `json:"imagePullSerial,omitempty"`
}

// MarshalJSON marshals NodeRegistrationOptions in a way that an empty slice in Taints is preserved.
Expand All @@ -281,13 +293,15 @@ func (n *NodeRegistrationOptions) MarshalJSON() ([]byte, error) {
KubeletExtraArgs map[string]string `json:"kubeletExtraArgs,omitempty"`
IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
ImagePullSerial *bool `json:"imagePullSerial,omitempty"`
}{
Name: n.Name,
CRISocket: n.CRISocket,
Taints: n.Taints,
KubeletExtraArgs: n.KubeletExtraArgs,
IgnorePreflightErrors: n.IgnorePreflightErrors,
ImagePullPolicy: n.ImagePullPolicy,
ImagePullSerial: n.ImagePullSerial,
})
}

Expand All @@ -299,13 +313,15 @@ func (n *NodeRegistrationOptions) MarshalJSON() ([]byte, error) {
KubeletExtraArgs map[string]string `json:"kubeletExtraArgs,omitempty"`
IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
ImagePullSerial *bool `json:"imagePullSerial,omitempty"`
}{
Name: n.Name,
CRISocket: n.CRISocket,
Taints: n.Taints,
KubeletExtraArgs: n.KubeletExtraArgs,
IgnorePreflightErrors: n.IgnorePreflightErrors,
ImagePullPolicy: n.ImagePullPolicy,
ImagePullSerial: n.ImagePullSerial,
})
}

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

// ExtraEnvs is an extra set of environment variables to pass to the control plane component.
// Environment variables passed using ExtraEnvs will override any existing environment variables, or *_proxy environment variables that kubeadm adds by default.
// This option takes effect only on Kubernetes >=1.31.0.
// +optional
ExtraEnvs []EnvVar `json:"extraEnvs,omitempty"`

// ServerCertSANs sets extra Subject Alternative Names for the etcd server signing cert.
// +optional
ServerCertSANs []string `json:"serverCertSANs,omitempty"`
Expand Down Expand Up @@ -735,3 +757,8 @@ type Patches struct {
// +optional
Directory string `json:"directory,omitempty"`
}

// EnvVar represents an environment variable present in a Container.
type EnvVar struct {
corev1.EnvVar `json:",inline"`
}
35 changes: 35 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.

Loading

0 comments on commit fccad65

Please sign in to comment.