From 2f32209a50a5754f534c299ac6f9daf70ec9a3e9 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sun, 15 Feb 2026 16:53:03 +0100 Subject: [PATCH] feat: IaC hints, YAML editor for worker configs (#7956) * feat: add CRD configuration hints to instance settings and workers pages Add subtle text notes with doc links to help K8s users discover that instance settings and worker group configs can be managed via the WindmillInstance CRD. Co-Authored-By: Claude Opus 4.6 * feat: IaC hints, YAML editor for worker configs, and EE badges - Move IaC hint from form view to YAML mode in Instance Settings - Add YAML editor drawer for worker group configs with diff review - Add EE-only badges to gated fields in worker config drawer - Make init_bash available in CE (frontend + backend gate) - Promote Init/Periodic scripts to top-level sections - Add "YAML editor" button to worker config drawer action bar - Strip cache_clear and empty fields from YAML output - Sort default/native groups first in YAML editor Co-Authored-By: Claude Opus 4.6 * fix: address PR review feedback on worker YAML editor - Extract serializeWorkerGroupsAsYaml() shared helper (dedup) - Fix name:undefined leak using proper destructuring - Protect default/native groups from accidental deletion - Add loading indicator during YAML save - Add restart warning for periodic script changes - Use consistent on:click event syntax in YAML drawer actions Co-Authored-By: Claude Opus 4.6 * refactor: use onClick prop instead of on:click for Button components Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- backend/windmill-api-configs/src/lib.rs | 5 +- .../components/AutoscalingConfigEditor.svelte | 4 +- .../lib/components/InstanceSettings.svelte | 10 +- .../src/lib/components/WorkerGroup.svelte | 262 ++++++++---------- .../(root)/(logged)/workers/+page.svelte | 225 +++++++++++++-- 5 files changed, 338 insertions(+), 168 deletions(-) diff --git a/backend/windmill-api-configs/src/lib.rs b/backend/windmill-api-configs/src/lib.rs index de4be9cf9c..59ad1625a4 100644 --- a/backend/windmill-api-configs/src/lib.rs +++ b/backend/windmill-api-configs/src/lib.rs @@ -129,10 +129,11 @@ async fn update_config( #[cfg(not(feature = "enterprise"))] let config = if name.starts_with("worker__") { - // In CE, only allow setting worker_tags (and cache_clear for cache management) + // In CE, only allow setting worker_tags, cache_clear, and init_bash serde_json::json!({ "worker_tags": config.get("worker_tags"), - "cache_clear": config.get("cache_clear") + "cache_clear": config.get("cache_clear"), + "init_bash": config.get("init_bash") }) } else { config diff --git a/frontend/src/lib/components/AutoscalingConfigEditor.svelte b/frontend/src/lib/components/AutoscalingConfigEditor.svelte index 82f260f502..20fb30f3e7 100644 --- a/frontend/src/lib/components/AutoscalingConfigEditor.svelte +++ b/frontend/src/lib/components/AutoscalingConfigEditor.svelte @@ -20,9 +20,10 @@ config: AutoscalingConfig | undefined worker_tags: string[] | undefined disabled: boolean + eeOnly?: boolean } - let { config = $bindable(), worker_tags, disabled }: Props = $props() + let { config = $bindable(), worker_tags, disabled, eeOnly = false }: Props = $props() let test_input: number = $state(3) let healthCheckLoading: boolean = $state(false) let healthCheckResult: { success: boolean; error?: string } | null = $state(null) @@ -62,6 +63,7 @@ class="flex flex-col gap-6" bind:collapsed description="Autoscaling automatically adjusts the number of workers based on your workload demands." + {eeOnly} > {#snippet labelExtra()} Beta diff --git a/frontend/src/lib/components/InstanceSettings.svelte b/frontend/src/lib/components/InstanceSettings.svelte index 9bf318c4ce..bf9d7a38b8 100644 --- a/frontend/src/lib/components/InstanceSettings.svelte +++ b/frontend/src/lib/components/InstanceSettings.svelte @@ -15,7 +15,7 @@ import AuthSettings from './AuthSettings.svelte' import InstanceSetting from './InstanceSetting.svelte' import { writable, type Writable } from 'svelte/store' - import { Loader2 } from 'lucide-svelte' + import { ExternalLink, Loader2 } from 'lucide-svelte' import YAML from 'yaml' import Toggle from './Toggle.svelte' import type SimpleEditor from './SimpleEditor.svelte' @@ -788,6 +788,14 @@ {/await} {:else if yamlMode} +

+ Use this YAML to manage instance settings as code. + Learn more +

import { TriangleAlert, - Copy, Plus, RefreshCcwIcon, RotateCcw, Settings, Trash, X, - ExternalLink + ExternalLink, + FileCode } from 'lucide-svelte' import { Alert, Button, Drawer } from './common' import Badge from './common/badge/Badge.svelte' @@ -31,7 +31,6 @@ import DrawerContent from './common/drawer/DrawerContent.svelte' import Section from './Section.svelte' import Label from './Label.svelte' - import YAML from 'yaml' import Toggle from './Toggle.svelte' import { defaultTags, nativeTags, type AutoscalingConfig } from './worker_group' import AutoscalingConfigEditor from './AutoscalingConfigEditor.svelte' @@ -202,6 +201,7 @@ shouldAutoOpenDrawer?: boolean onDrawerOpened?: () => void onDeleted?: (deletedGroupName: string) => void + onOpenYamlEditor?: () => void selectGroup?: import('svelte').Snippet } @@ -217,6 +217,7 @@ shouldAutoOpenDrawer = false, onDrawerOpened = () => {}, onDeleted = () => {}, + onOpenYamlEditor = undefined, selectGroup = undefined }: Props = $props() @@ -351,7 +352,7 @@ Only superadmin or devops role can edit the worker config. {/if} -