From 7ac8e5e53923936c1438e112ed5ab19dff02d653 Mon Sep 17 00:00:00 2001 From: Jason Witkowski Date: Mon, 4 Mar 2024 05:45:27 -0500 Subject: [PATCH] fix: kube-apiserver extra args override Co-authored-by: Jason Witkowski Co-authored-by: Dario Tranchitella --- api/v1alpha1/tenantcontrolplane_types.go | 4 +++- config/crd/bases/kamaji.clastix.io_tenantcontrolplanes.yaml | 5 ++++- config/install.yaml | 2 +- docs/content/reference/api.md | 4 ++-- internal/builders/controlplane/deployment.go | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/api/v1alpha1/tenantcontrolplane_types.go b/api/v1alpha1/tenantcontrolplane_types.go index d4c7ffe7..e3cd5d8d 100644 --- a/api/v1alpha1/tenantcontrolplane_types.go +++ b/api/v1alpha1/tenantcontrolplane_types.go @@ -138,7 +138,9 @@ type DeploymentSpec struct { // (kube-apiserver, controller-manager, and scheduler). Resources *ControlPlaneComponentsResources `json:"resources,omitempty"` // ExtraArgs allows adding additional arguments to the Control Plane components, - // such as kube-apiserver, controller-manager, and scheduler. + // such as kube-apiserver, controller-manager, and scheduler. WARNING - This option + // can override existing parameters and cause components to misbehave in unxpected ways. + // Only modify if you know what you are doing. ExtraArgs *ControlPlaneExtraArgs `json:"extraArgs,omitempty"` AdditionalMetadata AdditionalMetadata `json:"additionalMetadata,omitempty"` // AdditionalInitContainers allows adding additional init containers to the Control Plane deployment. diff --git a/config/crd/bases/kamaji.clastix.io_tenantcontrolplanes.yaml b/config/crd/bases/kamaji.clastix.io_tenantcontrolplanes.yaml index d18780a4..905a4404 100644 --- a/config/crd/bases/kamaji.clastix.io_tenantcontrolplanes.yaml +++ b/config/crd/bases/kamaji.clastix.io_tenantcontrolplanes.yaml @@ -6058,7 +6058,10 @@ spec: extraArgs: description: ExtraArgs allows adding additional arguments to the Control Plane components, such as kube-apiserver, - controller-manager, and scheduler. + controller-manager, and scheduler. WARNING - This option + can override existing parameters and cause components to + misbehave in unxpected ways. Only modify if you know what + you are doing. properties: apiServer: items: diff --git a/config/install.yaml b/config/install.yaml index c5101259..a90868f3 100644 --- a/config/install.yaml +++ b/config/install.yaml @@ -3722,7 +3722,7 @@ spec: type: object type: object extraArgs: - description: ExtraArgs allows adding additional arguments to the Control Plane components, such as kube-apiserver, controller-manager, and scheduler. + description: ExtraArgs allows adding additional arguments to the Control Plane components, such as kube-apiserver, controller-manager, and scheduler. WARNING - This option can override existing parameters and cause components to misbehave in unxpected ways. Only modify if you know what you are doing. properties: apiServer: items: diff --git a/docs/content/reference/api.md b/docs/content/reference/api.md index 9442941b..8b9e3886 100644 --- a/docs/content/reference/api.md +++ b/docs/content/reference/api.md @@ -1000,7 +1000,7 @@ Defining the options for the deployed Tenant Control Plane as Deployment resourc extraArgs object - ExtraArgs allows adding additional arguments to the Control Plane components, such as kube-apiserver, controller-manager, and scheduler.
+ ExtraArgs allows adding additional arguments to the Control Plane components, such as kube-apiserver, controller-manager, and scheduler. WARNING - This option can override existing parameters and cause components to misbehave in unxpected ways. Only modify if you know what you are doing.
false @@ -10320,7 +10320,7 @@ A label selector requirement is a selector that contains values, a key, and an o -ExtraArgs allows adding additional arguments to the Control Plane components, such as kube-apiserver, controller-manager, and scheduler. +ExtraArgs allows adding additional arguments to the Control Plane components, such as kube-apiserver, controller-manager, and scheduler. WARNING - This option can override existing parameters and cause components to misbehave in unxpected ways. Only modify if you know what you are doing. diff --git a/internal/builders/controlplane/deployment.go b/internal/builders/controlplane/deployment.go index 56355eb9..56dd91f7 100644 --- a/internal/builders/controlplane/deployment.go +++ b/internal/builders/controlplane/deployment.go @@ -727,7 +727,7 @@ func (d Deployment) buildKubeAPIServerCommand(tenantControlPlane kamajiv1alpha1. // Order matters, here: extraArgs could try to overwrite some arguments managed by Kamaji and that would be crucial. // Adding as first element of the array of maps, we're sure that these overrides will be sanitized by our configuration. - return utilities.MergeMaps(extraArgs, current, desiredArgs) + return utilities.MergeMaps(current, desiredArgs, extraArgs) } func (d Deployment) secretProjection(secretName, certKeyName, keyName string) *corev1.SecretProjection {