Skip to content

Commit

Permalink
fix: konnectivity extra args override
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Witkowski <[email protected]>
  • Loading branch information
Jason Witkowski committed Feb 13, 2024
1 parent 6123d9a commit 6e7773c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion config/crd/bases/kamaji.clastix.io_tenantcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ spec:
properties:
extraArgs:
description: ExtraArgs allows adding additional arguments
to said component.
to said component. WARNING - This option can override existing
konnectivity parameters and cause konnectivity components
to misbehave in unxpected ways. Only modify if you know what
you are doing.
items:
type: string
type: array
Expand Down
10 changes: 7 additions & 3 deletions internal/resources/konnectivity/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ func (r *Agent) mutate(ctx context.Context, tenantControlPlane *kamajiv1alpha1.T
return func() error {
logger := log.FromContext(ctx, "resource", r.GetName())

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

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

args := utilities.ArgsFromSliceToMap(tenantControlPlane.Spec.Addons.Konnectivity.KonnectivityAgentSpec.ExtraArgs)

args := make(map[string]string)
args["-v"] = "8"
args["--logtostderr"] = "true"
args["--ca-cert"] = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
Expand All @@ -175,6 +173,12 @@ func (r *Agent) mutate(ctx context.Context, tenantControlPlane *kamajiv1alpha1.T
args["--health-server-port"] = "8134"
args["--service-account-token-path"] = "/var/run/secrets/tokens/konnectivity-agent-token"

extraArgs := utilities.ArgsFromSliceToMap(tenantControlPlane.Spec.Addons.Konnectivity.KonnectivityAgentSpec.ExtraArgs)

for k, v := range extraArgs {
args[k] = v
}

r.resource.Spec.Template.Spec.Containers[0].Args = utilities.ArgsFromMapToSlice(args)
r.resource.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{
{
Expand Down

0 comments on commit 6e7773c

Please sign in to comment.