Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding konnectivity parameters #411

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v1alpha1/tenantcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ type ImageOverrideTrait struct {
}

// ExtraArgs allows adding additional arguments 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.
type ExtraArgs []string

type KonnectivityServerSpec struct {
Expand Down
10 changes: 8 additions & 2 deletions 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 All @@ -114,7 +117,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
4 changes: 2 additions & 2 deletions config/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ spec:
version: v0.0.32
properties:
extraArgs:
description: ExtraArgs allows adding additional arguments to said component.
description: ExtraArgs allows adding additional arguments 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 All @@ -360,7 +360,7 @@ spec:
version: v0.0.32
properties:
extraArgs:
description: ExtraArgs allows adding additional arguments to said component.
description: ExtraArgs allows adding additional arguments 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
4 changes: 2 additions & 2 deletions docs/content/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11304,7 +11304,7 @@ Enables the Konnectivity addon in the Tenant Cluster, required if the worker nod
<td><b>extraArgs</b></td>
<td>[]string</td>
<td>
ExtraArgs allows adding additional arguments to said component.<br/>
ExtraArgs allows adding additional arguments 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.<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down Expand Up @@ -11357,7 +11357,7 @@ Enables the Konnectivity addon in the Tenant Cluster, required if the worker nod
<td><b>extraArgs</b></td>
<td>[]string</td>
<td>
ExtraArgs allows adding additional arguments to said component.<br/>
ExtraArgs allows adding additional arguments 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.<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down
9 changes: 7 additions & 2 deletions internal/resources/konnectivity/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,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 +174,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
Loading