Skip to content

Commit 6e7773c

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

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
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

+7-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ func (r *Agent) mutate(ctx context.Context, tenantControlPlane *kamajiv1alpha1.T
102102
return func() error {
103103
logger := log.FromContext(ctx, "resource", r.GetName())
104104

105-
address, _, err := tenantControlPlane.AssignedControlPlaneAddress()
106105
if err != nil {
107106
logger.Error(err, "unable to retrieve the Tenant Control Plane address")
108107

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

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

176+
extraArgs := utilities.ArgsFromSliceToMap(tenantControlPlane.Spec.Addons.Konnectivity.KonnectivityAgentSpec.ExtraArgs)
177+
178+
for k, v := range extraArgs {
179+
args[k] = v
180+
}
181+
178182
r.resource.Spec.Template.Spec.Containers[0].Args = utilities.ArgsFromMapToSlice(args)
179183
r.resource.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{
180184
{

0 commit comments

Comments
 (0)