Skip to content

Commit 7b2c203

Browse files
chore: add a feature toggle for the obs agent feature
1 parent 1e3406f commit 7b2c203

File tree

4 files changed

+39
-24
lines changed

4 files changed

+39
-24
lines changed

charts/ui/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ spec:
4040
value: https://{{ include "unikorn.application.host" . }}
4141
- name: PUBLIC_COMPUTE_HOST
4242
value: https://{{ include "unikorn.compute.host" . }}
43+
- name: PUBLIC_FEATURE_OBSERVABILITY_AGENT
44+
value: {{ ternary "true" "false" .Values.features.observabilityAgent | quote }}
4345
{{- if .Values.tls.private }}
4446
- name: NODE_EXTRA_CA_CERTS
4547
value: /var/run/secrets/unikorn-cloud.org/ca.crt

charts/ui/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ compute:
5050
# The API's hostname.
5151
host: compute.unikorn-cloud.org
5252

53+
features:
54+
observabilityAgent: false
55+
5356
oauth2:
5457
# The client identifier assigned to this application.
5558
clientID: 3fc34852-9186-4884-b580-78bf4bcf628a

src/routes/(shell)/kubernetes/clusters/create/+page.svelte

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import * as Clients from '$lib/clients';
99
import * as Kubernetes from '$lib/openapi/kubernetes';
1010
11+
import { env as publicEnv } from '$env/dynamic/public';
1112
import type { ShellPageSettings } from '$lib/layouts/types.ts';
1213
import ShellPageHeader from '$lib/layouts/ShellPageHeader.svelte';
1314
import ShellMetadataSection from '$lib/layouts/ShellMetadataSection.svelte';
@@ -31,6 +32,8 @@
3132
observabilityAgent: false
3233
};
3334
35+
const enableObservabilityAgent = publicEnv.PUBLIC_FEATURE_OBSERVABILITY_AGENT === 'true';
36+
3437
const settings: ShellPageSettings = {
3538
feature: 'Infrastructure',
3639
name: 'Create Kubernetes Cluster',
@@ -346,19 +349,21 @@
346349
{:else if index === 2}
347350
<h2 class="h2">Advanced Options</h2>
348351

349-
<ShellSection title="Observability Agent">
350-
<p>
351-
Install the observability agent to collect Kubernetes metrics and telemetry and forward them to your observability stack.
352-
</p>
352+
{#if enableObservabilityAgent}
353+
<ShellSection title="Observability Agent">
354+
<p>
355+
Install the observability agent to collect Kubernetes metrics and telemetry and forward them to your observability stack.
356+
</p>
353357

354-
<Switch
355-
name="observability-agent"
356-
label="Deploy observability agent"
357-
hint="Installs telemetry collectors in the cluster."
358-
initial={Boolean(resource.spec.features?.observabilityAgent)}
359-
onCheckedChange={observabilityAgentChange}
360-
/>
361-
</ShellSection>
358+
<Switch
359+
name="observability-agent"
360+
label="Deploy observability agent"
361+
hint="Installs telemetry collectors in the cluster."
362+
initial={Boolean(resource.spec.features?.observabilityAgent)}
363+
onCheckedChange={observabilityAgentChange}
364+
/>
365+
</ShellSection>
366+
{/if}
362367

363368
<ShellSection title="Auto Upgrade">
364369
<p>

src/routes/(shell)/kubernetes/clusters/view/[id]/+page.svelte

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
let { data }: { data: PageData } = $props();
55
6+
import { env as publicEnv } from '$env/dynamic/public';
67
import * as Clients from '$lib/clients';
78
import * as Kubernetes from '$lib/openapi/kubernetes';
89
import * as RegionUtil from '$lib/regionutil';
@@ -32,6 +33,8 @@
3233
observabilityAgent: false
3334
};
3435
36+
const enableObservabilityAgent = publicEnv.PUBLIC_FEATURE_OBSERVABILITY_AGENT === 'true';
37+
3538
const settings: ShellPageSettings = {
3639
feature: 'Infrastructure',
3740
name: 'View/update Kubernetes Cluster',
@@ -353,19 +356,21 @@
353356
{:else if index === 2}
354357
<h2 class="h2">Advanced Options</h2>
355358

356-
<ShellSection title="Observability Agent">
357-
<p>
358-
Install the observability agent to collect Kubernetes metrics and telemetry and forward them to your observability stack.
359-
</p>
359+
{#if enableObservabilityAgent}
360+
<ShellSection title="Observability Agent">
361+
<p>
362+
Install the observability agent to collect Kubernetes metrics and telemetry and forward them to your observability stack.
363+
</p>
360364

361-
<Switch
362-
name="observability-agent"
363-
label="Deploy observability agent"
364-
hint="Installs telemetry collectors in the cluster."
365-
initial={Boolean($state.snapshot(cluster.spec.features?.observabilityAgent))}
366-
onCheckedChange={observabilityAgentChange}
367-
/>
368-
</ShellSection>
365+
<Switch
366+
name="observability-agent"
367+
label="Deploy observability agent"
368+
hint="Installs telemetry collectors in the cluster."
369+
initial={Boolean($state.snapshot(cluster.spec.features?.observabilityAgent))}
370+
onCheckedChange={observabilityAgentChange}
371+
/>
372+
</ShellSection>
373+
{/if}
369374

370375
<ShellSection title="Auto Upgrade">
371376
<p>

0 commit comments

Comments
 (0)