Skip to content

Commit cee6cba

Browse files
author
Jason Witkowski
committed
fix: kube-apiserver extra args override
1 parent 587d3bb commit cee6cba

File tree

7 files changed

+20
-9
lines changed

7 files changed

+20
-9
lines changed

api/v1alpha1/tenantcontrolplane_types.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ type DeploymentSpec struct {
138138
// (kube-apiserver, controller-manager, and scheduler).
139139
Resources *ControlPlaneComponentsResources `json:"resources,omitempty"`
140140
// ExtraArgs allows adding additional arguments to the Control Plane components,
141-
// such as kube-apiserver, controller-manager, and scheduler.
141+
// such as kube-apiserver, controller-manager, and scheduler. WARNING - This option
142+
// can override existing parameters and cause components to misbehave in unxpected ways.
143+
// Only modify if you know what you are doing.
142144
ExtraArgs *ControlPlaneExtraArgs `json:"extraArgs,omitempty"`
143145
AdditionalMetadata AdditionalMetadata `json:"additionalMetadata,omitempty"`
144146
// AdditionalInitContainers allows adding additional init containers to the Control Plane deployment.

charts/kamaji/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
2-
appVersion: v0.4.0
2+
appVersion: v0.4.1
33
description: Kamaji is a Kubernetes Control Plane Manager.
44
home: https://github.com/clastix/kamaji
55
icon: https://github.com/clastix/kamaji/raw/master/assets/logo-colored.png
@@ -15,7 +15,7 @@ name: kamaji
1515
sources:
1616
- https://github.com/clastix/kamaji
1717
type: application
18-
version: 0.14.0
18+
version: 0.14.1
1919
annotations:
2020
catalog.cattle.io/certified: partner
2121
catalog.cattle.io/release-name: kamaji

charts/kamaji/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# kamaji
22

3-
![Version: 0.14.0](https://img.shields.io/badge/Version-0.14.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.4.0](https://img.shields.io/badge/AppVersion-v0.4.0-informational?style=flat-square)
3+
![Version: 0.14.1](https://img.shields.io/badge/Version-0.14.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.4.1](https://img.shields.io/badge/AppVersion-v0.4.1-informational?style=flat-square)
44

55
Kamaji is a Kubernetes Control Plane Manager.
66

config/crd/bases/kamaji.clastix.io_tenantcontrolplanes.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -6052,7 +6052,10 @@ spec:
60526052
extraArgs:
60536053
description: ExtraArgs allows adding additional arguments
60546054
to the Control Plane components, such as kube-apiserver,
6055-
controller-manager, and scheduler.
6055+
controller-manager, and scheduler. WARNING - This option
6056+
can override existing parameters and cause components to
6057+
misbehave in unxpected ways. Only modify if you know what
6058+
you are doing.
60566059
properties:
60576060
apiServer:
60586061
items:

config/install.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3722,7 +3722,7 @@ spec:
37223722
type: object
37233723
type: object
37243724
extraArgs:
3725-
description: ExtraArgs allows adding additional arguments to the Control Plane components, such as kube-apiserver, controller-manager, and scheduler.
3725+
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.
37263726
properties:
37273727
apiServer:
37283728
items:

internal/builders/controlplane/deployment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ func (d Deployment) buildKubeAPIServerCommand(tenantControlPlane kamajiv1alpha1.
727727

728728
// Order matters, here: extraArgs could try to overwrite some arguments managed by Kamaji and that would be crucial.
729729
// Adding as first element of the array of maps, we're sure that these overrides will be sanitized by our configuration.
730-
return utilities.MergeMaps(extraArgs, current, desiredArgs)
730+
return utilities.MergeMaps(current, desiredArgs, extraArgs)
731731
}
732732

733733
func (d Deployment) secretProjection(secretName, certKeyName, keyName string) *corev1.SecretProjection {

internal/resources/konnectivity/agent.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func (r *Agent) mutate(ctx context.Context, tenantControlPlane *kamajiv1alpha1.T
103103
logger := log.FromContext(ctx, "resource", r.GetName())
104104

105105
address, _, err := tenantControlPlane.AssignedControlPlaneAddress()
106+
106107
if err != nil {
107108
logger.Error(err, "unable to retrieve the Tenant Control Plane address")
108109

@@ -164,8 +165,7 @@ func (r *Agent) mutate(ctx context.Context, tenantControlPlane *kamajiv1alpha1.T
164165
r.resource.Spec.Template.Spec.Containers[0].Name = AgentName
165166
r.resource.Spec.Template.Spec.Containers[0].Command = []string{"/proxy-agent"}
166167

167-
args := utilities.ArgsFromSliceToMap(tenantControlPlane.Spec.Addons.Konnectivity.KonnectivityAgentSpec.ExtraArgs)
168-
168+
args := make(map[string]string)
169169
args["-v"] = "8"
170170
args["--logtostderr"] = "true"
171171
args["--ca-cert"] = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
@@ -175,6 +175,12 @@ func (r *Agent) mutate(ctx context.Context, tenantControlPlane *kamajiv1alpha1.T
175175
args["--health-server-port"] = "8134"
176176
args["--service-account-token-path"] = "/var/run/secrets/tokens/konnectivity-agent-token"
177177

178+
extraArgs := utilities.ArgsFromSliceToMap(tenantControlPlane.Spec.Addons.Konnectivity.KonnectivityAgentSpec.ExtraArgs)
179+
180+
for k, v := range extraArgs {
181+
args[k] = v
182+
}
183+
178184
r.resource.Spec.Template.Spec.Containers[0].Args = utilities.ArgsFromMapToSlice(args)
179185
r.resource.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{
180186
{

0 commit comments

Comments
 (0)