Skip to content

Commit 6c69f37

Browse files
author
Jason Witkowski
committed
fix: konnectivity extra args override
Signed-off-by: Jason Witkowski <[email protected]>
1 parent 6123d9a commit 6c69f37

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ spec:
9292
properties:
9393
extraArgs:
9494
description: ExtraArgs allows adding additional arguments
95-
to said component.
95+
to said component. WARNING - This option can override existing
96+
konnectivity parameters and cause konnectivity components
97+
to misbehave in unxpected ways. Only modify if you know what
98+
you are doing.
9699
items:
97100
type: string
98101
type: array

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)