From 16da53637e1cc672a273a90a8a16812ce6c0c071 Mon Sep 17 00:00:00 2001 From: Timofei Larkin Date: Thu, 8 Oct 2026 12:22:59 +0200 Subject: [PATCH] feat(kubernetes): give each new cluster an etcd of its own A tenant Kubernetes cluster could only start once an ancestor Tenant had an etcd module turned on, which nobody creating a cluster may do, and every cluster below that tenant then shared one etcd, one CA and one disk. Anything that orders clusters on a tenant's behalf had to flip the tenant's etcd on first. A new cluster now renders its own EtcdCluster and DataStore, from the cozy-lib shapes the etcd chart uses, and is created and deleted with them. The awaiting-etcd state goes, since a datastore always exists. An existing cluster stays on the DataStore its live KamajiControlPlane names, and renders what it rendered before. Changing that name starts a Kamaji datastore migration, which freezes the tenant's writes and leaves every worker kubelet needing a restart, so no upgrade may do it. _namespace.etcd cannot decide this: tenant-root publishes one to every tenant whether or not an etcd runs behind it. On uninstall, Kamaji's datastore finalizer drops the tenant's role, prefix and user from an etcd this release deletes next, and it never completes while that etcd is down. The pre-delete hook therefore removes it from a TenantControlPlane on the cluster's own DataStore that outlives the wait, and deletes the etcd's PKI, which cert-manager issues without an owner. If the finalizer stays on, or the TenantControlPlane cannot be read, the hook fails before the PKI goes, so the uninstall is retried with the etcd still in place. A TenantControlPlane on a shared DataStore is left to Kamaji as before. A Cilium deny policy keeps the rest of the tenant namespace, ancestor tenants and off-cluster sources off the etcd ports; the Kubernetes backup strategy's dump Job carries the label it admits. The tenant etcd's scrape now selects its own members by instance, because every member etcd-operator runs carries app.kubernetes.io/name: etcd. The platform waits for etcd-operator before offering the application. The defrag job both charts share pulls its image through the configured registry, pinned by digest to the multi-architecture index, so a mirrored installation does not depend on ghcr.io for it. Tested with helm-unittest on both the own and the shared branch, the pre-delete hook's bats suite run against a stub kubectl for both, and a render of an existing cluster that matches main byte for byte. The guest e2e runs the defrag CronJob once, and probes the etcd client port from a labelled Pod, an unlabelled one and one in tenant-root. Co-authored-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Signed-off-by: Timofei Larkin --- .github/renovate.json | 7 + api/apps/v1alpha1/kubernetes/types.go | 11 + .../kubernetes/zz_generated.deepcopy.go | 16 + docs/agents/image-refs.md | 2 +- hack/admin-kubeconfig-invariant.bats | 73 --- hack/check-render-matrix.bats | 13 +- hack/e2e-chainsaw/_lib/run-kubernetes.sh | 72 ++- .../computeplane/chainsaw-test.yaml | 4 +- .../kubernetes-latest/chainsaw-test.yaml | 80 ++- .../kubernetes-latest/etcd-client-probes.yaml | 144 +++++ .../kubernetes-previous/chainsaw-test.yaml | 11 +- .../kubernetes-proxmox/tenant.yaml | 8 +- hack/e2e-install-cozystack.bats | 20 +- hack/kubernetes-pre-delete-hook.bats | 140 ++++- hack/lib/image-refs.sh | 16 +- hack/linstor-storage-mode_test.bats | 7 +- hack/run-kubernetes-drain_test.bats | 36 ++ ...run-kubernetes-talos-diagnostics_test.bats | 1 + hack/select-e2e_test.bats | 8 +- hack/testdata/render-fixtures/README.md | 4 +- packages/apps/kubernetes/README.md | 4 +- packages/apps/kubernetes/templates/NOTES.txt | 17 + .../apps/kubernetes/templates/_helpers.tpl | 64 +++ .../templates/ccm-proxmox/controller.yaml | 2 - .../cluster-autoscaler/deployment.yaml | 12 - .../apps/kubernetes/templates/cluster.yaml | 50 +- .../templates/csi-proxmox/controller.yaml | 2 +- .../apps/kubernetes/templates/csi/deploy.yaml | 2 - .../apps/kubernetes/templates/delete.yaml | 121 ++++ packages/apps/kubernetes/templates/etcd.yaml | 103 ++++ .../helmreleases/cert-manager-crds.yaml | 2 +- .../templates/helmreleases/cert-manager.yaml | 2 +- .../templates/helmreleases/cilium.yaml | 7 +- .../templates/helmreleases/coredns.yaml | 2 - .../templates/helmreleases/csi-proxmox.yaml | 2 +- .../templates/helmreleases/csi.yaml | 2 - .../helmreleases/gateway-api-crds.yaml | 2 +- .../templates/helmreleases/gpu-operator.yaml | 2 +- .../templates/helmreleases/hami.yaml | 2 +- .../templates/helmreleases/ingress-nginx.yaml | 2 +- .../helmreleases/metrics-server.yaml | 2 - .../helmreleases/monitoring-agents.yaml | 2 +- .../templates/helmreleases/ouroboros.yaml | 2 +- .../prometheus-operator-crds.yaml | 2 - .../templates/helmreleases/velero.yaml | 2 +- .../vertical-pod-autoscaler-crds.yaml | 2 +- .../helmreleases/vertical-pod-autoscaler.yaml | 2 +- .../victoria-metrics-operator.yaml | 2 +- .../helmreleases/volumesnapshot-crd.yaml | 2 - .../apps/kubernetes/templates/ingress.yaml | 17 +- .../kubernetes/templates/kccm/manager.yaml | 2 - .../tests/admin_kubeconfig_wait_test.yaml | 29 +- .../cilium_kube_proxy_replacement_test.yaml | 5 +- .../kubernetes/tests/delete_hook_test.yaml | 7 +- packages/apps/kubernetes/tests/etcd_test.yaml | 534 ++++++++++++++++++ .../kubernetes/tests/host_guard_test.yaml | 22 +- .../tests/ingress_proxied_gate_test.yaml | 18 - .../apps/kubernetes/tests/ouroboros_test.yaml | 20 - .../kubernetes/tests/values-ci-no-etcd.yaml | 8 - packages/apps/kubernetes/values.schema.json | 17 + packages/apps/kubernetes/values.yaml | 9 + .../sources/kubernetes-application.yaml | 3 + packages/core/platform/templates/apps.yaml | 6 + ...rnetes_etcd_storage_class_wiring_test.yaml | 31 + packages/core/platform/values.yaml | 9 + packages/extra/computeplane/README.md | 10 +- packages/extra/etcd/templates/podscrape.yaml | 2 +- packages/extra/etcd/tests/podscrape_test.yaml | 20 + packages/library/cozy-lib/templates/_etcd.tpl | 7 +- .../strategy-kubernetes-default.yaml | 7 + .../tests/rendering_test.yaml | 6 + .../kubernetes-rd/cozyrds/kubernetes.yaml | 4 +- 72 files changed, 1547 insertions(+), 339 deletions(-) create mode 100644 hack/e2e-chainsaw/kubernetes-latest/etcd-client-probes.yaml create mode 100644 packages/apps/kubernetes/templates/etcd.yaml create mode 100644 packages/apps/kubernetes/tests/etcd_test.yaml delete mode 100644 packages/apps/kubernetes/tests/values-ci-no-etcd.yaml create mode 100644 packages/core/platform/tests/apps_kubernetes_etcd_storage_class_wiring_test.yaml create mode 100644 packages/extra/etcd/tests/podscrape_test.yaml diff --git a/.github/renovate.json b/.github/renovate.json index be2a0c81e..9ed8290c1 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -18,6 +18,13 @@ "labels": ["automated", "security"] }, "customManagers": [ + { + "customType": "regex", + "description": "Track the multi-architecture etcd-defrag image used by tenant and guest maintenance jobs.", + "managerFilePatterns": ["/^packages/library/cozy-lib/templates/_etcd\\.tpl$/"], + "matchStrings": ["(?ghcr\\.io/ahrtr/etcd-defrag):(?v[0-9]+\\.[0-9]+\\.[0-9]+)@(?sha256:[a-f0-9]+)"], + "datasourceTemplate": "docker" + }, { "customType": "regex", "description": "Track the etcd image pinned in the extra/etcd EtcdCluster podTemplate. etcd-operator v0.4.5 bakes etcd 3.5.12 into its binary, and the chart overrides it with a hardcoded image string that the gomod/dockerfile managers cannot see. Without this manager the security-relevant pin (etcd 3.5.x releases are overwhelmingly security fixes) would silently age.", diff --git a/api/apps/v1alpha1/kubernetes/types.go b/api/apps/v1alpha1/kubernetes/types.go index c330bda68..d93d5f2b7 100644 --- a/api/apps/v1alpha1/kubernetes/types.go +++ b/api/apps/v1alpha1/kubernetes/types.go @@ -41,6 +41,9 @@ type ConfigSpec struct { // Kubernetes control-plane configuration. // +kubebuilder:default:={} ControlPlane ControlPlane `json:"controlPlane"` + // Dedicated etcd for this cluster's control plane, rendered with the cluster and deleted with it. Clusters that already run on their tenant's shared etcd keep it, and this section does not apply to them. + // +kubebuilder:default:={} + Etcd Etcd `json:"etcd"` // OIDC authentication and per-user RBAC for the tenant kube-apiserver. See https://cozystack.io/docs/v1.6/kubernetes/oidc-authentication/ for the operator guide. // +kubebuilder:default:={} Oidc OIDC `json:"oidc"` @@ -158,6 +161,14 @@ type CoreDNSAddon struct { ValuesOverride k8sRuntime.RawExtension `json:"valuesOverride"` } +type Etcd struct { + // Number of etcd members: `3` keeps quorum through the loss of one member, `1` runs a single member with no failover. Only `1` and `3` are accepted. The StorageClass is picked by the platform for each of the two shapes and fixed when the etcd is first created, so changing the count later keeps the class it started with. For that reason going from 3 members to 1 is refused when the etcd is on the class the platform names for 3 members, or off the class it names for 1: a single member would then hold the only copy of the control-plane state on storage that does not replicate it. + // +kubebuilder:default:=3 + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Maximum=3 + Replicas int `json:"replicas"` +} + type GPUOperatorAddon struct { // Enable GPU Operator. // +kubebuilder:default:=false diff --git a/api/apps/v1alpha1/kubernetes/zz_generated.deepcopy.go b/api/apps/v1alpha1/kubernetes/zz_generated.deepcopy.go index 69129b193..1590f340e 100644 --- a/api/apps/v1alpha1/kubernetes/zz_generated.deepcopy.go +++ b/api/apps/v1alpha1/kubernetes/zz_generated.deepcopy.go @@ -154,6 +154,7 @@ func (in *ConfigSpec) DeepCopyInto(out *ConfigSpec) { in.Proxmox.DeepCopyInto(&out.Proxmox) in.Addons.DeepCopyInto(&out.Addons) in.ControlPlane.DeepCopyInto(&out.ControlPlane) + out.Etcd = in.Etcd in.Oidc.DeepCopyInto(&out.Oidc) } @@ -219,6 +220,21 @@ func (in *CoreDNSAddon) DeepCopy() *CoreDNSAddon { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Etcd) DeepCopyInto(out *Etcd) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Etcd. +func (in *Etcd) DeepCopy() *Etcd { + if in == nil { + return nil + } + out := new(Etcd) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GPUOperatorAddon) DeepCopyInto(out *GPUOperatorAddon) { *out = *in diff --git a/docs/agents/image-refs.md b/docs/agents/image-refs.md index 9dec7b155..4b16a032e 100644 --- a/docs/agents/image-refs.md +++ b/docs/agents/image-refs.md @@ -32,7 +32,7 @@ A reference can be stored in three different kinds of file, and **all three are 1. **`packages///values.yaml`** — the common case, in the YAML sub-shapes listed here: single string, split map with `digest`, split map with the digest inside `tag`, chart-global `global.registry.address` + `global.images[]`, the OCI-artifact `platformSourceUrl`/`platformSourceRef` pair, and upstream ingress-nginx's split map with the repository in `image` and a separate `digest`. The sub-shapes exist because vendored upstream charts choose their own values layout; the list is empirical, not closed. 2. **`packages///images/.tag`** — a plain file holding one reference, read by templates via `.Files.Get` rather than through values. Easy to forget precisely because it never appears in a values file; otherwise an ordinary first-party reference that carries the cozystack version like any other. -3. **A declared file that embeds a reference in surrounding text** — used when a package vendors an upstream manifest and its `image:` target `sed`s the built reference straight into it. `packages/system/multus/templates/multus-daemonset-thick.yml` is the only instance today. It is vendored *and* patched: it carries Helm conditionals, so `yq` cannot parse it at all and the YAML pass yields nothing for it. What keeps its reference visible is the textual scrape `collect_image_refs` runs over every declared extra — for this entry that leg is not a backstop but the only one that works. +3. **A declared file that embeds a reference in surrounding text** — used when a package vendors an upstream manifest and its `image:` target `sed`s the built reference straight into it. `packages/system/multus/templates/multus-daemonset-thick.yml` is the only vendored instance today. It is vendored *and* patched: it carries Helm conditionals, so `yq` cannot parse it at all and the YAML pass yields nothing for it. What keeps its reference visible is the textual scrape `collect_image_refs` runs over every declared extra — for this entry that leg is not a backstop but the only one that works. `packages/library/cozy-lib/templates/_etcd.tpl` is declared the same way: the etcd maintenance jobs of every chart that includes it pull a digest-pinned third-party image from that template. `hack/lib/image-refs.sh` is the single enumeration of all three, and the only place that knowledge is allowed to live. `image_ref_files ` yields the files; `collect_image_refs ` yields the references inside them. Shape 3 is an explicit list (`IMAGE_REF_EXTRA_FILES`) rather than a `templates/**` glob, because such a glob would sweep in vendored upstream chart templates and Helm-templated `image:` lines where a blind rewrite corrupts a value that `make update` regenerates. The declared entry is safe from that despite now containing Helm conditionals: its `image:` lines are plain, and declaring a file is the deliberate statement that its references are stamped rather than templated. diff --git a/hack/admin-kubeconfig-invariant.bats b/hack/admin-kubeconfig-invariant.bats index fb764f557..bf4094f1b 100644 --- a/hack/admin-kubeconfig-invariant.bats +++ b/hack/admin-kubeconfig-invariant.bats @@ -72,76 +72,3 @@ load test_helper echo "Invariant holds for $matched Deployment(s)" rm -rf "$tmp" } - -@test "chart emits zero admin-kubeconfig Deployments when tenant has no etcd DataStore" { - # Without a DataStore (parent Tenant has not populated _namespace.etcd yet) - # the control-plane-side Deployments must NOT render at all. If they did, - # the wait-for-kubeconfig init would CrashLoopBackOff indefinitely - there - # would be no KamajiControlPlane to provision the Secret - consuming the - # HelmRelease wait budget and triggering exactly the remediation cycle the - # rest of this chart tries to avoid. This test renders the whole chart - # with etcd empty and asserts no Deployment references the admin-kubeconfig - # Secret. - tmp=$(mktemp -d) - - helm template invariant packages/apps/kubernetes \ - --namespace tenant-root \ - --values packages/apps/kubernetes/tests/values-ci-no-etcd.yaml \ - 2>/dev/null > "$tmp/rendered.yaml" - - matched=$( - yq --output-format=json eval-all '.' "$tmp/rendered.yaml" \ - | jq -s ' - map(select(.kind == "Deployment")) | - map(select( - (.spec.template.spec.volumes // []) - | any(.secret.secretName | test("-admin-kubeconfig$")?) - )) | - length - ' - ) - - if [ "$matched" -ne 0 ]; then - echo "Expected zero Deployments mounting *-admin-kubeconfig when etcd is empty, got $matched:" >&2 - yq --output-format=json eval-all '.' "$tmp/rendered.yaml" \ - | jq -s 'map(select(.kind == "Deployment") | .metadata.name)' >&2 - exit 1 - fi - - echo "No admin-kubeconfig Deployments rendered for empty etcd (as expected)" - rm -rf "$tmp" -} - -@test "chart emits zero admin-kubeconfig HelmReleases when tenant has no etcd DataStore" { - # Same principle as the Deployment variant above, extended to every child - # HelmRelease (cilium, coredns, csi, cert-manager, ...). They reference - # *-admin-kubeconfig via kubeConfig.secretRef and would otherwise sit in - # NotReady forever on an etcd-less tenant, polluting the HelmRelease list - # the operator sees and contradicting the "awaiting-etcd beacon only" - # contract of the soft-skip path. - tmp=$(mktemp -d) - - helm template invariant packages/apps/kubernetes \ - --namespace tenant-root \ - --values packages/apps/kubernetes/tests/values-ci-no-etcd.yaml \ - 2>/dev/null > "$tmp/rendered.yaml" - - matched=$( - yq --output-format=json eval-all '.' "$tmp/rendered.yaml" \ - | jq -s ' - map(select(.kind == "HelmRelease")) | - map(select(.spec.kubeConfig.secretRef.name | test("-admin-kubeconfig$")?)) | - length - ' - ) - - if [ "$matched" -ne 0 ]; then - echo "Expected zero HelmReleases referencing *-admin-kubeconfig when etcd is empty, got $matched:" >&2 - yq --output-format=json eval-all '.' "$tmp/rendered.yaml" \ - | jq -s 'map(select(.kind == "HelmRelease") | .metadata.name)' >&2 - exit 1 - fi - - echo "No admin-kubeconfig HelmReleases rendered for empty etcd (as expected)" - rm -rf "$tmp" -} diff --git a/hack/check-render-matrix.bats b/hack/check-render-matrix.bats index 3498079fb..696ee849f 100644 --- a/hack/check-render-matrix.bats +++ b/hack/check-render-matrix.bats @@ -209,7 +209,11 @@ EOF rm -rf "$tmp" } -@test "fixture states enable OIDC groups and shared-service resources" { +@test "fixture states enable OIDC groups, and a new cluster comes up with or without a tenant etcd" { + # A new Kubernetes cluster renders its own etcd, so whether the tenant + # publishes one (fresh does not, configured and wildcard do) changes + # nothing in its render: every state gets the cluster's EtcdCluster and + # the metrics-server addon that used to wait for a tenant etcd. tmp=$(mktemp -d) for state in fresh configured wildcard; do helm template tenant-check packages/apps/tenant -n tenant-test \ @@ -219,10 +223,13 @@ EOF -f "hack/testdata/render-fixtures/$state.yaml" > "$tmp/kubernetes.yaml" groups=$(awk '/^kind: KeycloakRealmGroup$/ {n++} END {print n+0}' "$tmp/tenant.yaml") metrics=$(awk '/^ name: kubernetes-check-metrics-server$/ {n++} END {print n+0}' "$tmp/kubernetes.yaml") + etcd=$(awk '/^kind: EtcdCluster$/ {k=1; next} k && /^ name: kubernetes-check-etcd$/ {n++} /^---/ {k=0} END {print n+0}' "$tmp/kubernetes.yaml") case "$state" in - fresh) [ "$groups" -eq 0 ]; [ "$metrics" -eq 0 ] ;; - *) [ "$groups" -eq 4 ]; [ "$metrics" -eq 1 ] ;; + fresh) [ "$groups" -eq 0 ] ;; + *) [ "$groups" -eq 4 ] ;; esac + [ "$metrics" -eq 1 ] + [ "$etcd" -eq 1 ] done rm -rf "$tmp" } diff --git a/hack/e2e-chainsaw/_lib/run-kubernetes.sh b/hack/e2e-chainsaw/_lib/run-kubernetes.sh index bf4ee7af2..2b03b0681 100644 --- a/hack/e2e-chainsaw/_lib/run-kubernetes.sh +++ b/hack/e2e-chainsaw/_lib/run-kubernetes.sh @@ -147,6 +147,69 @@ cozy_oidc_bindings() { printf '%s' "${bindings}" | sort } +# The cluster runs on an etcd of its own: the control plane names the DataStore +# the chart renders for this release, and that etcd reports Available. The e2e +# install leaves tenant-root's etcd off, so a cluster that fell back on a +# shared one would not have come up at all; this names what it runs on instead. +cozy_assert_own_etcd() { + local release="kubernetes-$1" + local datastore + datastore=$(kubectl --namespace tenant-test get kamajicontrolplanes.controlplane.cluster.x-k8s.io "${release}" --output jsonpath='{.spec.dataStoreName}') + if [ "${datastore}" != "tenant-test.${release}" ]; then + echo "FAIL: ${release} runs on DataStore '${datastore}', not on its own tenant-test.${release}" >&2 + false + fi + kubectl get datastores.kamaji.clastix.io "tenant-test.${release}" --output name + kubectl_wait_retry etcdclusters.etcd-operator.cozystack.io --namespace tenant-test "${release}-etcd" --timeout=2m --for=condition=Available +} + +# The cluster's etcd goes with it: the EtcdCluster and DataStore with the +# release, the member PVCs by garbage collection, and the cert-manager Secrets +# by the chart's post-delete Job. Anything left behind holds storage and quota +# in the tenant namespace for good. +# One read for cozy_wait_etcd_reaped, cut off at 20s or at the caller's +# deadline ($1, epoch seconds), whichever comes first. Past the deadline it +# does not run at all and fails like a read that timed out. +_cozy_etcd_reaped_read() { + local _remain=$(( $1 - $(date +%s) )) + shift + [ "$_remain" -gt 0 ] || return 124 + [ "$_remain" -le 20 ] || _remain=20 + timeout --kill-after=5 "$_remain" "$@" +} + +cozy_wait_etcd_reaped() { + local release="kubernetes-$1" + local _timeout="${2:-180}" + local _deadline=$(( $(date +%s) + _timeout )) + local _left + while :; do + # Each query exits the subshell on failure by hand: errexit is off inside a + # function its caller runs under ||, which cozy_cleanup does. A query that + # runs out of time counts as failed, so a hung read cannot keep the batch + # past the deadline. An empty label list goes to stderr as "No resources + # found", hence the 2>/dev/null. + _left=$( + _cozy_etcd_reaped_read "$_deadline" kubectl --namespace tenant-test get etcdclusters.etcd-operator.cozystack.io "${release}-etcd" --output name --ignore-not-found || exit 1 + _cozy_etcd_reaped_read "$_deadline" kubectl get datastores.kamaji.clastix.io "tenant-test.${release}" --output name --ignore-not-found || exit 1 + _cozy_etcd_reaped_read "$_deadline" kubectl --namespace tenant-test get pvc --selector "etcd-operator.cozystack.io/cluster=${release}-etcd" --output name 2>/dev/null || exit 1 + for _s in peer-ca ca server peer client; do + _cozy_etcd_reaped_read "$_deadline" kubectl --namespace tenant-test get secret "${release}-etcd-${_s}-tls" --output name --ignore-not-found || exit 1 + done + ) || _left="${_left:+${_left} }(a query failed)" + if [ -z "${_left}" ]; then + echo "» ${release} etcd, DataStore, PVCs and Secrets are gone" + return 0 + fi + if [ "$(date +%s)" -ge "${_deadline}" ]; then + echo "» ERROR: ${release} etcd leftovers after ${_timeout}s:" >&2 + printf '%s\n' "${_left}" | sed 's/^/ etcd-leftover: /' >&2 + return 1 + fi + sleep 5 + done +} + cozy_assert_oidc_apiserver_flags() { local release="$1" local extra_args @@ -673,6 +736,11 @@ cozy_cleanup() { # TRIGGERS KubeVirt VM teardown + PVC release. Block until the worker VMs, # VMIs (guest RAM) and disk PVCs are actually gone so the next tenant test # starts on a freed sandbox -- the root cause of the node-join flake. + if [ -n "${test_name}" ] && [ "$child_drained" -eq 1 ]; then + if ! cozy_wait_etcd_reaped "${test_name}" 180; then + cleanup_failed=1 + fi + fi if [ -n "${test_name}" ]; then if ! cozy_wait_tenant_drained "${test_name}" 300; then echo "» ERROR: scoped tenant resources did not drain" >&2 @@ -5380,7 +5448,7 @@ cozy_addon_helmrelease_names() { # empty-selection check below reports. _addon_hrs=$(printf '%s\n' "${_all_hrs}" | awk -v p="${_prefix}" 'index($0, p) == 1') if [ -z "${_addon_hrs}" ]; then - echo "No addon HelmReleases matched ${_prefix}* in ${_ns}. Either the parent has not created them yet, which is what this means on a failure path that ran before it was Ready, or this prefix no longer selects them, or the chart stopped rendering them - they are gated on _namespace.etcd and on their own addons..enabled in packages/apps/kubernetes/templates/helmreleases/." >&2 + echo "No addon HelmReleases matched ${_prefix}* in ${_ns}. Either the parent has not created them yet, which is what this means on a failure path that ran before it was Ready, or this prefix no longer selects them, or the chart stopped rendering them - each is gated on its own addons..enabled in packages/apps/kubernetes/templates/helmreleases/." >&2 printf '%s\n' "${_all_hrs}" >&2 return 1 fi @@ -6642,6 +6710,8 @@ EOF # guard below would have read is printed anyway. kubectl wait hr -n tenant-test "kubernetes-${test_name}" --timeout=5m --for=condition=ready + cozy_assert_own_etcd "${test_name}" + # The two old OIDC suites created control-plane-only clusters whose useful # assertions took seconds and whose pre-delete hooks then spent two full # 120s waits trying to uninstall child releases without a worker. Reuse the diff --git a/hack/e2e-chainsaw/computeplane/chainsaw-test.yaml b/hack/e2e-chainsaw/computeplane/chainsaw-test.yaml index f6e71abcd..3768f0380 100644 --- a/hack/e2e-chainsaw/computeplane/chainsaw-test.yaml +++ b/hack/e2e-chainsaw/computeplane/chainsaw-test.yaml @@ -9,8 +9,8 @@ # # The module runs in its own tenant, tenant-cplane, so turning it on and off # never touches the tenant-test that the other suites share. It is a child of -# tenant-root rather than of tenant-test because a tenant two levels down cannot -# reach the etcd it inherits from tenant-root (#4726). +# tenant-root, and needs no etcd module there: the wrapped cluster brings its +# own. # # The suite supplies its own worker pool. The default md0 the module renders # for an empty nodeGroups puts its disk on the `replicated` StorageClass, which diff --git a/hack/e2e-chainsaw/kubernetes-latest/chainsaw-test.yaml b/hack/e2e-chainsaw/kubernetes-latest/chainsaw-test.yaml index 695425364..57361732c 100644 --- a/hack/e2e-chainsaw/kubernetes-latest/chainsaw-test.yaml +++ b/hack/e2e-chainsaw/kubernetes-latest/chainsaw-test.yaml @@ -14,6 +14,12 @@ metadata: spec: catch: - events: {} + - podLogs: + namespace: tenant-test + selector: app.kubernetes.io/name=etcd-client-probe + - podLogs: + namespace: tenant-root + selector: app.kubernetes.io/name=etcd-client-probe steps: - name: tenant-kubernetes-latest-version try: @@ -80,7 +86,7 @@ spec: # wait, all on the passing path. Raising the ceiling to cover them is not # available -- the guard in hack/run-kubernetes-serial-console_test.bats # holds COZY_OP_CEILING equal to BOTH suites' `timeout:`, and two suites - # at 79m plus their 22m teardowns take 202m, which with the install and + # at 79m plus their 25m teardowns take 208m, which with the install and # the rest of a full run does not fit the job's own 265-minute cap. # What is available is a measurement: on the green run of this branch # (33724179053) the whole Test took 569.72s against this 4020s op, with @@ -103,7 +109,68 @@ spec: run_kubernetes_test 'keys | sort_by(.) | .[-1]' 'test-latest-version' '59991' 'true' 'true' check: ($error == null): true + - script: + timeout: 1m + content: | + set -eu + kubectl --namespace tenant-test delete job guest-etcd-defrag-e2e --ignore-not-found --timeout=30s + kubectl --namespace tenant-test create job guest-etcd-defrag-e2e --from=cronjob/kubernetes-test-latest-version-etcd-defrag + check: + ($error == null): true + - assert: + timeout: 3m + resource: + apiVersion: batch/v1 + kind: Job + metadata: + namespace: tenant-test + name: guest-etcd-defrag-e2e + status: + (conditions[?type == 'Complete']): + - status: "True" + # Who reaches the guest etcd's client port: a labelled Pod in tenant-test + # does, an unlabelled one and a Pod in tenant-root do not. Each Pod checks + # its own verdict and ends Succeeded only when it matches, see + # etcd-client-probes.yaml. 3m covers a cold pull of the probe image plus + # the control's 60s poll. + - apply: + file: etcd-client-probes.yaml + - assert: + timeout: 3m + resource: + apiVersion: v1 + kind: Pod + metadata: + namespace: tenant-test + name: etcd-probe-allowed + status: + phase: Succeeded + - assert: + timeout: 3m + resource: + apiVersion: v1 + kind: Pod + metadata: + namespace: tenant-test + name: etcd-probe-unlabelled + status: + phase: Succeeded + - assert: + timeout: 3m + resource: + apiVersion: v1 + kind: Pod + metadata: + namespace: tenant-root + name: etcd-probe-other-tenant + status: + phase: Succeeded finally: + - description: reclaim the guest etcd maintenance job + script: + timeout: 1m + content: | + kubectl --namespace tenant-test delete job guest-etcd-defrag-e2e --ignore-not-found --timeout=30s # Always runs after try/catch — i.e. after the crust-gather snapshots on a # failed run. Reclaims the tenant Kubernetes cluster, which run_kubernetes_test # applies imperatively (kubectl), so Chainsaw's auto-cleanup does not track it. @@ -111,11 +178,12 @@ spec: # and failure, followed by the compute/storage reclamation barriers. - description: tear down the tenant Kubernetes cluster script: - # 30s diagnostic Certificate + 5m child + 5m parent + 5m compute/PVC - # drain + 5m LINSTOR reclamation = 20m30s of inner bounds. Keep the op - # above that sum so an inner timeout reports its stage instead of a - # Chainsaw SIGKILL hiding it; normal cleanup returns immediately. - timeout: 22m + # 30s diagnostic Certificate + 5m child + 5m parent + 3m etcd + # reclamation + 5m compute/PVC drain + 5m LINSTOR reclamation = 23m30s + # of inner bounds. Keep the op above that sum so an inner timeout + # reports its stage instead of a Chainsaw SIGKILL hiding it; normal + # cleanup returns immediately. + timeout: 25m content: | set -eu cd ../../.. diff --git a/hack/e2e-chainsaw/kubernetes-latest/etcd-client-probes.yaml b/hack/e2e-chainsaw/kubernetes-latest/etcd-client-probes.yaml new file mode 100644 index 000000000..0797e08de --- /dev/null +++ b/hack/e2e-chainsaw/kubernetes-latest/etcd-client-probes.yaml @@ -0,0 +1,144 @@ +# Who the guest etcd's CiliumNetworkPolicy lets through to the client port. +# The three Pods run the same script; only EXPECT, the namespace and the +# labels differ. A Pod that cannot run the probe at all (no image, no nc, a +# client name that does not resolve) never reaches Succeeded, so it fails the +# assert instead of passing as refused. The labelled Pod in tenant-test is +# the control: it proves this image, name and command do reach etcd, so +# "closed" from the other two is the policy and not a broken probe. The Pod in +# tenant-root carries the allow label too, because any tenant can set it on +# its own Pods; only the namespace may keep it out. +# +# The control polls for up to 60s because a new Pod's identity can reach the +# etcd member's node after its first packet, and until then the policy denies +# it as `world`. That delay can only refuse, never admit, so the refusal +# probes take a single attempt. +apiVersion: v1 +kind: Pod +metadata: + name: etcd-probe-allowed + namespace: tenant-test + labels: + app.kubernetes.io/name: etcd-client-probe + policy.cozystack.io/allow-to-etcd-cluster: kubernetes-test-latest-version-etcd +spec: + restartPolicy: Never + securityContext: + runAsNonRoot: true + runAsUser: 1000 + seccompProfile: + type: RuntimeDefault + containers: + - name: probe + image: curlimages/curl:8.10.1 + command: + - sh + - -c + - | + set -eu + command -v nc >/dev/null + getent hosts "$ETCD_CLIENT" >/dev/null + if [ "$EXPECT" = open ]; then + deadline=$(( $(date +%s) + 60 )) + until nc -z -w 5 "$ETCD_CLIENT" 2379 || [ "$(date +%s)" -ge "$deadline" ]; do sleep 2; done + fi + got=closed + if nc -z -w 5 "$ETCD_CLIENT" 2379; then got=open; fi + echo "$ETCD_CLIENT:2379 is $got, expected $EXPECT" + [ "$got" = "$EXPECT" ] + env: + - name: ETCD_CLIENT + value: kubernetes-test-latest-version-etcd-client.tenant-test.svc + - name: EXPECT + value: open + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: ["ALL"] +--- +apiVersion: v1 +kind: Pod +metadata: + name: etcd-probe-unlabelled + namespace: tenant-test + labels: + app.kubernetes.io/name: etcd-client-probe +spec: + restartPolicy: Never + securityContext: + runAsNonRoot: true + runAsUser: 1000 + seccompProfile: + type: RuntimeDefault + containers: + - name: probe + image: curlimages/curl:8.10.1 + command: + - sh + - -c + - | + set -eu + command -v nc >/dev/null + getent hosts "$ETCD_CLIENT" >/dev/null + if [ "$EXPECT" = open ]; then + deadline=$(( $(date +%s) + 60 )) + until nc -z -w 5 "$ETCD_CLIENT" 2379 || [ "$(date +%s)" -ge "$deadline" ]; do sleep 2; done + fi + got=closed + if nc -z -w 5 "$ETCD_CLIENT" 2379; then got=open; fi + echo "$ETCD_CLIENT:2379 is $got, expected $EXPECT" + [ "$got" = "$EXPECT" ] + env: + - name: ETCD_CLIENT + value: kubernetes-test-latest-version-etcd-client.tenant-test.svc + - name: EXPECT + value: closed + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: ["ALL"] +--- +apiVersion: v1 +kind: Pod +metadata: + name: etcd-probe-other-tenant + namespace: tenant-root + labels: + app.kubernetes.io/name: etcd-client-probe + policy.cozystack.io/allow-to-etcd-cluster: kubernetes-test-latest-version-etcd +spec: + restartPolicy: Never + securityContext: + runAsNonRoot: true + runAsUser: 1000 + seccompProfile: + type: RuntimeDefault + containers: + - name: probe + image: curlimages/curl:8.10.1 + command: + - sh + - -c + - | + set -eu + command -v nc >/dev/null + getent hosts "$ETCD_CLIENT" >/dev/null + if [ "$EXPECT" = open ]; then + deadline=$(( $(date +%s) + 60 )) + until nc -z -w 5 "$ETCD_CLIENT" 2379 || [ "$(date +%s)" -ge "$deadline" ]; do sleep 2; done + fi + got=closed + if nc -z -w 5 "$ETCD_CLIENT" 2379; then got=open; fi + echo "$ETCD_CLIENT:2379 is $got, expected $EXPECT" + [ "$got" = "$EXPECT" ] + env: + - name: ETCD_CLIENT + value: kubernetes-test-latest-version-etcd-client.tenant-test.svc + - name: EXPECT + value: closed + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: ["ALL"] diff --git a/hack/e2e-chainsaw/kubernetes-previous/chainsaw-test.yaml b/hack/e2e-chainsaw/kubernetes-previous/chainsaw-test.yaml index 8a3ada8de..b15459ebb 100644 --- a/hack/e2e-chainsaw/kubernetes-previous/chainsaw-test.yaml +++ b/hack/e2e-chainsaw/kubernetes-previous/chainsaw-test.yaml @@ -82,11 +82,12 @@ spec: # and failure, followed by the compute/storage reclamation barriers. - description: tear down the tenant Kubernetes cluster script: - # 30s diagnostic Certificate + 5m child + 5m parent + 5m compute/PVC - # drain + 5m LINSTOR reclamation = 20m30s of inner bounds. Keep the op - # above that sum so an inner timeout reports its stage instead of a - # Chainsaw SIGKILL hiding it; normal cleanup returns immediately. - timeout: 22m + # 30s diagnostic Certificate + 5m child + 5m parent + 3m etcd + # reclamation + 5m compute/PVC drain + 5m LINSTOR reclamation = 23m30s + # of inner bounds. Keep the op above that sum so an inner timeout + # reports its stage instead of a Chainsaw SIGKILL hiding it; normal + # cleanup returns immediately. + timeout: 25m content: | set -eu cd ../../.. diff --git a/hack/e2e-chainsaw/kubernetes-proxmox/tenant.yaml b/hack/e2e-chainsaw/kubernetes-proxmox/tenant.yaml index 76e6e46fd..72af184e7 100644 --- a/hack/e2e-chainsaw/kubernetes-proxmox/tenant.yaml +++ b/hack/e2e-chainsaw/kubernetes-proxmox/tenant.yaml @@ -2,10 +2,8 @@ # shared tenant-test: these objects create VMs on a hypervisor, and a leak is # visible in `qm list` rather than only in the API. # -# etcd: true is not optional. KamajiControlPlane.spec.dataStoreName reads -# _namespace.etcd, and the DataStore is created by the tenant's own etcd module -# (packages/extra/etcd/templates/datastore.yaml) — without it the control plane -# does not render at all. +# etcd stays off: the cluster renders its own EtcdCluster and DataStore, so the +# tenant needs no etcd module for its control plane to come up. # Tenant names are validated as lowercase letters and digits only — no dashes — # so this is e2eproxmox rather than the e2e-proxmox the namespace would suggest. apiVersion: apps.cozystack.io/v1alpha1 @@ -14,7 +12,7 @@ metadata: name: e2eproxmox namespace: tenant-root spec: - etcd: true + etcd: false host: "" ingress: false monitoring: false diff --git a/hack/e2e-install-cozystack.bats b/hack/e2e-install-cozystack.bats index f7dda2d7b..74144bb8f 100644 --- a/hack/e2e-install-cozystack.bats +++ b/hack/e2e-install-cozystack.bats @@ -277,9 +277,13 @@ # package itself stays installed, because tenant-application declares # dependsOn cozystack.monitoring-application. Turning it on also means # flipping monitoring.rootEnabled in hack/e2e-platform-packages.sh. - kubectl patch tenants/root -n tenant-root --type merge -p '{"spec":{"host":"example.org","ingress":true,"monitoring":false,"etcd":true,"isolated":true, "seaweedfs": true}}' + # + # The root etcd stays off as well: every tenant Kubernetes cluster brings its + # own, and leaving the shared one off is what proves a cluster comes up with + # no tenant etcd anywhere above it. + kubectl patch tenants/root --namespace tenant-root --type merge --patch '{"spec":{"host":"example.org","ingress":true,"monitoring":false,"etcd":false,"isolated":true, "seaweedfs": true}}' - timeout 60 sh -ec 'until kubectl get hr -n tenant-root etcd ingress seaweedfs tenant-root >/dev/null 2>&1; do sleep 1; done' + timeout 60 sh -ec 'until kubectl get hr --namespace tenant-root ingress seaweedfs tenant-root >/dev/null 2>&1; do sleep 1; done' # tenant-root parent HR only flips Ready after every child HR is Ready, # so listing the children this patch enables plus the parent gives precise # failure messages without redundant separate waits. seaweedfs now @@ -290,7 +294,7 @@ # parent's Ready can land past the HR's single 15m timeout window; the HR # re-reconciles every 1m until it converges, so this wait is 20m to observe # that eventual Ready rather than expiring first. - kubectl wait hr/etcd hr/ingress hr/seaweedfs hr/tenant-root \ + kubectl wait hr/ingress hr/seaweedfs hr/tenant-root \ -n tenant-root --timeout=20m --for=condition=ready @@ -300,16 +304,6 @@ # NGINX ingress controller timeout 60 sh -ec 'until kubectl get deploy root-ingress-controller -n tenant-root >/dev/null 2>&1; do sleep 1; done' kubectl wait deploy/root-ingress-controller -n tenant-root --timeout=10m --for=condition=available - - # etcd cluster. The v1alpha2 operator manages member Pods directly and creates - # NO StatefulSet, so gate on the EtcdCluster readiness signal (mirrors - # hack/e2e-chainsaw/etcd and the examples) plus the member Pods themselves. - timeout 60 sh -ec 'until kubectl -n tenant-root get etcdcluster.etcd-operator.cozystack.io/etcd >/dev/null 2>&1; do sleep 2; done' - kubectl -n tenant-root wait etcdcluster.etcd-operator.cozystack.io/etcd \ - --for=jsonpath='{.status.conditions[?(@.type=="Available")].status}'=True --timeout=10m - kubectl -n tenant-root wait pod \ - -l app.kubernetes.io/name=etcd,app.kubernetes.io/instance=etcd,app.kubernetes.io/managed-by=etcd-operator \ - --for=condition=ready --timeout=10m } @test "Keycloak OIDC stack is healthy" { diff --git a/hack/kubernetes-pre-delete-hook.bats b/hack/kubernetes-pre-delete-hook.bats index 5d6b177ae..0637c3b5e 100644 --- a/hack/kubernetes-pre-delete-hook.bats +++ b/hack/kubernetes-pre-delete-hook.bats @@ -30,6 +30,11 @@ CHART=packages/apps/kubernetes # $KUBECTL_PRESENT -- these `get ... -o name` invocations print an object. # Anything not listed exits 0 with no output, which is # what `--ignore-not-found` does for an absent object. +# +# A present TenantControlPlane also answers Step 4a's read with the DataStore +# in $KUBECTL_TCP_STORE and the finalizers in $KUBECTL_TCP_FINALIZERS, and a +# patch of it stands for Kamaji's finalizer being removed: from then on the +# TenantControlPlane reads as gone. # The ordinary end state after Step 4 waited: the TenantControlPlane is gone and # the datastore Secret is still there for Step 4b to clear. @@ -59,6 +64,11 @@ FAIL_HR_DELETE_AND_LIST='*delete helmreleases* FAIL_TCP_PROBE='*get tenantcontrolplanes*' FAIL_SECRET_PROBE='*get secret*' +# A cluster on its own etcd: the DataStore name the chart renders for test-k8s +# in tenant-test, with Kamaji's datastore finalizer second in the list. +OWN_STORE=tenant-test.test-k8s +OWN_FINALIZERS='finalizer.kamaji.clastix.io/soot finalizer.kamaji.clastix.io' + # Every failure at once. The two HelmRelease globs are distinguished by the # patch body: Step 1 suspends (no "finalizers" in its payload) and must keep # working, because it is not backstopped and `set -e` would end the run there. @@ -68,6 +78,12 @@ FAIL_ALL='*delete helmreleases* *get tenantcontrolplanes* *patch secret*' +# The same, with the TenantControlPlane still readable. +FAIL_ALL_BUT_TCP_READS='*delete helmreleases* +*patch helmrelease*finalizers* +*delete tenantcontrolplanes* +*patch secret*' + # Extract the pre-delete Job's script from the rendered chart into $1. The # non-empty check must be an early `return 1`: hack/cozytest.sh rewrites every # line matching ^}$ into `return 0` plus `}`, helpers included, so a check left @@ -126,12 +142,23 @@ if matches "${KUBECTL_FAIL:-}"; then fi case "$args" in + *"patch tenantcontrolplanes"*) + : > "$KUBECTL_STATE/tcp-released" + ;; + *"get tenantcontrolplanes"*"jsonpath"*) + if matches "${KUBECTL_PRESENT:-}" && [ ! -e "$KUBECTL_STATE/tcp-released" ]; then + printf '%s\n' "${KUBECTL_TCP_STORE:-}" + for f in ${KUBECTL_TCP_FINALIZERS:-}; do printf '%s\n' "$f"; done + fi + ;; *"get helmreleases"*"-o name"*) echo "helmrelease.helm.toolkit.fluxcd.io/cilium" echo "helmrelease.helm.toolkit.fluxcd.io/coredns" ;; *"get tenantcontrolplanes"*"-o name"*) - matches "${KUBECTL_PRESENT:-}" && echo "tenantcontrolplane.kamaji.clastix.io/test-k8s" + if matches "${KUBECTL_PRESENT:-}" && [ ! -e "$KUBECTL_STATE/tcp-released" ]; then + echo "tenantcontrolplane.kamaji.clastix.io/test-k8s" + fi ;; *"get secret"*"-o name"*) matches "${KUBECTL_PRESENT:-}" && echo "secret/test-k8s-datastore-config" @@ -159,8 +186,10 @@ run_hook() { # Truncated per call, not appended to: the "stub was reached" check below is # vacuous on a second run against a log the first run already filled. : > "$tmp/kubectl.log" + rm --recursive --force "$tmp/state" && mkdir "$tmp/state" KUBECONFIG=/dev/null \ KUBECTL_LOG="$tmp/kubectl.log" \ + KUBECTL_STATE="$tmp/state" \ KUBECTL_FAIL="$1" \ KUBECTL_PRESENT="$2" \ PATH="$tmp/bin:$PATH" sh "$tmp/s.sh" > "$tmp/out" 2>&1 || rc=$? @@ -260,13 +289,16 @@ run_hook() { rm -rf "$tmp" } -@test "a TenantControlPlane outliving Step 4 is reported even though no command failed" { +@test "a TenantControlPlane on a shared DataStore outliving Step 4 is reported even though no command failed" { # Step 4 times out with the TCP still alive, so Step 4b declines to strip a # finalizer Kamaji may still own. Every kubectl call in Step 4b succeeds, so # nothing is caught by a `||` -- and the namespace is still wedged. This is # the one residue the script reports from a branch rather than from a failure. + # The shared etcd outlives the cluster, so Step 4a leaves Kamaji's own + # finalizer alone for it to drop the tenant's prefix from that etcd. setup_case - run_hook "$FAIL_TCP_DELETE" "$PRESENT_TCP_AND_SECRET" + KUBECTL_TCP_STORE=tenant-root KUBECTL_TCP_FINALIZERS="$OWN_FINALIZERS" \ + run_hook "$FAIL_TCP_DELETE" "$PRESENT_TCP_AND_SECRET" [ "$rc" = 0 ] if grep -qF 'Cleanup completed successfully' "$tmp/out"; then @@ -285,6 +317,62 @@ run_hook() { return 1 fi grep -qF 'is still present, so Kamaji may still own' "$tmp/out" + if grep --quiet --fixed-strings 'patch tenantcontrolplanes' "$tmp/kubectl.log"; then + echo "FAIL: Kamaji's finalizer was removed from a TenantControlPlane on a shared DataStore" + cat "$tmp/out" + return 1 + fi + + rm --recursive --force "$tmp" +} + +@test "a TenantControlPlane on its own etcd outliving Step 4 is released and the run completes" { + # What Kamaji's finalizer removes lives in the etcd this uninstall deletes + # next, and an etcd that never came up keeps Kamaji from ever removing it. + # Step 4a takes it off, at the index it was read at, and the rest of the + # teardown then sees the TenantControlPlane gone. + setup_case + KUBECTL_TCP_STORE="$OWN_STORE" KUBECTL_TCP_FINALIZERS="$OWN_FINALIZERS" \ + run_hook "$FAIL_TCP_DELETE" "$PRESENT_TCP_AND_SECRET" + + [ "$rc" = 0 ] + grep --quiet --fixed-strings '"op":"test","path":"/metadata/finalizers/1","value":"finalizer.kamaji.clastix.io"' "$tmp/kubectl.log" + grep --quiet --fixed-strings 'Removing finalizers from secret/test-k8s-datastore-config' "$tmp/out" + grep --quiet --fixed-strings 'delete secrets test-k8s-etcd-peer-ca-tls test-k8s-etcd-ca-tls test-k8s-etcd-server-tls test-k8s-etcd-peer-tls test-k8s-etcd-client-tls' "$tmp/kubectl.log" + grep --quiet --fixed-strings 'Cleanup completed successfully' "$tmp/out" + + rm --recursive --force "$tmp" +} + +@test "a rejected release of a TenantControlPlane on its own etcd fails before its etcd PKI goes" { + # Kamaji's finalizer is still on, so Kamaji still needs the etcd Helm deletes + # once the hook exits 0. The hook must stop before Step 8, name what it left, + # and leave the etcd's Secrets for the retried uninstall. + setup_case + KUBECTL_TCP_STORE="$OWN_STORE" KUBECTL_TCP_FINALIZERS="$OWN_FINALIZERS" \ + run_hook "$FAIL_TCP_DELETE +*patch tenantcontrolplanes*" "$PRESENT_TCP_AND_SECRET" + + if [ "$rc" = 0 ]; then + echo "FAIL: the hook exited 0 with Kamaji's finalizer still on a TenantControlPlane that needs this etcd" + cat "$tmp/out" + return 1 + fi + grep --quiet --fixed-strings 'failing before Step 8 so that its etcd is not deleted while Kamaji needs it' "$tmp/out" + summary=$(grep --fixed-strings 'residue left by:' "$tmp/out") + case "$summary" in + *'step 4a (TenantControlPlane datastore finalizer)'*'step 4b (TenantControlPlane still deleting)'*) ;; + *) + echo "FAIL: the summary did not name both the rejected release and the TenantControlPlane left behind" + cat "$tmp/out" + return 1 + ;; + esac + if grep --quiet --fixed-strings 'test-k8s-etcd-' "$tmp/kubectl.log"; then + echo "FAIL: the etcd PKI was deleted while Kamaji still needs the etcd" + cat "$tmp/out" + return 1 + fi rm -rf "$tmp" } @@ -293,11 +381,17 @@ run_hook() { # The probe is the gate that stops the finalizer being stripped from an owner # that still exists, so reading its failure as "confirmed gone" defeats it in # the one direction that does damage. The script must neither strip nor claim - # the run was clean. + # the run was clean. This render owns its etcd, so the same unknown also + # keeps that etcd: the hook fails before Step 8 rather than let Helm delete + # it under a TenantControlPlane that may still need it. setup_case run_hook "$FAIL_TCP_PROBE" "" - [ "$rc" = 0 ] + if [ "$rc" = 0 ]; then + echo "FAIL: the hook exited 0 without knowing whether Kamaji still needs this cluster's etcd" + cat "$tmp/out" + return 1 + fi if grep -qF 'Cleanup completed successfully' "$tmp/out"; then echo "FAIL: cleanup claimed success without establishing whether the TenantControlPlane was gone" cat "$tmp/out" @@ -338,10 +432,12 @@ run_hook() { } @test "every step that left residue is named in the closing message" { + # The TenantControlPlane reads fail as well, so on this cluster's own etcd the + # run ends before Step 8, and the summary it prints there is the closing one. setup_case run_hook "$FAIL_ALL" "" - [ "$rc" = 0 ] + [ "$rc" != 0 ] if grep -qF 'Cleanup completed successfully' "$tmp/out"; then echo "FAIL: cleanup claimed success with every remedy having failed" cat "$tmp/out" @@ -382,7 +478,7 @@ run_hook() { # still end the run under `set -e`. Nothing but `set -e` enforces that, so a # `|| true` appended to one of them later would reinstate the exact defect # this file pins: a cleanup that did not happen, reported as success. Step 3 - # stands in for Steps 3, 5, 6, 7 and the patch inside Step 1. Step 1's + # stands in for Steps 3, 5, 6, 7, 8 and the patch inside Step 1. Step 1's # enumeration is NOT among them: it carries `|| true` on purpose, because # Step 2 deletes by label rather than from that list, so a failure there # leaves nothing behind to report. @@ -408,7 +504,9 @@ run_hook() { # its honesty with. This is a pre-delete hook: a non-zero exit aborts the Helm # uninstall before the release is removed, so the release stays in storage and # the same teardown is retried forever. Reporting failure through the exit - # code is what the closing message exists to avoid. + # code is what the closing message exists to avoid. Every remedy fails here + # against a TenantControlPlane on a shared DataStore, which this cluster's + # uninstall deletes nothing from. setup_case run_hook "" "$PRESENT_SECRET_ONLY" @@ -418,9 +516,31 @@ run_hook() { return 1 fi - run_hook "$FAIL_ALL" "" + KUBECTL_TCP_STORE=tenant-root KUBECTL_TCP_FINALIZERS="$OWN_FINALIZERS" \ + run_hook "$FAIL_ALL_BUT_TCP_READS" "$PRESENT_TCP_AND_SECRET" if [ "$rc" != 0 ]; then - echo "FAIL: an all-failures run exited $rc, which would wedge the release" + echo "FAIL: an all-failures run on a shared DataStore exited $rc, which would wedge the release" + cat "$tmp/out" + return 1 + fi + + rm --recursive --force "$tmp" +} + +@test "fails before its etcd PKI goes when every remedy failed on a cluster's own etcd" { + # The one exception to exiting 0: Helm deletes this cluster's etcd once the + # hook exits 0, and a TenantControlPlane that cannot be read may still need + # it. Failing keeps the etcd and its PKI for the retried uninstall. + setup_case + run_hook "$FAIL_ALL" "" + + if [ "$rc" = 0 ]; then + echo "FAIL: an all-failures run on a cluster's own etcd exited 0, letting Helm delete the etcd" + cat "$tmp/out" + return 1 + fi + if grep --quiet --fixed-strings 'test-k8s-etcd-' "$tmp/kubectl.log"; then + echo "FAIL: the etcd PKI was deleted although the TenantControlPlane could not be read" cat "$tmp/out" return 1 fi diff --git a/hack/lib/image-refs.sh b/hack/lib/image-refs.sh index 4b8732388..3a78c4afe 100644 --- a/hack/lib/image-refs.sh +++ b/hack/lib/image-refs.sh @@ -40,10 +40,16 @@ # regenerates. An entry here is a deliberate statement that some package's # `image:` target sed's a ref into a file it vendors from upstream. # -# system/multus is the only one today: its templates/ is the upstream -# multus-daemonset-thick.yml fetched by `make update`, and multus's Makefile -# `image:` target sed's the built ref into every `multus-cni` `image:` line -# inside it. +# system/multus is the only such vendored file today: its templates/ is the +# upstream multus-daemonset-thick.yml fetched by `make update`, and multus's +# Makefile `image:` target sed's the built ref into every `multus-cni` `image:` +# line inside it. +# +# library/cozy-lib/templates/_etcd.tpl is listed for a different reason: it is +# first-party source pinning a third-party ref, the etcd-defrag image of every +# etcd maintenance CronJob. The retag and the mirror keep only refs under their +# own registry and drop it; what listing it buys is verify-multiarch.sh +# checking that the pinned digest serves both architectures. # # KNOWN GAP, deliberately not listed: system/capi-providers-cpprovider stamps # its kamaji ref into files/control-plane-components.yaml AND into the @@ -64,7 +70,7 @@ # variable able to silently NARROW it is a hazard with no matching use case. # Word splitting is intended (the list is whitespace-separated), which also # means a path containing whitespace cannot be represented here. -IMAGE_REF_EXTRA_FILES="system/multus/templates/multus-daemonset-thick.yml" +IMAGE_REF_EXTRA_FILES="system/multus/templates/multus-daemonset-thick.yml library/cozy-lib/templates/_etcd.tpl" # Emit every ref-bearing file under , one per line. # diff --git a/hack/linstor-storage-mode_test.bats b/hack/linstor-storage-mode_test.bats index 510da4cd6..a4eeb7e77 100644 --- a/hack/linstor-storage-mode_test.bats +++ b/hack/linstor-storage-mode_test.bats @@ -212,6 +212,7 @@ idle_pool_datasets() { idle_pool_datasets >"$pool_dir/datasets.0" idle_pool_datasets | sed 's/^data-\(srv[0-9]\)/\1 &/' >"$COZY_LINSTOR_POOL_BASELINE_FILE" cozy_wait_tenant_drained() { return 0; } + cozy_wait_etcd_reaped() { return 0; } fake_linstor_clock rc=0 @@ -600,9 +601,9 @@ idle_pool_datasets() { @test "Kubernetes cleanup operations outlive their bounded reclamation stages" { for suite in latest previous; do - timeout=$(yq "select(.metadata.name == \"kubernetes-${suite}\") | .spec.steps[0].finally[0].script.timeout" "hack/e2e-chainsaw/kubernetes-${suite}/chainsaw-test.yaml") - if [ "$timeout" != 22m ]; then - echo "kubernetes-${suite} cleanup timeout is $timeout, expected 22m" >&2 + timeout=$(yq "select(.metadata.name == \"kubernetes-${suite}\") | .spec.steps[0].finally[] | select(.description == \"tear down the tenant Kubernetes cluster\") | .script.timeout" "hack/e2e-chainsaw/kubernetes-${suite}/chainsaw-test.yaml") + if [ "$timeout" != 25m ]; then + echo "kubernetes-${suite} cleanup timeout is $timeout, expected 25m" >&2 return 1 fi done diff --git a/hack/run-kubernetes-drain_test.bats b/hack/run-kubernetes-drain_test.bats index bc0ec6b35..452d44596 100644 --- a/hack/run-kubernetes-drain_test.bats +++ b/hack/run-kubernetes-drain_test.bats @@ -115,3 +115,39 @@ load test_helper exit 1 } } + +@test "an etcd reclamation read past its deadline is not run and fails as timed out" { + . hack/e2e-chainsaw/_lib/run-kubernetes.sh + tmp=$(mktemp --directory) + rc=0 + _cozy_etcd_reaped_read "$(( $(date +%s) - 1 ))" touch "$tmp/ran" || rc=$? + if [ "$rc" -ne 124 ]; then + echo "expected status 124 past the deadline, got $rc" >&2 + exit 1 + fi + if [ -e "$tmp/ran" ]; then + echo "the read ran although its deadline had passed" >&2 + exit 1 + fi + rm --recursive --force "$tmp" +} + +@test "an etcd reclamation read is cut off at the deadline, not at its own 20s" { + . hack/e2e-chainsaw/_lib/run-kubernetes.sh + timeout() { printf '%s\n' "$*" > "$tmp/timeout.args"; } + tmp=$(mktemp --directory) + _cozy_etcd_reaped_read "$(( $(date +%s) + 3 ))" kubectl get pvc + case "$(cat "$tmp/timeout.args")" in + "--kill-after=5 "[1-3]" kubectl get pvc") ;; + *) + echo "expected a bound of at most 3s, got: $(cat "$tmp/timeout.args")" >&2 + exit 1 + ;; + esac + _cozy_etcd_reaped_read "$(( $(date +%s) + 600 ))" kubectl get pvc + if [ "$(cat "$tmp/timeout.args")" != "--kill-after=5 20 kubectl get pvc" ]; then + echo "expected the 20s cap far from the deadline, got: $(cat "$tmp/timeout.args")" >&2 + exit 1 + fi + rm --recursive --force "$tmp" +} diff --git a/hack/run-kubernetes-talos-diagnostics_test.bats b/hack/run-kubernetes-talos-diagnostics_test.bats index 5ce8eef66..5cf7c9b48 100644 --- a/hack/run-kubernetes-talos-diagnostics_test.bats +++ b/hack/run-kubernetes-talos-diagnostics_test.bats @@ -461,6 +461,7 @@ assert_file_contains() { @test "cleanup deletes diagnostic Certificate before its Pod and Secret" { . hack/e2e-chainsaw/_lib/run-kubernetes.sh cozy_wait_linstor_pool_baseline() { return 0; } + cozy_wait_etcd_reaped() { return 0; } tmp=$(mktemp -d) kubectl_calls="$tmp/kubectl.calls" diff --git a/hack/select-e2e_test.bats b/hack/select-e2e_test.bats index f79d6b05c..1d261ef92 100644 --- a/hack/select-e2e_test.bats +++ b/hack/select-e2e_test.bats @@ -1145,7 +1145,7 @@ assert_full_suite() { rm -rf "$tmp" } -@test "an etcd-operator change selects the etcd suite, not the whole run" { +@test "an etcd-operator change selects the suites that run an etcd, not the whole run" { # cozystack.etcd-operator reached no runnable suite, so every change to the # operator ran all 21 -- 5 of the last 150 merged pull requests. The suite # exists and the app genuinely needs the operator (extra/etcd renders kind: @@ -1153,6 +1153,8 @@ assert_full_suite() { # was the dependsOn edge that makes the app reachable from it. Both operator # components are asserted: the reverse walk starts from whichever # PackageSource owns the changed path, and the CRDs sit in the same source. + # Every tenant Kubernetes cluster renders an EtcdCluster of its own as well, + # so the kubernetes-application edge brings in the suites that create one. tmp=$(mktemp -d) cp -r packages/core/platform/sources "$tmp/sources" # Guard the premise: without the edge this passes for the wrong reason, @@ -1162,8 +1164,8 @@ assert_full_suite() { packages/system/etcd-operator-crds/templates/etcd-clusters.yaml; do echo "$path" > "$tmp/diff" output=$(hack/select-e2e.sh "$tmp/diff" "$tmp/sources") - assert_selection "an etcd-operator change must select only the etcd suite" \ - "$output" "etcd" + assert_selection "an etcd-operator change must select the etcd and tenant Kubernetes suites" \ + "$output" "computeplane etcd kubernetes-latest kubernetes-previous" done rm -rf "$tmp" } diff --git a/hack/testdata/render-fixtures/README.md b/hack/testdata/render-fixtures/README.md index adfc24f2e..32661c899 100644 --- a/hack/testdata/render-fixtures/README.md +++ b/hack/testdata/render-fixtures/README.md @@ -6,7 +6,7 @@ The source of `_cluster` is `packages/core/platform/templates/apps.yaml`; `_name `scheduling` and `branding` are maps copied with `toYaml`, which preserves their nested types. The scheduling keys read by app charts have a more specific contract: `globalAppTopologySpreadConstraints` is a string containing YAML (or an empty string), and `dedicatedNodesForWindowsVMs` is compared with the string `"true"`. The configured and wildcard fixtures supply a topology constraint; fresh leaves it empty. The embedded YAML retains numeric fields such as `maxSkew`. -`_namespace.` contains the namespace providing the shared service, or an empty string when unavailable. A non-empty value enables the service-dependent templates in the Kubernetes chart. These states use ingress rather than Gateway API, so `gateway` stays empty: a non-empty gateway would disable Harbor Ingress and leave the certificate modes untested. +`_namespace.` contains the namespace providing the shared service, or an empty string when unavailable. A new Kubernetes cluster renders its own etcd, so `etcd` changes nothing in that chart's render; it still drives the tenant chart's inheritance. These states use ingress rather than Gateway API, so `gateway` stays empty: a non-empty gateway would disable Harbor Ingress and leave the certificate modes untested. | File | State | |---|---| @@ -18,7 +18,7 @@ Each chart is attempted under every fixture. `vm-instance` and `kubernetes-nodes `lookup` returns an empty result during this check. Tests for existing objects belong in chart-specific helm-unittest suites using `kubernetesProvider`; `packages/apps/clickhouse/tests/backup_api_password_persistence_test.yaml` covers both password generation and preservation that way. Presets, replica counts and other app feature toggles are outside this sweep. -The BATS suite checks fixture types with the small Helm chart in `validator/`, using `--set-file` so explicit nulls are not removed by Helm's values merge. Separate assertions check PostgreSQL topology constraints, tenant OIDC groups, the Kubernetes metrics-server HelmRelease and Harbor per-host ACME versus wildcard TLS. Pairwise comparison of complete tenant renders detects duplicate fixture states, and a second render of each state checks that randomness cannot satisfy that comparison. The branch assertions are needed because tenant also copies injected values into a Secret, so different output alone does not prove a conditional resource was rendered. +The BATS suite checks fixture types with the small Helm chart in `validator/`, using `--set-file` so explicit nulls are not removed by Helm's values merge. Separate assertions check PostgreSQL topology constraints, tenant OIDC groups, a Kubernetes cluster's own etcd and its metrics-server HelmRelease in every state, and Harbor per-host ACME versus wildcard TLS. Pairwise comparison of complete tenant renders detects duplicate fixture states, and a second render of each state checks that randomness cannot satisfy that comparison. The branch assertions are needed because tenant also copies injected values into a Secret, so different output alone does not prove a conditional resource was rendered. When adding an injected value read by an app, update the relevant states and add an assertion for the branch it exercises. Review all read forms, including `index`, `get` and `dig`, before deciding a value is unused: diff --git a/packages/apps/kubernetes/README.md b/packages/apps/kubernetes/README.md index 6c5edb2ad..300f42855 100644 --- a/packages/apps/kubernetes/README.md +++ b/packages/apps/kubernetes/README.md @@ -56,7 +56,7 @@ Deploying it involves the following components: Each control plane pod includes essential components like `kube-apiserver`, `controller-manager`, and `scheduler`, allowing for efficient multi-tenancy and resource utilization. -- **Etcd**: the control plane keeps its state in the tenant's etcd, which this application does not deploy. It is the etcd the Tenant runs when `etcd` is enabled on it or on one of its parent tenants, built with the cozystack [etcd-operator](https://github.com/cozystack/etcd-operator), and every tenant Kubernetes cluster that uses it shares it. Until that etcd exists, the application creates only a `-awaiting-etcd` ConfigMap that says so, and provisions the cluster once the etcd is there. +- **Etcd**: each cluster runs its own etcd, an `EtcdCluster` named `-etcd` built with the cozystack [etcd-operator](https://github.com/cozystack/etcd-operator), and its own Kamaji `DataStore` named `.`; both are created and deleted with the cluster. `etcd.replicas` chooses three members (the default) or one. Each member starts at 1000m CPU and 512Mi memory limits with a 4Gi volume, counted against the tenant's quota; where a VerticalPodAutoscaler runs, it sizes each member's requests as it is recreated, up to 5000m CPU and 8Gi memory divided by the platform's CPU and memory allocation ratios (500m and 8Gi at the default ratios of 10 and 1), with the limits scaled in proportion. The platform administrator picks the volume's StorageClass for each of the two shapes, through the `_cluster` keys `etcd-storage-class-local` (three members) and `etcd-storage-class-replicated` (one member); without them it is the namespace default. A cluster whose control plane already runs on the shared etcd of its tenant (`Tenant.spec.etcd`) keeps that etcd, and nothing moves it. A backup through the `Kubernetes` backup strategy dumps the cluster's key prefix from whichever DataStore it runs on, its own etcd or a shared one. - **Worker Nodes**: worker nodes are virtual machines running Talos Linux that join the tenant cluster. They come in pools, and each pool is a separate `KubernetesNodes` resource that names this cluster and sets its own size, disk, Talos image and scaling bounds; this application creates no worker nodes itself. With `substrate: kubevirt` the virtual machines run on KubeVirt in the management cluster, and with `substrate: proxmox` on an external Proxmox VE cluster. @@ -217,6 +217,8 @@ A storage shared between tenants cannot be scoped: `Datastore.Allocate` on it is | `controlPlane.konnectivity.server.resourcesPreset` | Preset if `resources` omitted. | `string` | `t1.micro` | | `controlPlane.kubelet` | Kubelet connection settings. | `object` | `{}` | | `controlPlane.kubelet.preferredAddressTypes` | Node address types the tenant kube-apiserver tries, in order, when it connects to a kubelet, passed through to KamajiControlPlane `spec.kubelet.preferredAddressTypes`, which the control plane renders as `--kubelet-preferred-address-types`. The KamajiControlPlane CRD rejects a repeated name. Empty by default, which renders `InternalIP`, `ExternalIP`, or the list of a `--kubelet-preferred-address-types=` entry in `controlPlane.apiServer.extraArgs` when there is one. | `[]string` | `[]` | +| `etcd` | Dedicated etcd for this cluster's control plane, rendered with the cluster and deleted with it. Clusters that already run on their tenant's shared etcd keep it, and this section does not apply to them. | `object` | `{}` | +| `etcd.replicas` | Number of etcd members: `3` keeps quorum through the loss of one member, `1` runs a single member with no failover. Only `1` and `3` are accepted. The StorageClass is picked by the platform for each of the two shapes and fixed when the etcd is first created, so changing the count later keeps the class it started with. For that reason going from 3 members to 1 is refused when the etcd is on the class the platform names for 3 members, or off the class it names for 1: a single member would then hold the only copy of the control-plane state on storage that does not replicate it. | `int` | `3` | ### OIDC diff --git a/packages/apps/kubernetes/templates/NOTES.txt b/packages/apps/kubernetes/templates/NOTES.txt index 138864b17..e78d90cae 100644 --- a/packages/apps/kubernetes/templates/NOTES.txt +++ b/packages/apps/kubernetes/templates/NOTES.txt @@ -47,3 +47,20 @@ KubernetesNodes pool `roles: [ingress-nginx]`, otherwise the controller has nowhere to run and ingress stays unavailable (the chart no longer fails the render for this — it is a runtime requirement). {{- end }} +{{- $sharedDataStore := include "kubernetes.etcd.sharedDataStore" . }} + +{{- if $sharedDataStore }} + +This cluster keeps its control-plane state on the shared DataStore +{{ $sharedDataStore }}, which it ran on before Cozystack gave each cluster its +own etcd. Nothing moves it off that DataStore automatically. +{{- else }} + +This cluster keeps its control-plane state in its own etcd, +EtcdCluster/{{ include "kubernetes.etcd.name" . }}: {{ .Values.etcd.replicas }} member(s), each starting at +1000m CPU / 512Mi memory limits with a 4Gi volume, counted against this +tenant's resource quota. Where a VerticalPodAutoscaler runs, it sizes each +member's requests as it is recreated, up to 5000m CPU / 8Gi memory divided by +the platform's CPU and memory allocation ratios (500m / 8Gi at the default +ratios of 10 and 1), with the limits scaled in proportion. +{{- end }} diff --git a/packages/apps/kubernetes/templates/_helpers.tpl b/packages/apps/kubernetes/templates/_helpers.tpl index f9b706baa..6da1cce85 100644 --- a/packages/apps/kubernetes/templates/_helpers.tpl +++ b/packages/apps/kubernetes/templates/_helpers.tpl @@ -265,3 +265,67 @@ never boots. {{- define "kubernetes.proxmoxControllerVmID" -}} {{- add 100000 (mod (atoi (adler32sum (printf "%s/%s" .Release.Namespace .Release.Name))) 800000) -}} {{- end -}} + +{{/* +Name of the EtcdCluster this cluster owns. The operator derives two DNS +labels from it, the member Pods (-xxxxx) and the -client +Service, so it must leave seven of the 63 characters free. The app name is +capped well inside that today; the guard holds the line if the cap moves. +*/}} +{{- define "kubernetes.etcd.name" -}} +{{- $name := printf "%s-etcd" .Release.Name -}} +{{- if gt (len $name) 56 -}} +{{- fail (printf "etcd cluster name %q is longer than 56 characters, which leaves no room for the names etcd-operator derives from it" $name) -}} +{{- end -}} +{{- $name -}} +{{- end }} + +{{/* +Name of the DataStore this cluster owns. DataStore is cluster-scoped, and +Kamaji copies the name into a pod label value, so it must be unique across +the cluster and at most 63 characters. A namespace cannot contain a dot, so +. never collides with another cluster's DataStore nor +with a tenant's shared one, which the etcd chart names after its namespace. +*/}} +{{- define "kubernetes.etcd.dataStoreName" -}} +{{- $name := printf "%s.%s" .Release.Namespace .Release.Name -}} +{{- if gt (len $name) 63 -}} +{{- $name = printf "%s-%s" (trunc 54 $name | trimSuffix "-" | trimSuffix ".") (sha256sum $name | trunc 8) -}} +{{- end -}} +{{- $name -}} +{{- end }} + +{{/* +The shared DataStore a pre-existing cluster runs on, or empty when the +cluster owns its etcd. Changing a live cluster's dataStoreName starts a +Kamaji datastore migration — tenant writes frozen while it copies, every +worker kubelet needing a restart afterwards — so a chart upgrade must never +cause one. The live KamajiControlPlane is the record of which datastore a +cluster uses. _namespace.etcd is not: tenant-root publishes it to every +tenant whether or not an etcd runs behind it, and a tenant switching its own +etcd on would otherwise move every cluster below it. +*/}} +{{- define "kubernetes.etcd.sharedDataStore" -}} +{{- $kcp := lookup "controlplane.cluster.x-k8s.io/v1alpha1" "KamajiControlPlane" .Release.Namespace .Release.Name | default dict -}} +{{- $live := dig "spec" "dataStoreName" "" $kcp -}} +{{- if and $live (ne $live (include "kubernetes.etcd.dataStoreName" .)) -}} +{{- $live -}} +{{- end -}} +{{- end }} + +{{/* +spec.storage.storageClassName is immutable on an EtcdCluster, so the class +is chosen once, from the replica count, and read back from the live object +on every render after that. Unset platform keys leave it to the namespace +default StorageClass. +*/}} +{{- define "kubernetes.etcd.storageClass" -}} +{{- $live := lookup "etcd-operator.cozystack.io/v1alpha2" "EtcdCluster" .Release.Namespace (include "kubernetes.etcd.name" .) -}} +{{- if $live -}} +{{- dig "spec" "storage" "storageClassName" "" $live -}} +{{- else if eq (int .Values.etcd.replicas) 1 -}} +{{- index (.Values._cluster | default dict) "etcd-storage-class-replicated" | default "" -}} +{{- else -}} +{{- index (.Values._cluster | default dict) "etcd-storage-class-local" | default "" -}} +{{- end -}} +{{- end }} diff --git a/packages/apps/kubernetes/templates/ccm-proxmox/controller.yaml b/packages/apps/kubernetes/templates/ccm-proxmox/controller.yaml index 6e6f842cb..65345fead 100644 --- a/packages/apps/kubernetes/templates/ccm-proxmox/controller.yaml +++ b/packages/apps/kubernetes/templates/ccm-proxmox/controller.yaml @@ -12,7 +12,6 @@ admin, there is nothing left to grant. */ -}} {{- if eq (.Values.substrate | default "kubevirt") "proxmox" }} -{{- if .Values._namespace.etcd }} {{- if not .Values.proxmox.ccm.credentialsSecretName }} {{- fail "proxmox.ccm.credentialsSecretName is required on the proxmox substrate: without a cloud-controller-manager every worker keeps the uninitialized taint and the cluster schedules nothing" }} {{- end }} @@ -161,4 +160,3 @@ spec: secret: secretName: {{ .Release.Name }}-admin-kubeconfig {{- end }} -{{- end }} diff --git a/packages/apps/kubernetes/templates/cluster-autoscaler/deployment.yaml b/packages/apps/kubernetes/templates/cluster-autoscaler/deployment.yaml index f2cb85c66..ef6bbfc4e 100644 --- a/packages/apps/kubernetes/templates/cluster-autoscaler/deployment.yaml +++ b/packages/apps/kubernetes/templates/cluster-autoscaler/deployment.yaml @@ -1,14 +1,3 @@ -{{- /* - Gate the control-plane-side workloads on the parent tenant having an etcd - DataStore. Without it no KamajiControlPlane is ever created, Kamaji never - provisions -admin-kubeconfig, and rendering these Deployments would cause - the wait-for-kubeconfig init to CrashLoopBackOff indefinitely, consuming - the parent HelmRelease install timeout and triggering the very uninstall - remediation cycle this chart is supposed to avoid. Rendering them only - when $etcd is set keeps the HelmRelease Ready while flux retries on its - interval and picks up the DataStore as soon as the Tenant chart finishes. -*/}} -{{- if .Values._namespace.etcd }} --- apiVersion: apps/v1 kind: Deployment @@ -127,4 +116,3 @@ rules: - list - update - watch -{{- end }} diff --git a/packages/apps/kubernetes/templates/cluster.yaml b/packages/apps/kubernetes/templates/cluster.yaml index e7c9118ef..e9c8b08d5 100644 --- a/packages/apps/kubernetes/templates/cluster.yaml +++ b/packages/apps/kubernetes/templates/cluster.yaml @@ -1,4 +1,4 @@ -{{- $etcd := .Values._namespace.etcd }} +{{- $sharedDataStore := include "kubernetes.etcd.sharedDataStore" . }} {{- /* Substrate selects the infrastructure half of the cluster. The control plane is Kamaji either way, so this changes exactly one object — the one Cluster.infrastructureRef points at — plus the two tenant addons @@ -27,17 +27,6 @@ {{- end }} {{- include "kubernetes.assertSubstrateUnchanged" . }} {{- $infraKind := ternary "ProxmoxCluster" "KubevirtCluster" $isProxmox }} -{{- /* - When $etcd is empty, the parent Tenant application has not populated - _namespace.etcd in cozystack-values yet - either the operator forgot to - set etcd: true on an ancestor Tenant, or the Tenant HelmRelease is still - reconciling. Either way, rendering a KamajiControlPlane with an empty - dataStoreName would be rejected by Kamaji's admission webhook and the - HelmRelease would fail to install, triggering remediation. Instead, emit - a single ConfigMap as a user-visible status beacon and skip the rest so - flux marks the HelmRelease Ready and retries its 5m reconcile loop until - the Tenant chart catches up. -*/}} {{- /* Worker node pools (KubevirtMachineTemplate, MachineDeployment, MachineHealthCheck, worker WorkloadMonitor) and the Talos reconcile Job that produces each pool's TalosConfigTemplate are @@ -61,26 +50,6 @@ {{- $podCIDR := "10.243.0.0/16" }} {{- $serviceCIDR := "10.95.0.0/16" }} {{- $ingress := .Values._namespace.ingress }} -{{- if not $etcd }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-awaiting-etcd - namespace: {{ .Release.Namespace }} - labels: - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/name: kubernetes - app.kubernetes.io/instance: {{ .Release.Name }} -data: - status: "awaiting-etcd" - message: | - No DataStore is available for this tenant Kubernetes cluster. The parent - Tenant application has not populated _namespace.etcd. Set spec.etcd: true - on an ancestor Tenant (usually tenant-root) and wait for its HelmRelease - to reconcile - this HelmRelease will pick up the DataStore on its next - 5m reconcile loop and provision the cluster. -{{- else }} {{- /* Worker-pool adoption guard. Worker pools live in per-pool kubernetes-nodes releases; the platform migration adopts each pre-split pool's live objects onto its child release (re-annotating @@ -120,15 +89,7 @@ data: where lookup returns nil) that never prunes live objects: skip there. Discriminate on the adoption annotation, never on mere existence: the MachineDeployment always exists at render time, so an existence-only - guard would deadlock the routine upgrade (see helmreleases/ouroboros.yaml). - - Scope: this guard lives in the etcd-present branch (the else of - `if not $etcd`), so it does NOT run during the awaiting-etcd window, - where the chart renders only the status beacon above. An owned+unpinned - MD is therefore not refused in that transient window. This is a - pre-existing narrow exposure, not introduced by the split (the pre-split - chart also rendered pools only in this same else branch), and it closes - as soon as etcd resolves and a real control-plane upgrade re-renders. */}} + guard would deadlock the routine upgrade (see helmreleases/ouroboros.yaml). */}} {{- if .Release.IsUpgrade }} {{- if lookup "v1" "Namespace" "" .Release.Namespace }} {{- $unadopted := list }} @@ -719,7 +680,7 @@ spec: resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.controlPlane.controllerManager.resourcesPreset .Values.controlPlane.controllerManager.resources $) | nindent 6 }} scheduler: resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.controlPlane.scheduler.resourcesPreset .Values.controlPlane.scheduler.resources $) | nindent 6 }} - dataStoreName: "{{ $etcd }}" + dataStoreName: {{ $sharedDataStore | default (include "kubernetes.etcd.dataStoreName" .) | quote }} {{- with $admissionControllers }} admissionControllers: {{- toYaml . | nindent 4 }} @@ -775,7 +736,11 @@ spec: deployment: podAdditionalMetadata: labels: + {{- if $sharedDataStore }} policy.cozystack.io/allow-to-etcd: "true" + {{- else }} + policy.cozystack.io/allow-to-etcd-cluster: {{ include "kubernetes.etcd.name" . }} + {{- end }} extraContainers: - name: talos-csr-signer image: {{ include "cozy-lib.image" (list (.Files.Get "images/talos-csr-signer.tag" | trim) $) | quote }} @@ -900,4 +865,3 @@ spec: gateway: {{ .Values.proxmox.ipv4Config.gateway | quote }} prefix: {{ .Values.proxmox.ipv4Config.prefix }} {{- end }} -{{- end }} diff --git a/packages/apps/kubernetes/templates/csi-proxmox/controller.yaml b/packages/apps/kubernetes/templates/csi-proxmox/controller.yaml index 7d10abb41..9c05981cb 100644 --- a/packages/apps/kubernetes/templates/csi-proxmox/controller.yaml +++ b/packages/apps/kubernetes/templates/csi-proxmox/controller.yaml @@ -24,7 +24,7 @@ switched off there is nothing for a controller to serve and no token to hold. */ -}} {{- if eq (.Values.substrate | default "kubevirt") "proxmox" }} -{{- if and .Values._namespace.etcd .Values.proxmox.csi.enabled }} +{{- if .Values.proxmox.csi.enabled }} {{- if not .Values.proxmox.csi.credentialsSecretName }} {{- fail "proxmox.csi.credentialsSecretName is required on the proxmox substrate: the CSI controller cannot reach the hypervisor without an API token" }} {{- end }} diff --git a/packages/apps/kubernetes/templates/csi/deploy.yaml b/packages/apps/kubernetes/templates/csi/deploy.yaml index 6c09ff8a8..58df75759 100644 --- a/packages/apps/kubernetes/templates/csi/deploy.yaml +++ b/packages/apps/kubernetes/templates/csi/deploy.yaml @@ -6,7 +6,6 @@ (templates/csi-proxmox/, templates/ccm-proxmox/). Rendering these would leave a controller in the tenant reconciling objects that do not exist. */}} {{- if ne (.Values.substrate | default "kubevirt") "proxmox" }} -{{- if .Values._namespace.etcd }} kind: Deployment apiVersion: apps/v1 metadata: @@ -254,4 +253,3 @@ spec: optional: true name: kubeconfig {{- end }} -{{- end }} diff --git a/packages/apps/kubernetes/templates/delete.yaml b/packages/apps/kubernetes/templates/delete.yaml index 4a0dad2b9..376fd77e0 100644 --- a/packages/apps/kubernetes/templates/delete.yaml +++ b/packages/apps/kubernetes/templates/delete.yaml @@ -93,6 +93,10 @@ spec: # steps that are NOT backstopped — Steps 3, 5, 6 and 7, and the patch # inside Step 1 — end the run under set -e and never reach that # message at all. +{{- if not (include "kubernetes.etcd.sharedDataStore" .) }} + # On a cluster that owns its etcd, Step 8 is not backstopped either, + # and the check before it ends the run on purpose; it says why there. +{{- end }} # # What gets recorded is RESIDUE, never a change of route. A # bounded delete that times out has a remedy right behind it — @@ -302,6 +306,48 @@ spec: kubectl -n {{ .Release.Namespace }} delete tenantcontrolplanes.kamaji.clastix.io {{ .Release.Name }} \ --ignore-not-found=true --wait=true --timeout=120s \ || echo "WARNING: TenantControlPlane {{ .Release.Name }} did not delete within timeout; falling through to Step 4b, which reports whether the datastore-secret finalizer was left behind" >&2 +{{- if not (include "kubernetes.etcd.sharedDataStore" .) }} + + echo "Step 4a: Releasing a TenantControlPlane still held by finalizer.kamaji.clastix.io from this cluster's own DataStore" + # That finalizer drops the tenant's etcd role, prefix and user and + # the datastore-config Secret's finalizer, and Kamaji runs it only + # while the DataStore is Ready and answers. On the cluster's own + # DataStore the role, prefix and user live in the etcd this + # uninstall deletes next, so an etcd that never came up or lost + # quorum would hold the TenantControlPlane forever for nothing. + # Step 4b still clears the Secret's finalizer. A TenantControlPlane + # on a shared DataStore is left to Kamaji: that etcd outlives this + # cluster, and the prefix in it must really go. + # + # The JSON patch tests the finalizer at the index it was read at, + # so a list another controller changed in between is refused + # rather than overwritten. + tcp_state_read=0 + tcp_state=$(kubectl --namespace {{ .Release.Namespace }} get tenantcontrolplanes.kamaji.clastix.io {{ .Release.Name }} \ + --output jsonpath='{.spec.dataStore}{"\n"}{range .metadata.finalizers[*]}{@}{"\n"}{end}' \ + --ignore-not-found 2>/dev/null) || tcp_state_read=1 + tcp_store=$(printf '%s\n' "$tcp_state" | sed --quiet 1p) + if [ "$tcp_state_read" != 0 ] || [ -z "$tcp_state" ]; then + echo " TenantControlPlane {{ .Release.Name }} is gone or unreadable; Step 4b decides which" + elif [ "$tcp_store" != {{ include "kubernetes.etcd.dataStoreName" . | quote }} ]; then + echo " TenantControlPlane {{ .Release.Name }} runs on DataStore $tcp_store, not on its own; leaving it to Kamaji" + else + fin_index=$(printf '%s\n' "$tcp_state" | sed 1d | grep -nxF 'finalizer.kamaji.clastix.io' | cut -d: -f1 | head -n 1) + if [ -z "$fin_index" ]; then + echo " TenantControlPlane {{ .Release.Name }} no longer carries finalizer.kamaji.clastix.io" + else + fin_index=$((fin_index - 1)) + echo " Removing finalizer.kamaji.clastix.io from tenantcontrolplane/{{ .Release.Name }}" + kubectl --namespace {{ .Release.Namespace }} patch tenantcontrolplanes.kamaji.clastix.io {{ .Release.Name }} --type=json \ + --patch "[{\"op\":\"test\",\"path\":\"/metadata/finalizers/$fin_index\",\"value\":\"finalizer.kamaji.clastix.io\"},{\"op\":\"remove\",\"path\":\"/metadata/finalizers/$fin_index\"}]" \ + || backstop "step 4a (TenantControlPlane datastore finalizer)" \ + "failed to remove finalizer.kamaji.clastix.io from tenantcontrolplane/{{ .Release.Name }}; it waits on an etcd this uninstall deletes" + fi + kubectl --namespace {{ .Release.Namespace }} delete tenantcontrolplanes.kamaji.clastix.io {{ .Release.Name }} \ + --ignore-not-found=true --wait=true --timeout=60s \ + || echo "WARNING: TenantControlPlane {{ .Release.Name }} did not delete within 60s of releasing it; Step 4b reports what is left" >&2 + fi +{{- end }} echo "Step 4b: Clearing leftover Kamaji datastore-secret finalizer on {{ .Release.Name }}-datastore-config" # Kamaji creates a per-tenant datastore connection Secret named @@ -432,6 +478,45 @@ spec: kubectl -n {{ .Release.Namespace }} delete jobs.batch \ {{ .Release.Name }}-oidc-bootstrap \ --ignore-not-found=true --wait=false +{{- if not (include "kubernetes.etcd.sharedDataStore" .) }} +{{- $etcdName := include "kubernetes.etcd.name" . }} +{{- $etcdCertificates := list }} +{{- range list "peer-ca" "ca" "server" "peer" "client" }} +{{- $etcdCertificates = append $etcdCertificates (printf "%s-%s" $etcdName .) }} +{{- end }} + + {{- /* Helm deletes this cluster's etcd once the hook exits 0, and a + TenantControlPlane still carrying finalizer.kamaji.clastix.io on + it cannot finish deleting without that etcd. When Step 4a could + not take the finalizer off, or the TenantControlPlane cannot be + read, stop before Step 8 so the uninstall is retried with the + etcd and its PKI still in place. */}} + tcp_hold_read=0 + tcp_hold=$(kubectl --namespace {{ .Release.Namespace }} get tenantcontrolplanes.kamaji.clastix.io {{ .Release.Name }} \ + --output jsonpath='{.spec.dataStore}{"\n"}{range .metadata.finalizers[*]}{@}{"\n"}{end}' \ + --ignore-not-found 2>/dev/null) || tcp_hold_read=1 + if [ "$tcp_hold_read" != 0 ] || { + [ "$(printf '%s\n' "$tcp_hold" | sed --quiet 1p)" = {{ include "kubernetes.etcd.dataStoreName" . | quote }} ] && + printf '%s\n' "$tcp_hold" | sed 1d | grep -qxF 'finalizer.kamaji.clastix.io' + }; then + if [ -n "$residue_from" ]; then + echo "Cleanup incomplete; residue left by: $residue_from" >&2 + fi + echo "TenantControlPlane {{ .Release.Name }} still holds finalizer.kamaji.clastix.io on this cluster's own etcd, or could not be read; failing before Step 8 so that its etcd is not deleted while Kamaji needs it, and the uninstall is retried" >&2 + exit 1 + fi + + echo "Step 8: Deleting the PKI of this cluster's etcd, which outlives the release" + # Same reason and order as Step 7. After Step 4, because the + # TenantControlPlane's DataStore reads its CA and client + # certificate from these Secrets. + kubectl --namespace {{ .Release.Namespace }} delete certificates.cert-manager.io \ + {{ join " " $etcdCertificates }} \ + --ignore-not-found=true --wait=false + kubectl --namespace {{ .Release.Namespace }} delete secrets \ + {{ join "-tls " $etcdCertificates }}-tls \ + --ignore-not-found=true --wait=false +{{- end }} if [ -n "$residue_from" ]; then echo "Cleanup incomplete; residue left by: $residue_from" >&2 @@ -494,6 +579,17 @@ rules: - list - watch - delete +{{- if not (include "kubernetes.etcd.sharedDataStore" .) }} + # Step 4a. + - apiGroups: + - "kamaji.clastix.io" + resources: + - tenantcontrolplanes + resourceNames: + - {{ .Release.Name }} + verbs: + - patch +{{- end }} - apiGroups: - "cdi.kubevirt.io" resources: @@ -559,6 +655,31 @@ rules: verbs: - get - delete +{{- if not (include "kubernetes.etcd.sharedDataStore" .) }} + # Step 8, named for the same reason as Step 7. + - apiGroups: + - "cert-manager.io" + resources: + - certificates + resourceNames: + {{- range list "peer-ca" "ca" "server" "peer" "client" }} + - {{ include "kubernetes.etcd.name" $ }}-{{ . }} + {{- end }} + verbs: + - get + - delete + - apiGroups: + - "" + resources: + - secrets + resourceNames: + {{- range list "peer-ca" "ca" "server" "peer" "client" }} + - {{ include "kubernetes.etcd.name" $ }}-{{ . }}-tls + {{- end }} + verbs: + - get + - delete +{{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding diff --git a/packages/apps/kubernetes/templates/etcd.yaml b/packages/apps/kubernetes/templates/etcd.yaml new file mode 100644 index 000000000..0c0dd69ac --- /dev/null +++ b/packages/apps/kubernetes/templates/etcd.yaml @@ -0,0 +1,103 @@ +{{- if not (include "kubernetes.etcd.sharedDataStore" .) }} +{{- $replicas := int .Values.etcd.replicas }} +{{- if not (has $replicas (list 1 3)) }} +{{- fail (printf "etcd.replicas must be 1 or 3, got %d: an even member count tolerates no more failures than the odd count below it" $replicas) }} +{{- end }} +{{- $name := include "kubernetes.etcd.name" . }} +{{- with lookup "etcd-operator.cozystack.io/v1alpha2" "EtcdCluster" .Release.Namespace $name }} +{{- /* The StorageClass stays the one the etcd was created with, so dropping + to one member keeps the volumes three members were given. A local class + then leaves that member's data on a single node with nothing to recover + it from. */}} +{{- $liveClass := dig "spec" "storage" "storageClassName" "" . }} +{{- $localClass := index ($.Values._cluster | default dict) "etcd-storage-class-local" | default "" }} +{{- $replicatedClass := index ($.Values._cluster | default dict) "etcd-storage-class-replicated" | default "" }} +{{- if and (eq $replicas 1) (gt (int (dig "spec" "replicas" 1 .)) 1) (or (and $localClass (eq $liveClass $localClass)) (and $replicatedClass (ne $liveClass $replicatedClass))) }} +{{- fail (printf "etcd.replicas cannot drop to 1: the etcd of %s keeps the StorageClass %q it was created with, so a single member would hold the only copy of the control-plane state on a volume the platform does not count as replicated. Keep 3 members." $.Release.Name $liveClass) }} +{{- end }} +{{- end }} +{{- $values := dict + "version" (include "cozy-lib.etcd.defaultVersion" .) + "replicas" $replicas + "size" "4Gi" + "storageClass" (include "kubernetes.etcd.storageClass" .) + "resources" (dict "cpu" "1000m" "memory" "512Mi") }} +{{- $etcd := dict "name" $name "values" $values "root" $ }} +{{- $clientLabels := dict "policy.cozystack.io/allow-to-etcd-cluster" $name }} +--- +{{ include "cozy-lib.etcd.cluster" (merge (dict "labels" (dict "cozystack.io/service" "kubernetes-etcd")) $etcd) }} +--- +{{ include "cozy-lib.etcd.certificates" (merge (dict "extraDNSNames" (list (printf "%s-client" $name) (printf "%s-client.%s.svc" $name .Release.Namespace))) $etcd) }} +--- +{{ include "cozy-lib.etcd.workloadMonitor" $etcd }} +--- +{{ include "cozy-lib.etcd.datastore" (dict "name" $name "dataStoreName" (include "kubernetes.etcd.dataStoreName" .) "root" $) }} +--- +{{ include "cozy-lib.etcd.defrag" (dict "name" $name "values" $values "root" $ "podLabels" $clientLabels) }} +{{- if .Capabilities.APIVersions.Has "autoscaling.k8s.io/v1/VerticalPodAutoscaler" }} +--- +{{ include "cozy-lib.etcd.vpa" $etcd }} +{{- end }} +{{- if .Capabilities.APIVersions.Has "operator.victoriametrics.com/v1beta1/VMPodScrape" }} +--- +{{ include "cozy-lib.etcd.podScrape" (dict "name" $name "selector" (dict "app.kubernetes.io/instance" $name)) }} +{{- end }} +{{- if .Capabilities.APIVersions.Has "cilium.io/v2/CiliumNetworkPolicy" }} +{{- /* The tenant namespace admits every pod in it, every pod in an ancestor + tenant's namespace and the world entity. etcd authenticates its clients + by certificate either way; this keeps the tenant's own workloads and + anything off the cluster, such as Proxmox workers, from reaching the + client and peer ports at all. Only the members, this cluster's control + plane, its defrag and backup Jobs and the platform namespaces (Kamaji, + etcd-operator) get through. Deny rules win over the tenant's allow + rules, which an allow rule here could not. The node's own host and + remote-node traffic is not denied. */}} +--- +apiVersion: cilium.io/v2 +kind: CiliumNetworkPolicy +metadata: + name: {{ $name }} + namespace: {{ .Release.Namespace }} +spec: + endpointSelector: + matchLabels: + etcd-operator.cozystack.io/cluster: {{ $name }} + ingressDeny: + - fromEndpoints: + - matchExpressions: + - key: etcd-operator.cozystack.io/cluster + operator: NotIn + values: [{{ $name | quote }}] + - key: policy.cozystack.io/allow-to-etcd-cluster + operator: NotIn + values: [{{ $name | quote }}] + toPorts: + - ports: + - port: "2379" + protocol: TCP + - port: "2380" + protocol: TCP + - fromEndpoints: + - matchExpressions: + - key: k8s:io.kubernetes.pod.namespace + operator: NotIn + values: [{{ .Release.Namespace | quote }}, "kube-system"] + - key: k8s:io.cilium.k8s.namespace.labels.cozystack.io/system + operator: NotIn + values: ["true"] + toPorts: + - ports: + - port: "2379" + protocol: TCP + - port: "2380" + protocol: TCP + - fromEntities: + - world + toPorts: + - ports: + - port: "2379" + protocol: TCP + - port: "2380" + protocol: TCP +{{- end }} +{{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/cert-manager-crds.yaml b/packages/apps/kubernetes/templates/helmreleases/cert-manager-crds.yaml index b27067be8..df6caae17 100644 --- a/packages/apps/kubernetes/templates/helmreleases/cert-manager-crds.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/cert-manager-crds.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.addons.certManager.enabled .Values._namespace.etcd }} +{{- if .Values.addons.certManager.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/cert-manager.yaml b/packages/apps/kubernetes/templates/helmreleases/cert-manager.yaml index 256a59220..94e6c28e0 100644 --- a/packages/apps/kubernetes/templates/helmreleases/cert-manager.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/cert-manager.yaml @@ -8,7 +8,7 @@ cert-manager: {{- end }} {{- end }} -{{- if and .Values.addons.certManager.enabled .Values._namespace.etcd }} +{{- if .Values.addons.certManager.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/cilium.yaml b/packages/apps/kubernetes/templates/helmreleases/cilium.yaml index 07ee92759..9fd234209 100644 --- a/packages/apps/kubernetes/templates/helmreleases/cilium.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/cilium.yaml @@ -29,7 +29,6 @@ cilium: {{- end }} {{- end }} -{{- if .Values._namespace.etcd }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: @@ -97,9 +96,8 @@ that the admission webhook becomes reachable. The mismatch is detectable here rather than in the guest cluster, because this HelmRelease's values are assembled on the management cluster, so the beacon is -emitted next to the release that carries the override. Same mechanism and same -reasoning as the -awaiting-etcd beacon in ../cluster.yaml: a ConfigMap an -operator and an alert can both see. It is a diagnostic for an unsupported +emitted next to the release that carries the override: a ConfigMap an operator +and an alert can both see. It is a diagnostic for an unsupported override, not an alternative compatibility mode. Absence is not a warning: the value is unset in both the override and @@ -138,4 +136,3 @@ data: Clear the override or set cilium.kubeProxyReplacement back to true. Disabling the webhook policy does not make this networking configuration supported. {{- end }} -{{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/coredns.yaml b/packages/apps/kubernetes/templates/helmreleases/coredns.yaml index 03ae8ee91..b9da38a26 100644 --- a/packages/apps/kubernetes/templates/helmreleases/coredns.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/coredns.yaml @@ -4,7 +4,6 @@ coredns: clusterIP: "10.95.0.10" {{- end }} -{{- if .Values._namespace.etcd }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: @@ -35,4 +34,3 @@ spec: retries: -1 values: {{- toYaml (deepCopy .Values.addons.coredns.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultCoreDNSValues" .))) | nindent 4 }} -{{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/csi-proxmox.yaml b/packages/apps/kubernetes/templates/helmreleases/csi-proxmox.yaml index 77efd9c05..ffb08671b 100644 --- a/packages/apps/kubernetes/templates/helmreleases/csi-proxmox.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/csi-proxmox.yaml @@ -13,7 +13,7 @@ different values shape. Splitting them keeps the KubeVirt path rendering byte-for-byte what it rendered before Proxmox existed. */}} {{- if eq (.Values.substrate | default "kubevirt") "proxmox" }} -{{- if and .Values._namespace.etcd .Values.proxmox.csi.enabled }} +{{- if .Values.proxmox.csi.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/csi.yaml b/packages/apps/kubernetes/templates/helmreleases/csi.yaml index c94af9c43..39e1e2e15 100644 --- a/packages/apps/kubernetes/templates/helmreleases/csi.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/csi.yaml @@ -6,7 +6,6 @@ (templates/csi-proxmox/, templates/ccm-proxmox/). Rendering these would leave a controller in the tenant reconciling objects that do not exist. */}} {{- if ne (.Values.substrate | default "kubevirt") "proxmox" }} -{{- if .Values._namespace.etcd }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: @@ -96,4 +95,3 @@ spec: - name: {{ .Release.Name }}-cilium namespace: {{ .Release.Namespace }} {{- end }} -{{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/gateway-api-crds.yaml b/packages/apps/kubernetes/templates/helmreleases/gateway-api-crds.yaml index 65d52b1ca..59c110408 100644 --- a/packages/apps/kubernetes/templates/helmreleases/gateway-api-crds.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/gateway-api-crds.yaml @@ -1,4 +1,4 @@ -{{- if and $.Values.addons.gatewayAPI.enabled $.Values._namespace.etcd }} +{{- if $.Values.addons.gatewayAPI.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/gpu-operator.yaml b/packages/apps/kubernetes/templates/helmreleases/gpu-operator.yaml index efbb1d480..6fa71353a 100644 --- a/packages/apps/kubernetes/templates/helmreleases/gpu-operator.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/gpu-operator.yaml @@ -65,7 +65,7 @@ gpu-operator: value: cdi.k8s.io/ {{- end }} -{{- if and .Values.addons.gpuOperator.enabled .Values._namespace.etcd }} +{{- if .Values.addons.gpuOperator.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/hami.yaml b/packages/apps/kubernetes/templates/helmreleases/hami.yaml index 635f061f8..aabbdf3f0 100644 --- a/packages/apps/kubernetes/templates/helmreleases/hami.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/hami.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.addons.hami.enabled .Values._namespace.etcd }} +{{- if .Values.addons.hami.enabled }} {{- if not .Values.addons.gpuOperator.enabled }} {{- fail "addons.hami requires addons.gpuOperator to be enabled" }} {{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/ingress-nginx.yaml b/packages/apps/kubernetes/templates/helmreleases/ingress-nginx.yaml index 52c178d8f..16aa2d163 100644 --- a/packages/apps/kubernetes/templates/helmreleases/ingress-nginx.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/ingress-nginx.yaml @@ -20,7 +20,7 @@ ingress-nginx: node-role.kubernetes.io/ingress-nginx: "" {{- end }} -{{- if and .Values.addons.ingressNginx.enabled .Values._namespace.etcd }} +{{- if .Values.addons.ingressNginx.enabled }} {{- /* The ingress-nginx controller DaemonSet pins itself to nodes labelled node-role.kubernetes.io/ingress-nginx (see cozystack.defaultIngressValues nodeSelector). That label is produced by a KubernetesNodes pool with diff --git a/packages/apps/kubernetes/templates/helmreleases/metrics-server.yaml b/packages/apps/kubernetes/templates/helmreleases/metrics-server.yaml index 50e7d695d..42186782f 100644 --- a/packages/apps/kubernetes/templates/helmreleases/metrics-server.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/metrics-server.yaml @@ -1,4 +1,3 @@ -{{- if .Values._namespace.etcd }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: @@ -33,4 +32,3 @@ spec: namespace: {{ .Release.Namespace }} - name: {{ .Release.Name }}-prometheus-operator-crds namespace: {{ .Release.Namespace }} -{{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml b/packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml index 1268010bd..f51ef297f 100644 --- a/packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml @@ -67,7 +67,7 @@ fluent-bit: Add cluster {{ .Release.Name }} {{ end }} -{{- if and .Values.addons.monitoringAgents.enabled .Values._namespace.etcd }} +{{- if .Values.addons.monitoringAgents.enabled }} {{- $values := deepCopy .Values.addons.monitoringAgents.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultMonitoringAgentsValues" .)) }} {{- /* The monitoring-agents chart refuses the same combination by rendering diff --git a/packages/apps/kubernetes/templates/helmreleases/ouroboros.yaml b/packages/apps/kubernetes/templates/helmreleases/ouroboros.yaml index ecc8c8aae..a94b0ad1f 100644 --- a/packages/apps/kubernetes/templates/helmreleases/ouroboros.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/ouroboros.yaml @@ -110,7 +110,7 @@ ouroboros: That path is documented in cozystack/website docs/networking/hairpin-proxy-protocol under "Tenant cleanup recipe (fallback)". */}} -{{- if and .Values.addons.ouroboros.enabled .Values._namespace.etcd }} +{{- if .Values.addons.ouroboros.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/prometheus-operator-crds.yaml b/packages/apps/kubernetes/templates/helmreleases/prometheus-operator-crds.yaml index 3bb0afc7c..bd18be4fd 100644 --- a/packages/apps/kubernetes/templates/helmreleases/prometheus-operator-crds.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/prometheus-operator-crds.yaml @@ -1,4 +1,3 @@ -{{- if .Values._namespace.etcd }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: @@ -27,4 +26,3 @@ spec: upgrade: remediation: retries: -1 -{{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/velero.yaml b/packages/apps/kubernetes/templates/helmreleases/velero.yaml index 202e89b6f..86a6a224f 100644 --- a/packages/apps/kubernetes/templates/helmreleases/velero.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/velero.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.addons.velero.enabled .Values._namespace.etcd }} +{{- if .Values.addons.velero.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml b/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml index 630e58e16..742bfe36c 100644 --- a/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.addons.monitoringAgents.enabled .Values._namespace.etcd }} +{{- if .Values.addons.monitoringAgents.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml b/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml index 58eeba315..3735f392f 100644 --- a/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml @@ -24,7 +24,7 @@ vertical-pod-autoscaler: memory: 1600Mi {{- end }} -{{- if and .Values.addons.monitoringAgents.enabled .Values._namespace.etcd }} +{{- if .Values.addons.monitoringAgents.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/victoria-metrics-operator.yaml b/packages/apps/kubernetes/templates/helmreleases/victoria-metrics-operator.yaml index 476e470d0..e9ffd2f4f 100644 --- a/packages/apps/kubernetes/templates/helmreleases/victoria-metrics-operator.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/victoria-metrics-operator.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.addons.monitoringAgents.enabled .Values._namespace.etcd }} +{{- if .Values.addons.monitoringAgents.enabled }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/volumesnapshot-crd.yaml b/packages/apps/kubernetes/templates/helmreleases/volumesnapshot-crd.yaml index 9848c7d45..7239afda4 100644 --- a/packages/apps/kubernetes/templates/helmreleases/volumesnapshot-crd.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/volumesnapshot-crd.yaml @@ -1,4 +1,3 @@ -{{- if .Values._namespace.etcd }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: @@ -28,4 +27,3 @@ spec: upgrade: remediation: retries: -1 -{{- end }} diff --git a/packages/apps/kubernetes/templates/ingress.yaml b/packages/apps/kubernetes/templates/ingress.yaml index 9b88a7fce..7065f7d5e 100644 --- a/packages/apps/kubernetes/templates/ingress.yaml +++ b/packages/apps/kubernetes/templates/ingress.yaml @@ -1,8 +1,5 @@ {{- $ingress := .Values._namespace.ingress }} -{{- /* The _namespace.etcd gate mirrors the ingress-nginx addon HelmRelease: - on an etcd-less tenant the chart collapses to the awaiting-etcd beacon, - so no addon controller exists and the Service would select nothing. */}} -{{- if and .Values.addons.ingressNginx.enabled .Values._namespace.etcd (eq .Values.addons.ingressNginx.exposeMethod "Proxied") }} +{{- if and .Values.addons.ingressNginx.enabled (eq .Values.addons.ingressNginx.exposeMethod "Proxied") }} {{- if and .Values.addons.ingressNginx.hosts $ingress }} --- apiVersion: networking.k8s.io/v1 @@ -47,16 +44,14 @@ spec: {{- end }} {{- end }} --- -# The proxy Service is created whenever the addon is enabled on an etcd-backed -# tenant with exposeMethod Proxied (independent of `hosts`) so that external +# The proxy Service is created whenever the addon is enabled with exposeMethod +# Proxied (independent of `hosts`) so that external # consumers — e.g. a ComputePlane app's per-app management Ingress — can route to # the tenant cluster's ingress-nginx without the tenant module having to know -# every app host in advance. Both gates match the addon HelmRelease this Service -# fronts: exposeMethod defaults to Proxied while the addon defaults to off, so +# every app host in advance. The enabled gate matches the addon HelmRelease this +# Service fronts: exposeMethod defaults to Proxied while the addon defaults to off, so # gating on exposeMethod alone would emit a selector-less Service on every cluster -# that runs no ingress-nginx at all; and on an etcd-less tenant the chart collapses -# to the awaiting-etcd beacon, so the Service would select a controller that never -# renders. +# that runs no ingress-nginx at all. apiVersion: v1 kind: Service metadata: diff --git a/packages/apps/kubernetes/templates/kccm/manager.yaml b/packages/apps/kubernetes/templates/kccm/manager.yaml index cf78ff25d..c472507cf 100644 --- a/packages/apps/kubernetes/templates/kccm/manager.yaml +++ b/packages/apps/kubernetes/templates/kccm/manager.yaml @@ -6,7 +6,6 @@ (templates/csi-proxmox/, templates/ccm-proxmox/). Rendering these would leave a controller in the tenant reconciling objects that do not exist. */}} {{- if ne (.Values.substrate | default "kubevirt") "proxmox" }} -{{- if .Values._namespace.etcd }} apiVersion: apps/v1 kind: Deployment metadata: @@ -70,4 +69,3 @@ spec: name: kubeconfig serviceAccountName: {{ .Release.Name }}-kccm {{- end }} -{{- end }} diff --git a/packages/apps/kubernetes/tests/admin_kubeconfig_wait_test.yaml b/packages/apps/kubernetes/tests/admin_kubeconfig_wait_test.yaml index 2f492330d..4218f7785 100644 --- a/packages/apps/kubernetes/tests/admin_kubeconfig_wait_test.yaml +++ b/packages/apps/kubernetes/tests/admin_kubeconfig_wait_test.yaml @@ -134,7 +134,7 @@ tests: path: spec.template.spec.initContainers[0].image pattern: '^registry\.airgap\.example\.test/docker\.io/library/busybox:[^@]+@sha256:[0-9a-f]{64}$' - - it: cluster.yaml renders and wires dataStoreName when tenant has etcd + - it: cluster.yaml wires dataStoreName to the cluster's own DataStore template: templates/cluster.yaml documentSelector: path: kind @@ -142,30 +142,17 @@ tests: asserts: - equal: path: spec.dataStoreName - value: tenant-root + value: tenant-root.test - - it: cluster.yaml skips Cluster resources when tenant has no etcd DataStore - # Must NOT fail rendering - the parent Tenant chart populates - # _namespace.etcd asynchronously, so rendering failures here would cause - # flux install remediation on every cold bootstrap. Instead, emit only a - # ConfigMap status beacon so the HelmRelease reports Ready while flux - # retries on its interval until the DataStore appears. + - it: cluster.yaml renders the control plane when the tenant publishes no etcd template: templates/cluster.yaml set: _namespace: etcd: "" - monitoring: "" - ingress: "" - seaweedfs: "" - host: "" + documentSelector: + path: kind + value: KamajiControlPlane asserts: - - hasDocuments: - count: 1 - - isKind: - of: ConfigMap - equal: - path: metadata.name - value: test-awaiting-etcd - - equal: - path: data.status - value: awaiting-etcd + path: spec.dataStoreName + value: tenant-root.test diff --git a/packages/apps/kubernetes/tests/cilium_kube_proxy_replacement_test.yaml b/packages/apps/kubernetes/tests/cilium_kube_proxy_replacement_test.yaml index 839977a25..8fd513acc 100644 --- a/packages/apps/kubernetes/tests/cilium_kube_proxy_replacement_test.yaml +++ b/packages/apps/kubernetes/tests/cilium_kube_proxy_replacement_test.yaml @@ -7,9 +7,8 @@ suite: tenant cilium kube-proxy-replacement override beacon # the override does not imply that the webhook becomes reachable. # # The override is assembled on the MANAGEMENT cluster, in this chart, which is -# why the mismatch is detectable here at all. Same beacon mechanism as the -# -awaiting-etcd ConfigMap in templates/cluster.yaml: something an operator and -# an alert can both see. It diagnoses an unsupported override rather than +# why the mismatch is detectable here at all: a ConfigMap is something an +# operator and an alert can both see. It diagnoses an unsupported override rather than # defining an alternative compatibility mode. templates: - templates/helmreleases/cilium.yaml diff --git a/packages/apps/kubernetes/tests/delete_hook_test.yaml b/packages/apps/kubernetes/tests/delete_hook_test.yaml index cc6ba341d..bfa4c6f94 100644 --- a/packages/apps/kubernetes/tests/delete_hook_test.yaml +++ b/packages/apps/kubernetes/tests/delete_hook_test.yaml @@ -134,10 +134,11 @@ tests: # failure it is written to prevent would take the assertion with it. # Matching the entire rule pins the verb set in both directions and names # the resource when it fails; lengthEqual is what closes the remaining - # hole, a tenth rule appended past everything asserted here. + # hole, a thirteenth rule appended past everything asserted here. This + # render owns its etcd, so Steps 4a and 8 add three rules of their own. - lengthEqual: path: rules - count: 9 + count: 12 - contains: path: rules content: @@ -185,7 +186,7 @@ tests: pattern: 'delete secrets \\\n\s+test-k8s-talos-ca test-k8s-talos-tls-cert(?:[^\n]*\\\n)*[^\n]*--wait=false' - notMatchRegex: path: spec.template.spec.containers[0].command[2] - pattern: 'delete secrets \\\n\s+test-k8s-talos-ca[\s\S]*delete certificates\.cert-manager\.io' + pattern: 'delete secrets \\\n\s+test-k8s-talos-ca[\s\S]*delete certificates\.cert-manager\.io \\\n\s+test-k8s-talos-ca' - it: deletes the orphaned OIDC bootstrap Job documentSelector: diff --git a/packages/apps/kubernetes/tests/etcd_test.yaml b/packages/apps/kubernetes/tests/etcd_test.yaml new file mode 100644 index 000000000..c813f7e21 --- /dev/null +++ b/packages/apps/kubernetes/tests/etcd_test.yaml @@ -0,0 +1,534 @@ +suite: each cluster owns its etcd unless it already runs on a shared one + +release: + name: kubernetes-alpha + namespace: tenant-test + +values: + - values-ci.yaml + +templates: + - templates/cluster.yaml + - templates/etcd.yaml + - templates/delete.yaml + +# helm template has no cluster, so lookup returns nothing and every render +# below is a new cluster unless a test hands the provider a live object. +kubernetesProvider: &provider + scheme: &scheme + "controlplane.cluster.x-k8s.io/v1alpha1/KamajiControlPlane": + gvr: + group: "controlplane.cluster.x-k8s.io" + version: "v1alpha1" + resource: "kamajicontrolplanes" + namespaced: true + "etcd-operator.cozystack.io/v1alpha2/EtcdCluster": + gvr: + group: "etcd-operator.cozystack.io" + version: "v1alpha2" + resource: "etcdclusters" + namespaced: true + +tests: + - it: renders an EtcdCluster named after the release, with three members by default + template: templates/etcd.yaml + documentSelector: + path: kind + value: EtcdCluster + asserts: + - equal: + path: metadata.name + value: kubernetes-alpha-etcd + - equal: + path: spec.replicas + value: 3 + - equal: + path: spec.tls.client.serverSecretRef.name + value: kubernetes-alpha-etcd-server-tls + - notExists: + path: spec.storage.storageClassName + + - it: renders a DataStore pointing at that EtcdCluster + template: templates/etcd.yaml + documentSelector: + path: kind + value: DataStore + asserts: + - equal: + path: metadata.name + value: tenant-test.kubernetes-alpha + - equal: + path: spec.endpoints[0] + value: kubernetes-alpha-etcd.tenant-test.svc:2379 + - equal: + path: spec.tlsConfig.clientCertificate.certificate.secretReference.name + value: kubernetes-alpha-etcd-client-tls + + - it: points the control plane at its own DataStore and labels it as an etcd client + template: templates/cluster.yaml + documentSelector: + path: kind + value: KamajiControlPlane + asserts: + - equal: + path: spec.dataStoreName + value: tenant-test.kubernetes-alpha + - equal: + path: spec.deployment.podAdditionalMetadata.labels["policy.cozystack.io/allow-to-etcd-cluster"] + value: kubernetes-alpha-etcd + + - it: ignores a tenant etcd published through _namespace.etcd for a new cluster + template: templates/cluster.yaml + set: + _namespace: + etcd: tenant-root + documentSelector: + path: kind + value: KamajiControlPlane + asserts: + - equal: + path: spec.dataStoreName + value: tenant-test.kubernetes-alpha + + - it: gives a second cluster in the same namespace its own names + template: templates/etcd.yaml + release: + name: kubernetes-beta + namespace: tenant-test + documentSelector: + path: kind + value: DataStore + asserts: + - equal: + path: metadata.name + value: tenant-test.kubernetes-beta + - equal: + path: spec.endpoints[0] + value: kubernetes-beta-etcd.tenant-test.svc:2379 + + - it: keeps the DataStore name inside 63 characters, the same on every render + template: templates/etcd.yaml + release: + name: kubernetes-a-name-of-exactly-thirty-two-chars + namespace: tenant-averyverylongtenantname-andanotherlongchild + documentSelector: + path: kind + value: DataStore + asserts: + - equal: + path: metadata.name + value: tenant-averyverylongtenantname-andanotherlongchild.kub-8fda7e7c + - matchRegex: + path: metadata.name + pattern: '^.{1,63}$' + + - it: runs a single member on the replicated class and three on the local class + template: templates/etcd.yaml + set: + etcd: + replicas: 1 + _cluster: + etcd-storage-class-local: local + etcd-storage-class-replicated: replicated + documentSelector: + path: kind + value: EtcdCluster + asserts: + - equal: + path: spec.replicas + value: 1 + - equal: + path: spec.storage.storageClassName + value: replicated + + - it: picks the local class for three members + template: templates/etcd.yaml + set: + _cluster: + etcd-storage-class-local: local + etcd-storage-class-replicated: replicated + documentSelector: + path: kind + value: EtcdCluster + asserts: + - equal: + path: spec.storage.storageClassName + value: local + + # storageClassName is immutable on an EtcdCluster, so scaling 1 -> 3 must keep + # the class the cluster was created with rather than re-derive it. + - it: keeps the live StorageClass when the replica count changes + template: templates/etcd.yaml + set: + etcd: + replicas: 3 + _cluster: + etcd-storage-class-local: local + etcd-storage-class-replicated: replicated + kubernetesProvider: + scheme: *scheme + objects: + - apiVersion: etcd-operator.cozystack.io/v1alpha2 + kind: EtcdCluster + metadata: + name: kubernetes-alpha-etcd + namespace: tenant-test + spec: + storage: + storageClassName: replicated + documentSelector: + path: kind + value: EtcdCluster + asserts: + - equal: + path: spec.storage.storageClassName + value: replicated + + - it: refuses an even member count + template: templates/etcd.yaml + set: + etcd: + replicas: 2 + asserts: + - failedTemplate: + errorMessage: "etcd.replicas must be 1 or 3, got 2: an even member count tolerates no more failures than the odd count below it" + + - it: renders the etcd network policy only where Cilium serves the API + template: templates/etcd.yaml + capabilities: + apiVersions: + - cilium.io/v2/CiliumNetworkPolicy + documentSelector: + path: kind + value: CiliumNetworkPolicy + asserts: + - equal: + path: spec.endpointSelector.matchLabels["etcd-operator.cozystack.io/cluster"] + value: kubernetes-alpha-etcd + - contains: + path: spec.ingressDeny[0].fromEndpoints[0].matchExpressions + content: + key: policy.cozystack.io/allow-to-etcd-cluster + operator: NotIn + values: ["kubernetes-alpha-etcd"] + + - contains: + path: spec.ingressDeny[0].fromEndpoints[0].matchExpressions + content: + key: etcd-operator.cozystack.io/cluster + operator: NotIn + values: ["kubernetes-alpha-etcd"] + - equal: + path: spec.ingressDeny[1].fromEndpoints[0].matchExpressions + value: + - key: k8s:io.kubernetes.pod.namespace + operator: NotIn + values: [tenant-test, kube-system] + - key: k8s:io.cilium.k8s.namespace.labels.cozystack.io/system + operator: NotIn + values: ["true"] + + - it: denies the etcd ports to sources outside the cluster + template: templates/etcd.yaml + capabilities: + apiVersions: + - cilium.io/v2/CiliumNetworkPolicy + documentSelector: + path: kind + value: CiliumNetworkPolicy + asserts: + - equal: + path: spec.ingressDeny[2].fromEntities + value: [world] + + - it: gives the defrag job the quota of this cluster's own etcd + template: templates/etcd.yaml + documentSelector: + path: kind + value: CronJob + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].args + content: --compaction=false + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].args + content: --etcd-storage-quota-bytes=4080218931 + + - it: pulls the maintenance image from the configured registry + template: templates/etcd.yaml + set: + _cluster.images-registry: mirror.example.org/platform/ + documentSelector: + path: kind + value: CronJob + asserts: + - matchRegex: + path: spec.jobTemplate.spec.template.spec.containers[0].image + pattern: '^mirror\.example\.org/platform/ghcr\.io/ahrtr/etcd-defrag:v[0-9.]+@sha256:[a-f0-9]{64}$' + - equal: + path: spec.jobTemplate.spec.template.metadata.labels["policy.cozystack.io/allow-to-etcd-cluster"] + value: kubernetes-alpha-etcd + + # The longest name the app allows. The apiserver refuses a CronJob name over + # 52 characters, and kubernetes--etcd-defrag runs to 55. + - it: keeps the defrag CronJob name inside 52 characters for the longest cluster name + template: templates/etcd.yaml + release: + name: kubernetes-abcdefghijklmnopqrstuvwxyz012345 + namespace: tenant-test + documentSelector: + path: kind + value: CronJob + asserts: + - equal: + path: metadata.name + value: kubernetes-abcdefghijklmnopqrstuvwxyz012345-26c42cc8 + + - it: refuses to drop to one member while the etcd sits on the local class + template: templates/etcd.yaml + set: + etcd: + replicas: 1 + _cluster: + etcd-storage-class-local: local + etcd-storage-class-replicated: replicated + kubernetesProvider: + scheme: *scheme + objects: + - apiVersion: etcd-operator.cozystack.io/v1alpha2 + kind: EtcdCluster + metadata: + name: kubernetes-alpha-etcd + namespace: tenant-test + spec: + replicas: 3.0 + storage: + storageClassName: local + asserts: + - failedTemplate: + errorMessage: 'etcd.replicas cannot drop to 1: the etcd of kubernetes-alpha keeps the StorageClass "local" it was created with, so a single member would hold the only copy of the control-plane state on a volume the platform does not count as replicated. Keep 3 members.' + + - it: refuses to drop to one member off the replicated class when only that class is named + template: templates/etcd.yaml + set: + etcd: + replicas: 1 + _cluster: + etcd-storage-class-replicated: replicated + kubernetesProvider: + scheme: *scheme + objects: + - apiVersion: etcd-operator.cozystack.io/v1alpha2 + kind: EtcdCluster + metadata: + name: kubernetes-alpha-etcd + namespace: tenant-test + spec: + replicas: 3.0 + storage: + storageClassName: some-default + asserts: + - failedTemplate: {} + + # A single member created on the namespace default before the platform named + # a replicated class is already in that shape; refusing it would only block + # its upgrades. + - it: keeps rendering an etcd that was created with one member + template: templates/etcd.yaml + set: + etcd: + replicas: 1 + _cluster: + etcd-storage-class-local: local + etcd-storage-class-replicated: replicated + kubernetesProvider: + scheme: *scheme + objects: + - apiVersion: etcd-operator.cozystack.io/v1alpha2 + kind: EtcdCluster + metadata: + name: kubernetes-alpha-etcd + namespace: tenant-test + spec: + replicas: 1.0 + storage: + storageClassName: local + documentSelector: + path: kind + value: EtcdCluster + asserts: + - equal: + path: spec.replicas + value: 1 + + - it: drops to one member on the replicated class + template: templates/etcd.yaml + set: + etcd: + replicas: 1 + _cluster: + etcd-storage-class-local: local + etcd-storage-class-replicated: replicated + kubernetesProvider: + scheme: *scheme + objects: + - apiVersion: etcd-operator.cozystack.io/v1alpha2 + kind: EtcdCluster + metadata: + name: kubernetes-alpha-etcd + namespace: tenant-test + spec: + replicas: 3.0 + storage: + storageClassName: replicated + documentSelector: + path: kind + value: EtcdCluster + asserts: + - equal: + path: spec.replicas + value: 1 + + - it: does not admit a new cluster to the tenant's shared etcd + template: templates/cluster.yaml + documentSelector: + path: kind + value: KamajiControlPlane + asserts: + - notExists: + path: spec.deployment.podAdditionalMetadata.labels["policy.cozystack.io/allow-to-etcd"] + + - it: lets the pre-delete hook release its TenantControlPlane and delete its etcd PKI + template: templates/delete.yaml + documentSelector: + path: kind + value: Role + asserts: + - contains: + path: rules + content: + apiGroups: ["kamaji.clastix.io"] + resources: ["tenantcontrolplanes"] + resourceNames: ["kubernetes-alpha"] + verbs: ["patch"] + - contains: + path: rules + content: + apiGroups: [""] + resources: ["secrets"] + resourceNames: + - kubernetes-alpha-etcd-peer-ca-tls + - kubernetes-alpha-etcd-ca-tls + - kubernetes-alpha-etcd-server-tls + - kubernetes-alpha-etcd-peer-tls + - kubernetes-alpha-etcd-client-tls + verbs: ["get", "delete"] + - contains: + path: rules + content: + apiGroups: ["cert-manager.io"] + resources: ["certificates"] + resourceNames: + - kubernetes-alpha-etcd-peer-ca + - kubernetes-alpha-etcd-ca + - kubernetes-alpha-etcd-server + - kubernetes-alpha-etcd-peer + - kubernetes-alpha-etcd-client + verbs: ["get", "delete"] + + - it: keeps an existing cluster on the shared DataStore it runs on + template: templates/cluster.yaml + kubernetesProvider: &shared + scheme: *scheme + objects: + - apiVersion: controlplane.cluster.x-k8s.io/v1alpha1 + kind: KamajiControlPlane + metadata: + name: kubernetes-alpha + namespace: tenant-test + spec: + dataStoreName: tenant-root + documentSelector: + path: kind + value: KamajiControlPlane + asserts: + - equal: + path: spec.dataStoreName + value: tenant-root + - notExists: + path: spec.deployment.podAdditionalMetadata.labels["policy.cozystack.io/allow-to-etcd-cluster"] + + # A tenant switching its own etcd on changes _namespace.etcd for every cluster + # below it; following that would start a datastore migration on upgrade. + - it: does not follow a changed _namespace.etcd on an existing cluster + template: templates/cluster.yaml + set: + _namespace: + etcd: tenant-test + kubernetesProvider: *shared + documentSelector: + path: kind + value: KamajiControlPlane + asserts: + - equal: + path: spec.dataStoreName + value: tenant-root + + - it: renders no etcd of its own for a cluster on a shared DataStore + template: templates/etcd.yaml + kubernetesProvider: *shared + asserts: + - hasDocuments: + count: 0 + + - it: still admits a cluster on a shared DataStore to the tenant's etcd + template: templates/cluster.yaml + kubernetesProvider: *shared + documentSelector: + path: kind + value: KamajiControlPlane + asserts: + - equal: + path: spec.deployment.podAdditionalMetadata.labels["policy.cozystack.io/allow-to-etcd"] + value: "true" + + - it: gives the pre-delete hook nothing to remove from a shared etcd + template: templates/delete.yaml + kubernetesProvider: *shared + asserts: + - notContains: + path: rules + content: + apiGroups: ["kamaji.clastix.io"] + resources: ["tenantcontrolplanes"] + resourceNames: ["kubernetes-alpha"] + verbs: ["patch"] + documentSelector: + path: kind + value: Role + - notMatchRegex: + path: spec.template.spec.containers[0].command[2] + pattern: 'Step 8' + documentSelector: + path: kind + value: Job + + - it: stays on its own DataStore once the live control plane uses it + template: templates/cluster.yaml + kubernetesProvider: + scheme: *scheme + objects: + - apiVersion: controlplane.cluster.x-k8s.io/v1alpha1 + kind: KamajiControlPlane + metadata: + name: kubernetes-alpha + namespace: tenant-test + spec: + dataStoreName: tenant-test.kubernetes-alpha + documentSelector: + path: kind + value: KamajiControlPlane + asserts: + - equal: + path: spec.dataStoreName + value: tenant-test.kubernetes-alpha diff --git a/packages/apps/kubernetes/tests/host_guard_test.yaml b/packages/apps/kubernetes/tests/host_guard_test.yaml index 49e83e83a..f3cd42167 100644 --- a/packages/apps/kubernetes/tests/host_guard_test.yaml +++ b/packages/apps/kubernetes/tests/host_guard_test.yaml @@ -7,14 +7,11 @@ release: namespace: tenant-test # cluster.yaml advertises the apiserver endpoint as .<_namespace.host> -# only inside the KamajiControlPlane, which is emitted when the tenant has an -# etcd DataStore. cozy-lib.ns-host-required guards that one hostname, so an empty -# apex fails there. The no-etcd path emits only a ConfigMap beacon and never -# composes the hostname, so it must keep rendering even with an empty apex (the -# parent Tenant chart populates _namespace.etcd asynchronously). +# inside the KamajiControlPlane. cozy-lib.ns-host-required guards that one +# hostname, so an empty apex fails there. tests: - - it: fails when the tenant has etcd but the apex is empty and no host override + - it: fails when the apex is empty and no host override set: _namespace: etcd: tenant-test @@ -26,16 +23,3 @@ tests: - failedTemplate: errorMessage: "the tenant apex (_namespace.host) is empty and this app sets no host override, so its ingress hostname would be malformed. Set tenant.spec.host on this tenant, inherit it from a parent that has host set, or set this app's host value." - - it: still renders the awaiting-etcd beacon when the apex is empty and there is no etcd - set: - _namespace: - etcd: "" - host: "" - _cluster: - cluster-domain: cozy.local - version: "v1.35" - asserts: - - hasDocuments: - count: 1 - - isKind: - of: ConfigMap diff --git a/packages/apps/kubernetes/tests/ingress_proxied_gate_test.yaml b/packages/apps/kubernetes/tests/ingress_proxied_gate_test.yaml index 75e9349a8..b24d80f9d 100644 --- a/packages/apps/kubernetes/tests/ingress_proxied_gate_test.yaml +++ b/packages/apps/kubernetes/tests/ingress_proxied_gate_test.yaml @@ -62,24 +62,6 @@ tests: - hasDocuments: count: 0 - # The addon HelmRelease itself gates on _namespace.etcd (the etcd-less - # render collapses to the awaiting-etcd beacon), so the Service must too — - # otherwise an etcd-less tenant with the addon pinned on (ComputePlane) - # gets the selector-less Service by another route. - - it: renders nothing on an etcd-less tenant even with the addon enabled - set: - _namespace: - ingress: tenant-root - etcd: "" - addons: - ingressNginx: - enabled: true - exposeMethod: Proxied - hosts: [] - asserts: - - hasDocuments: - count: 0 - # An empty _namespace.ingress means no ingress-nginx serves this tenant, and # the API rejects the ingressClassName "" the Ingress would carry. - it: renders the Service but no Ingress when the tenant has no ingress diff --git a/packages/apps/kubernetes/tests/ouroboros_test.yaml b/packages/apps/kubernetes/tests/ouroboros_test.yaml index 5a67f444f..53a2dcb40 100644 --- a/packages/apps/kubernetes/tests/ouroboros_test.yaml +++ b/packages/apps/kubernetes/tests/ouroboros_test.yaml @@ -459,23 +459,3 @@ tests: name: RELEASE-NAME-gateway-api-crds namespace: NAMESPACE - - it: should not render when _namespace.etcd is empty (addon HelmReleases gate on the tenant root namespace presence) - set: - _namespace: - etcd: "" - ingress: "" - seaweedfs: "" - host: "" - monitoring: "" - addons: - ouroboros: - enabled: true - valuesOverride: {} - ingressNginx: - enabled: true - hosts: [] - valuesOverride: {} - asserts: - - hasDocuments: - count: 0 - diff --git a/packages/apps/kubernetes/tests/values-ci-no-etcd.yaml b/packages/apps/kubernetes/tests/values-ci-no-etcd.yaml deleted file mode 100644 index cacacce33..000000000 --- a/packages/apps/kubernetes/tests/values-ci-no-etcd.yaml +++ /dev/null @@ -1,8 +0,0 @@ -_namespace: - etcd: "" - monitoring: "" - ingress: "" - seaweedfs: "" - host: "" -_cluster: - cluster-domain: cozy.local diff --git a/packages/apps/kubernetes/values.schema.json b/packages/apps/kubernetes/values.schema.json index 0bff27e4a..6f9a502b4 100644 --- a/packages/apps/kubernetes/values.schema.json +++ b/packages/apps/kubernetes/values.schema.json @@ -953,6 +953,23 @@ } } }, + "etcd": { + "description": "Dedicated etcd for this cluster's control plane, rendered with the cluster and deleted with it. Clusters that already run on their tenant's shared etcd keep it, and this section does not apply to them.", + "type": "object", + "default": {}, + "required": [ + "replicas" + ], + "properties": { + "replicas": { + "description": "Number of etcd members: `3` keeps quorum through the loss of one member, `1` runs a single member with no failover. Only `1` and `3` are accepted. The StorageClass is picked by the platform for each of the two shapes and fixed when the etcd is first created, so changing the count later keeps the class it started with. For that reason going from 3 members to 1 is refused when the etcd is on the class the platform names for 3 members, or off the class it names for 1: a single member would then hold the only copy of the control-plane state on storage that does not replicate it.", + "type": "integer", + "default": 3, + "maximum": 3, + "minimum": 1 + } + } + }, "oidc": { "description": "OIDC authentication and per-user RBAC for the tenant kube-apiserver. See https://cozystack.io/docs/v1.6/kubernetes/oidc-authentication/ for the operator guide.", "type": "object", diff --git a/packages/apps/kubernetes/values.yaml b/packages/apps/kubernetes/values.yaml index ac966ab9e..6aecc36d9 100644 --- a/packages/apps/kubernetes/values.yaml +++ b/packages/apps/kubernetes/values.yaml @@ -342,6 +342,15 @@ controlPlane: kubelet: preferredAddressTypes: [] +## @typedef {struct} Etcd - etcd that holds this cluster's control-plane state. +## @field {int} replicas=3 - Number of etcd members: `3` keeps quorum through the loss of one member, `1` runs a single member with no failover. Only `1` and `3` are accepted. The StorageClass is picked by the platform for each of the two shapes and fixed when the etcd is first created, so changing the count later keeps the class it started with. For that reason going from 3 members to 1 is refused when the etcd is on the class the platform names for 3 members, or off the class it names for 1: a single member would then hold the only copy of the control-plane state on storage that does not replicate it. +## @minimum 1 +## @maximum 3 + +## @param {Etcd} etcd - Dedicated etcd for this cluster's control plane, rendered with the cluster and deleted with it. Clusters that already run on their tenant's shared etcd keep it, and this section does not apply to them. +etcd: + replicas: 3 + ## ## @section OIDC ## diff --git a/packages/core/platform/sources/kubernetes-application.yaml b/packages/core/platform/sources/kubernetes-application.yaml index acd81f292..d9775ffb0 100644 --- a/packages/core/platform/sources/kubernetes-application.yaml +++ b/packages/core/platform/sources/kubernetes-application.yaml @@ -18,6 +18,9 @@ spec: - cozystack.capi-provider-core - cozystack.capi-provider-cp-kamaji - cozystack.capi-provider-infra-kubevirt + # Every cluster renders its own EtcdCluster, so the operator serving + # etcd-operator.cozystack.io/v1alpha2 has to exist before one is created. + - cozystack.etcd-operator # cozystack-engine ships the ApplicationDefinition CRD rendered by the *-rd component below. - cozystack.cozystack-engine libraries: diff --git a/packages/core/platform/templates/apps.yaml b/packages/core/platform/templates/apps.yaml index 6dd7ee628..e04fd89ff 100644 --- a/packages/core/platform/templates/apps.yaml +++ b/packages/core/platform/templates/apps.yaml @@ -326,6 +326,12 @@ stringData: cpu-allocation-ratio: {{ .Values.resources.cpuAllocationRatio | quote }} memory-allocation-ratio: {{ .Values.resources.memoryAllocationRatio | quote }} ephemeral-storage-allocation-ratio: {{ .Values.resources.ephemeralStorageAllocationRatio | quote }} + {{- with (.Values.kubernetesEtcd | default dict).storageClassLocal }} + etcd-storage-class-local: {{ . | quote }} + {{- end }} + {{- with (.Values.kubernetesEtcd | default dict).storageClassReplicated }} + etcd-storage-class-replicated: {{ . | quote }} + {{- end }} {{- with .Values.scheduling }} scheduling: {{- . | toYaml | nindent 8 }} diff --git a/packages/core/platform/tests/apps_kubernetes_etcd_storage_class_wiring_test.yaml b/packages/core/platform/tests/apps_kubernetes_etcd_storage_class_wiring_test.yaml new file mode 100644 index 000000000..89e108918 --- /dev/null +++ b/packages/core/platform/tests/apps_kubernetes_etcd_storage_class_wiring_test.yaml @@ -0,0 +1,31 @@ +suite: apps.yaml kubernetesEtcd → _cluster wiring +templates: + - templates/apps.yaml + +release: + name: cozy-platform + namespace: cozy-system + +# The kubernetes chart picks the StorageClass of each cluster's own etcd from +# these two _cluster keys by member count. An unset key must stay out of the +# Secret, so the chart falls back to the namespace default StorageClass. + +tests: + - it: forwards both classes when they are set + set: + kubernetesEtcd: + storageClassLocal: local + storageClassReplicated: replicated + asserts: + - matchRegex: + path: stringData["values.yaml"] + pattern: '(?m)^\s*etcd-storage-class-local:\s*"local"$' + - matchRegex: + path: stringData["values.yaml"] + pattern: '(?m)^\s*etcd-storage-class-replicated:\s*"replicated"$' + + - it: writes neither key by default + asserts: + - notMatchRegex: + path: stringData["values.yaml"] + pattern: 'etcd-storage-class-' diff --git a/packages/core/platform/values.yaml b/packages/core/platform/values.yaml index b379684d7..1e4dbf500 100644 --- a/packages/core/platform/values.yaml +++ b/packages/core/platform/values.yaml @@ -809,6 +809,15 @@ backupStrategyController: {} # worker pools are not on `replicated` must move the golden onto their class). # Empty (the default) forwards nothing and keeps the child chart defaults. kubernetesWorkerImage: {} +# StorageClasses for the etcd each tenant Kubernetes cluster runs for its control +# plane, chosen by its member count. Three members already replicate through +# Raft, so a node-local class avoids replicating the data a second time; a single +# member has nothing but its volume, so a replicated class lets it outlive its +# node. Empty leaves the namespace default StorageClass. A cluster's etcd reads +# this once, when it is created: the class of an existing etcd cannot change. +kubernetesEtcd: + storageClassLocal: "" + storageClassReplicated: "" # Pod scheduling configuration scheduling: globalAppTopologySpreadConstraints: "" diff --git a/packages/extra/computeplane/README.md b/packages/extra/computeplane/README.md index 15779168f..fada37f80 100644 --- a/packages/extra/computeplane/README.md +++ b/packages/extra/computeplane/README.md @@ -21,15 +21,7 @@ applications. The tenant never sees that Secret: tenant-visible secrets are an allowlist, and this module's `ApplicationDefinition` includes nothing, which withholds every Secret in the module's lineage by construction. -**Prerequisite:** an `etcd` module must be available to the tenant — its own, -or one inherited from an ancestor tenant (the `_namespace.etcd` context -propagates down the tenant tree, so enabling a redundant local etcd is not -required). The tenant Kubernetes machinery — including the cluster-autoscaler -that brings up the default scale-from-zero `md0` node group — is backed by -that etcd; without it the wrapped chart collapses to its `awaiting-etcd` -status beacon and the ComputePlane provisions no control plane or workers -(the HelmReleases still report Ready over the empty shell, so check for the -beacon ConfigMap when nothing comes up). +The wrapped cluster brings its own etcd (`EtcdCluster/computeplane-cluster-etcd`), so the tenant needs no `etcd` module. A ComputePlane created before per-cluster etcd keeps the tenant etcd it already runs on. See the full design in [cozystack/community design-proposals/compute-plane](https://github.com/cozystack/community/tree/main/design-proposals/compute-plane). diff --git a/packages/extra/etcd/templates/podscrape.yaml b/packages/extra/etcd/templates/podscrape.yaml index 6acaff0e2..b18a24e8d 100644 --- a/packages/extra/etcd/templates/podscrape.yaml +++ b/packages/extra/etcd/templates/podscrape.yaml @@ -1 +1 @@ -{{ include "cozy-lib.etcd.podScrape" (dict "name" "etcd" "selector" (dict "app.kubernetes.io/name" "etcd")) }} +{{ include "cozy-lib.etcd.podScrape" (dict "name" "etcd" "selector" (dict "app.kubernetes.io/instance" "etcd")) }} diff --git a/packages/extra/etcd/tests/podscrape_test.yaml b/packages/extra/etcd/tests/podscrape_test.yaml new file mode 100644 index 000000000..239a10981 --- /dev/null +++ b/packages/extra/etcd/tests/podscrape_test.yaml @@ -0,0 +1,20 @@ +suite: etcd VMPodScrape selects only this chart's members + +release: + name: etcd + namespace: tenant-root + +templates: + - templates/podscrape.yaml + +# etcd-operator labels every member it runs app.kubernetes.io/name: etcd, the +# members of a tenant Kubernetes cluster's own etcd in the same namespace +# included. Selecting on that label folds those members into this etcd's job, +# and the member-count alerts then count them as this cluster's. +tests: + - it: selects the members by instance, not by name + asserts: + - equal: + path: spec.selector.matchLabels + value: + app.kubernetes.io/instance: etcd diff --git a/packages/library/cozy-lib/templates/_etcd.tpl b/packages/library/cozy-lib/templates/_etcd.tpl index 2a313bed2..45c1b44d1 100644 --- a/packages/library/cozy-lib/templates/_etcd.tpl +++ b/packages/library/cozy-lib/templates/_etcd.tpl @@ -417,7 +417,7 @@ spec: type: RuntimeDefault containers: - name: etcd-defrag - image: ghcr.io/ahrtr/etcd-defrag:v0.13.0 + image: {{ include "cozy-lib.image" (list "ghcr.io/ahrtr/etcd-defrag:v0.13.0@sha256:e8d5411a83561d11b5165aaf9cddcc3c24aa6846acda696eba0d18225154a249" $root) }} securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true @@ -506,3 +506,8 @@ spec: matchLabels: {{- toYaml .selector | nindent 6 }} {{- end -}} + +{{- /* The etcd chart's default version; bump the two together. */ -}} +{{- define "cozy-lib.etcd.defaultVersion" -}} +3.6.11 +{{- end -}} diff --git a/packages/system/backupstrategy-controller/templates/strategy-kubernetes-default.yaml b/packages/system/backupstrategy-controller/templates/strategy-kubernetes-default.yaml index 3fab192ad..b8be546fc 100644 --- a/packages/system/backupstrategy-controller/templates/strategy-kubernetes-default.yaml +++ b/packages/system/backupstrategy-controller/templates/strategy-kubernetes-default.yaml @@ -19,6 +19,13 @@ metadata: backups.cozystack.io/endpoint: {{ include "backupstrategy-controller.endpoint" . | quote }} spec: template: + metadata: + labels: + {{- /* + The cluster's own etcd admits only Pods carrying this label, so the + dump reaches its DataStore. Inert for a cluster on a shared etcd. + */}} + policy.cozystack.io/allow-to-etcd-cluster: {{ printf "{{ .Release.Prefix }}{{ .Release.Name }}-etcd" | quote }} spec: restartPolicy: Never activeDeadlineSeconds: {{ int .Values.backupStrategyController.kubernetesBackupActiveDeadlineSeconds }} diff --git a/packages/system/backupstrategy-controller/tests/rendering_test.yaml b/packages/system/backupstrategy-controller/tests/rendering_test.yaml index 941444070..d89b4ec0d 100644 --- a/packages/system/backupstrategy-controller/tests/rendering_test.yaml +++ b/packages/system/backupstrategy-controller/tests/rendering_test.yaml @@ -263,6 +263,12 @@ tests: path: spec.template.spec.volumes[0].secret.secretName value: "{{ .Datastore.CertificateSecret }}" template: templates/strategy-kubernetes-default.yaml + # A cluster's own etcd denies its client port to every Pod without this + # label, the dump Job's included. + - equal: + path: spec.template.metadata.labels["policy.cozystack.io/allow-to-etcd-cluster"] + value: "{{ .Release.Prefix }}{{ .Release.Name }}-etcd" + template: templates/strategy-kubernetes-default.yaml - equal: path: spec.velero.spec.orLabelSelectors[2].matchLabels["cluster.x-k8s.io/cluster-name"] value: "kubernetes-{{ .Application.metadata.name }}" diff --git a/packages/system/kubernetes-rd/cozyrds/kubernetes.yaml b/packages/system/kubernetes-rd/cozyrds/kubernetes.yaml index 1696ab914..8b7c1cf0f 100644 --- a/packages/system/kubernetes-rd/cozyrds/kubernetes.yaml +++ b/packages/system/kubernetes-rd/cozyrds/kubernetes.yaml @@ -32,7 +32,7 @@ spec: singular: kubernetes plural: kuberneteses openAPISchema: |- - {"title":"Chart Values","type":"object","x-cozystack-name":{"type":"string","description":"Cluster name. Each worker pool is a KubernetesNodes release named `kubernetes-nodes--`, which has to fit the 53-character Helm release name limit, so a cluster name of at most 32 characters leaves at least three characters for the pool name.","maxLength":32},"properties":{"storageClass":{"description":"Default StorageClass inside the tenant cluster. Remote-accessible LINSTOR classes are auto-propagated to the tenant under the same name.","type":"string","default":"replicated","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"version":{"description":"Kubernetes major.minor version to deploy","type":"string","default":"v1.35","enum":["v1.35","v1.34","v1.33","v1.32","v1.31"]},"host":{"description":"External hostname for Kubernetes cluster. Defaults to `kubernetes-.` if empty.","type":"string","default":""},"substrate":{"description":"Which infrastructure provider backs this cluster's worker VMs. `kubevirt` runs them inside this cluster; `proxmox` runs them on an external Proxmox VE cluster through capmox. The control plane is Kamaji either way — this selects the infrastructure half only. Every KubernetesNodes pool of this cluster must set the same `substrate`: a pool set to the other one refuses to render once this cluster exists. Switching an existing cluster is not supported; create a new one.","type":"string","default":"kubevirt","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"substrate is immutable"}]},"proxmox":{"description":"Proxmox substrate settings.","type":"object","default":{},"required":["ipv4Config"],"properties":{"allowedNodes":{"description":"Proxmox nodes capmox may place VMs on. Empty means every node in the Proxmox cluster.","type":"array","default":[],"items":{"type":"string"}},"ccm":{"description":"Proxmox cloud-controller-manager settings.","type":"object","default":{},"required":["credentialsSecretName"],"properties":{"credentialsSecretName":{"description":"Secret in THIS namespace holding the controller's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. May name the same Secret as `csi.credentialsSecretName`; it is a separate knob so the two can hold separate tokens, since this one only reads VM inventory while the driver attaches and detaches disks.","type":"string","default":""}}},"csi":{"description":"Proxmox CSI driver settings.","type":"object","default":{},"required":["credentialsSecretName","enabled"],"properties":{"credentialsSecretName":{"description":"Secret in THIS namespace holding the driver's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. The parent chart composes them into the controller's config file here, in the management cluster; nothing reaches the tenant, and no token is written into a rendered manifest. Distinct from the capmox credentials on purpose: the driver attaches and detaches disks, which is a different blast radius from creating VMs.","type":"string","default":""},"enabled":{"description":"Install the driver. Without it a Proxmox-backed tenant has no way to provision PersistentVolumes at all.","type":"boolean","default":true},"storageClasses":{"description":"StorageClasses to create in the tenant.","type":"array","default":[],"items":{"type":"object","required":["name","storage"],"properties":{"fstype":{"description":"Filesystem the driver formats volumes with: ext4 or xfs.","type":"string"},"name":{"description":"StorageClass name inside the tenant cluster.","type":"string"},"reclaimPolicy":{"description":"Delete or Retain.","type":"string"},"ssd":{"description":"Mark volumes as SSD-backed, which changes the discard/cache defaults Proxmox applies.","type":"boolean"},"storage":{"description":"Proxmox storage id the volumes are created on (as it appears in `pvesm status`).","type":"string"}}}}}},"dnsServers":{"description":"Nameservers written into each worker's network config. Required by the ProxmoxCluster schema.","type":"array","default":[],"items":{"type":"string"}},"insecure":{"description":"Skip verification of the Proxmox API server certificate in the CCM and the CSI controller, both of which run in the management cluster. Default false: the certificate is verified unless an operator turns that off. A stock Proxmox VE install serves a self-signed one, so set true for it, or install a certificate the management cluster trusts.","type":"boolean","default":false},"ipv4Config":{"description":"Address pool for workers. capmox assigns static addresses and has no DHCP mode, so this is required rather than optional.","type":"object","default":{},"required":["gateway","prefix"],"properties":{"addresses":{"description":"Ranges or CIDRs, e.g. `[\"10.0.0.120-10.0.0.170\"]`. capmox turns these into an InClusterIPPool, so they must not overlap any DHCP range on the same L2 or two workers will answer to one address.","type":"array","default":[],"items":{"type":"string"}},"gateway":{"description":"Default gateway for the workers.","type":"string","default":""},"prefix":{"description":"Netmask prefix length.","type":"integer","default":24}}}}},"addons":{"description":"Cluster addons configuration.","type":"object","default":{},"required":["certManager","cilium","coredns","gatewayAPI","gpuOperator","hami","ingressNginx","monitoringAgents","ouroboros","velero","verticalPodAutoscaler"],"properties":{"certManager":{"description":"Cert-manager addon.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable cert-manager.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"cilium":{"description":"Cilium CNI plugin. Always installed as the tenant cluster's CNI; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true},"coredns":{"description":"CoreDNS addon. Always installed as the tenant cluster's DNS; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true},"gatewayAPI":{"description":"Gateway API addon.","type":"object","default":{},"required":["enabled"],"properties":{"enabled":{"description":"Enable Gateway API.","type":"boolean","default":false}}},"gpuOperator":{"description":"NVIDIA GPU Operator.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable GPU Operator.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"hami":{"description":"HAMi GPU virtualization middleware.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable HAMi (requires GPU Operator).","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"ingressNginx":{"description":"Ingress-NGINX controller.","type":"object","default":{},"required":["enabled","exposeMethod","valuesOverride"],"properties":{"enabled":{"description":"Enable the controller (requires nodes labeled `ingress-nginx`).","type":"boolean","default":false},"exposeMethod":{"description":"Method to expose the controller. Allowed values: `Proxied`, `LoadBalancer`.","type":"string","default":"Proxied","enum":["Proxied","LoadBalancer"]},"hosts":{"description":"Domains routed to this tenant cluster when `exposeMethod` is `Proxied`.","type":"array","default":[],"items":{"type":"string"}},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"monitoringAgents":{"description":"Monitoring agents.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable monitoring agents.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"ouroboros":{"description":"Hairpin-NAT fix for ingress-nginx with PROXY-protocol.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable ouroboros. Requires addons.ingressNginx.enabled (chart-render fail otherwise). Only useful when PROXY-protocol is wired on the tenant ingress-nginx via valuesOverride.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides. Operator-key wins over cozystack defaults.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"velero":{"description":"Velero backup/restore addon.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable Velero.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"verticalPodAutoscaler":{"description":"Vertical Pod Autoscaler. Installed and removed together with addons.monitoringAgents.enabled; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true}}},"controlPlane":{"description":"Kubernetes control-plane configuration.","type":"object","default":{},"required":["apiServer","controllerManager","konnectivity","replicas","scheduler"],"properties":{"apiServer":{"description":"API Server configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"admissionControllers":{"description":"Admission plugins the tenant kube-apiserver enables, passed through to KamajiControlPlane `spec.admissionControllers`, which the control plane renders as `--enable-admission-plugins`. A non-empty list replaces the control plane's default set instead of adding to it. The kube-apiserver enables these plugins in addition to its own default ones, so leaving a plugin out does not turn it off; to turn one off, name it in `--disable-admission-plugins` in `controlPlane.apiServer.extraArgs` and keep it out of this list, since the apiserver refuses to start with a plugin in both, and the control plane's default set names several. Empty by default, which keeps that default set, taken from the TenantControlPlane CRD: CertificateApproval, CertificateSigning, CertificateSubjectRestriction, DefaultIngressClass, DefaultStorageClass, DefaultTolerationSeconds, LimitRanger, MutatingAdmissionWebhook, NamespaceLifecycle, PersistentVolumeClaimResize, Priority, ResourceQuota, RuntimeClass, ServiceAccount, StorageObjectInUseProtection, TaintNodesByCondition, ValidatingAdmissionWebhook. `NodeRestriction` is not in it.","type":"array","default":[],"items":{"type":"string","enum":["AlwaysAdmit","AlwaysDeny","AlwaysPullImages","CertificateApproval","CertificateSigning","CertificateSubjectRestriction","DefaultIngressClass","DefaultStorageClass","DefaultTolerationSeconds","DenyEscalatingExec","DenyExecOnPrivileged","DenyServiceExternalIPs","EventRateLimit","ExtendedResourceToleration","ImagePolicyWebhook","LimitPodHardAntiAffinityTopology","LimitRanger","MutatingAdmissionWebhook","NamespaceAutoProvision","NamespaceExists","NamespaceLifecycle","NodeRestriction","OwnerReferencesPermissionEnforcement","PersistentVolumeClaimResize","PersistentVolumeLabel","PodNodeSelector","PodSecurity","PodSecurityPolicy","PodTolerationRestriction","Priority","ResourceQuota","RuntimeClass","SecurityContextDeny","ServiceAccount","StorageObjectInUseProtection","TaintNodesByCondition","ValidatingAdmissionWebhook"]}},"extraArgs":{"description":"Extra command-line flags appended to the tenant kube-apiserver, passed through to KamajiControlPlane `spec.apiServer.extraArgs`. For OIDC use `spec.oidc.mode` — this passthrough is the escape hatch for unrelated apiserver flags. The tenant control plane sets each of the following flags itself and drops an entry naming one before the apiserver sees it. The chart moves an `--enable-admission-plugins=` entry into `controlPlane.apiServer.admissionControllers` and a `--kubelet-preferred-address-types=` entry into `controlPlane.kubelet.preferredAddressTypes` while that field is empty, and refuses any other entry naming one of them: `--advertise-address`, `--client-ca-file`, `--enable-admission-plugins`, `--service-cluster-ip-range`, `--kubelet-client-certificate`, `--kubelet-client-key`, `--kubelet-preferred-address-types`, `--proxy-client-cert-file`, `--proxy-client-key-file`, `--requestheader-allowed-names`, `--requestheader-client-ca-file`, `--secure-port`, `--service-account-key-file`, `--service-account-signing-key-file`, `--tls-cert-file`, `--tls-private-key-file`, `--etcd-servers`, `--etcd-cafile`, `--etcd-certfile`, `--etcd-keyfile`, `--etcd-prefix`, `--etcd-compaction-interval`, `--egress-selector-config-file`. When `spec.oidc.mode` is not `None` the chart also renders OIDC flags here, reads what you have written on them, and refuses some combinations outright; the Aggregated API servers section of the Kubernetes OIDC guide on cozystack.io carries which flags, which combinations, and why. Do NOT add legacy `--oidc-*` flags here when `spec.oidc.mode` is not `None`; the chart injects `--authentication-config` and the apiserver refuses to boot with both. Empty by default.","type":"array","default":[],"items":{"type":"string"}},"extraVolumeMounts":{"description":"Extra volume mounts added to the tenant kube-apiserver container, passed through to KamajiControlPlane `spec.apiServer.extraVolumeMounts`. Each `name` must reference a volume declared in `extraVolumes`; the chart-managed talos secret volumes cannot be mounted. Each item is a core/v1 VolumeMount. Empty by default.","type":"array","default":[],"items":{"type":"object","x-kubernetes-preserve-unknown-fields":true}},"extraVolumes":{"description":"Extra volumes added to the control-plane Deployment, passed through to KamajiControlPlane `spec.deployment.extraVolumes`. Use to mount a ConfigMap or Secret holding an AuthenticationConfiguration file referenced by `extraArgs`. Each item is a core/v1 Volume, but because the control-plane pod runs on the management cluster only `configMap` and `secret` sources are allowed (host-reaching sources like `hostPath`/`csi` and token-projection via `projected` are rejected); each volume must have a unique, non-empty name and exactly one source. The names `talos-ca` and `talos-tls-cert` are reserved by the chart. Empty by default.","type":"array","default":[],"items":{"type":"object","x-kubernetes-preserve-unknown-fields":true}},"resources":{"description":"CPU and memory resources for API Server.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Preset if `resources` omitted.","type":"string","default":"c1.medium","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}},"controllerManager":{"description":"Controller Manager configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Controller Manager.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Preset if `resources` omitted.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}},"konnectivity":{"description":"Konnectivity configuration.","type":"object","default":{},"required":["server"],"properties":{"server":{"description":"Konnectivity Server configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Konnectivity.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Preset if `resources` omitted.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}}}},"kubelet":{"description":"Kubelet connection settings.","type":"object","default":{},"properties":{"preferredAddressTypes":{"description":"Node address types the tenant kube-apiserver tries, in order, when it connects to a kubelet, passed through to KamajiControlPlane `spec.kubelet.preferredAddressTypes`, which the control plane renders as `--kubelet-preferred-address-types`. The KamajiControlPlane CRD rejects a repeated name. Empty by default, which renders `InternalIP`, `ExternalIP`, or the list of a `--kubelet-preferred-address-types=` entry in `controlPlane.apiServer.extraArgs` when there is one.","type":"array","default":[],"items":{"type":"string","enum":["Hostname","InternalIP","ExternalIP","InternalDNS","ExternalDNS"]}}}},"replicas":{"description":"Number of control-plane replicas.","type":"integer","default":2},"scheduler":{"description":"Scheduler configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Scheduler.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Preset if `resources` omitted.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}}}},"oidc":{"description":"OIDC authentication and per-user RBAC for the tenant kube-apiserver. See https://cozystack.io/docs/v1.6/kubernetes/oidc-authentication/ for the operator guide.","type":"object","default":{},"required":["mode"],"properties":{"customConfig":{"description":"Tenant-supplied AuthenticationConfiguration; consumed only when `mode: CustomConfig`.","type":"object","default":{},"properties":{"config":{"description":"Inline AuthenticationConfiguration YAML (`apiserver.config.k8s.io/v1beta1`). The chart writes the value verbatim into a Secret mounted at `/etc/kubernetes/authentication-config/config.yaml` on the kube-apiserver. Mutually exclusive with `secretRef.name`.","type":"string","default":""},"secretRef":{"description":"Reference to an existing Secret in the tenant namespace carrying the `AuthenticationConfiguration`.","type":"object","default":{},"properties":{"name":{"description":"Name of an existing Secret in the tenant (release) namespace whose `config.yaml` key holds an `apiserver.config.k8s.io/v1beta1` `AuthenticationConfiguration`. Mutually exclusive with `customConfig.config`.","type":"string","default":""}}}}},"mode":{"description":"Identity mode. `None`: no OIDC, only the static admin kubeconfig works. `System`: trust the platform Keycloak realm (`cozy` by default) via a per-cluster public client with audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.","type":"string","default":"None","enum":["None","System","CustomConfig"]},"users":{"description":"Users granted access to the tenant cluster; each entry produces one ClusterRoleBinding inside the tenant cluster. Works for both `System` and `CustomConfig` modes.","type":"array","default":[],"items":{"type":"object","required":["email","role"],"properties":{"email":{"description":"Email address matched against the `email` claim from the issuer. Used verbatim as the `User:` subject in the ClusterRoleBinding inside the tenant cluster. The `email` claim is a built-in OIDC scope requested explicitly by the chart-generated `kubectl oidc-login` kubeconfig; every conformant OIDC provider (cozy realm included) emits it.","type":"string"},"role":{"description":"Role to bind: `admin` maps to `ClusterRole/cluster-admin`, `view` maps to `ClusterRole/view`.","type":"string","enum":["admin","view"]}}}}}},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other value is refused, and the pods of an application whose class is not, or no longer, in that list get the tenant's class. Empty means inherit from the tenant.","type":"string","default":"","maxLength":63}}} + {"title":"Chart Values","type":"object","x-cozystack-name":{"type":"string","description":"Cluster name. Each worker pool is a KubernetesNodes release named `kubernetes-nodes--`, which has to fit the 53-character Helm release name limit, so a cluster name of at most 32 characters leaves at least three characters for the pool name.","maxLength":32},"properties":{"storageClass":{"description":"Default StorageClass inside the tenant cluster. Remote-accessible LINSTOR classes are auto-propagated to the tenant under the same name.","type":"string","default":"replicated","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"version":{"description":"Kubernetes major.minor version to deploy","type":"string","default":"v1.35","enum":["v1.35","v1.34","v1.33","v1.32","v1.31"]},"host":{"description":"External hostname for Kubernetes cluster. Defaults to `kubernetes-.` if empty.","type":"string","default":""},"substrate":{"description":"Which infrastructure provider backs this cluster's worker VMs. `kubevirt` runs them inside this cluster; `proxmox` runs them on an external Proxmox VE cluster through capmox. The control plane is Kamaji either way — this selects the infrastructure half only. Every KubernetesNodes pool of this cluster must set the same `substrate`: a pool set to the other one refuses to render once this cluster exists. Switching an existing cluster is not supported; create a new one.","type":"string","default":"kubevirt","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"substrate is immutable"}]},"proxmox":{"description":"Proxmox substrate settings.","type":"object","default":{},"required":["ipv4Config"],"properties":{"allowedNodes":{"description":"Proxmox nodes capmox may place VMs on. Empty means every node in the Proxmox cluster.","type":"array","default":[],"items":{"type":"string"}},"ccm":{"description":"Proxmox cloud-controller-manager settings.","type":"object","default":{},"required":["credentialsSecretName"],"properties":{"credentialsSecretName":{"description":"Secret in THIS namespace holding the controller's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. May name the same Secret as `csi.credentialsSecretName`; it is a separate knob so the two can hold separate tokens, since this one only reads VM inventory while the driver attaches and detaches disks.","type":"string","default":""}}},"csi":{"description":"Proxmox CSI driver settings.","type":"object","default":{},"required":["credentialsSecretName","enabled"],"properties":{"credentialsSecretName":{"description":"Secret in THIS namespace holding the driver's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. The parent chart composes them into the controller's config file here, in the management cluster; nothing reaches the tenant, and no token is written into a rendered manifest. Distinct from the capmox credentials on purpose: the driver attaches and detaches disks, which is a different blast radius from creating VMs.","type":"string","default":""},"enabled":{"description":"Install the driver. Without it a Proxmox-backed tenant has no way to provision PersistentVolumes at all.","type":"boolean","default":true},"storageClasses":{"description":"StorageClasses to create in the tenant.","type":"array","default":[],"items":{"type":"object","required":["name","storage"],"properties":{"fstype":{"description":"Filesystem the driver formats volumes with: ext4 or xfs.","type":"string"},"name":{"description":"StorageClass name inside the tenant cluster.","type":"string"},"reclaimPolicy":{"description":"Delete or Retain.","type":"string"},"ssd":{"description":"Mark volumes as SSD-backed, which changes the discard/cache defaults Proxmox applies.","type":"boolean"},"storage":{"description":"Proxmox storage id the volumes are created on (as it appears in `pvesm status`).","type":"string"}}}}}},"dnsServers":{"description":"Nameservers written into each worker's network config. Required by the ProxmoxCluster schema.","type":"array","default":[],"items":{"type":"string"}},"insecure":{"description":"Skip verification of the Proxmox API server certificate in the CCM and the CSI controller, both of which run in the management cluster. Default false: the certificate is verified unless an operator turns that off. A stock Proxmox VE install serves a self-signed one, so set true for it, or install a certificate the management cluster trusts.","type":"boolean","default":false},"ipv4Config":{"description":"Address pool for workers. capmox assigns static addresses and has no DHCP mode, so this is required rather than optional.","type":"object","default":{},"required":["gateway","prefix"],"properties":{"addresses":{"description":"Ranges or CIDRs, e.g. `[\"10.0.0.120-10.0.0.170\"]`. capmox turns these into an InClusterIPPool, so they must not overlap any DHCP range on the same L2 or two workers will answer to one address.","type":"array","default":[],"items":{"type":"string"}},"gateway":{"description":"Default gateway for the workers.","type":"string","default":""},"prefix":{"description":"Netmask prefix length.","type":"integer","default":24}}}}},"addons":{"description":"Cluster addons configuration.","type":"object","default":{},"required":["certManager","cilium","coredns","gatewayAPI","gpuOperator","hami","ingressNginx","monitoringAgents","ouroboros","velero","verticalPodAutoscaler"],"properties":{"certManager":{"description":"Cert-manager addon.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable cert-manager.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"cilium":{"description":"Cilium CNI plugin. Always installed as the tenant cluster's CNI; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true},"coredns":{"description":"CoreDNS addon. Always installed as the tenant cluster's DNS; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true},"gatewayAPI":{"description":"Gateway API addon.","type":"object","default":{},"required":["enabled"],"properties":{"enabled":{"description":"Enable Gateway API.","type":"boolean","default":false}}},"gpuOperator":{"description":"NVIDIA GPU Operator.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable GPU Operator.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"hami":{"description":"HAMi GPU virtualization middleware.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable HAMi (requires GPU Operator).","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"ingressNginx":{"description":"Ingress-NGINX controller.","type":"object","default":{},"required":["enabled","exposeMethod","valuesOverride"],"properties":{"enabled":{"description":"Enable the controller (requires nodes labeled `ingress-nginx`).","type":"boolean","default":false},"exposeMethod":{"description":"Method to expose the controller. Allowed values: `Proxied`, `LoadBalancer`.","type":"string","default":"Proxied","enum":["Proxied","LoadBalancer"]},"hosts":{"description":"Domains routed to this tenant cluster when `exposeMethod` is `Proxied`.","type":"array","default":[],"items":{"type":"string"}},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"monitoringAgents":{"description":"Monitoring agents.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable monitoring agents.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"ouroboros":{"description":"Hairpin-NAT fix for ingress-nginx with PROXY-protocol.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable ouroboros. Requires addons.ingressNginx.enabled (chart-render fail otherwise). Only useful when PROXY-protocol is wired on the tenant ingress-nginx via valuesOverride.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides. Operator-key wins over cozystack defaults.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"velero":{"description":"Velero backup/restore addon.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable Velero.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"verticalPodAutoscaler":{"description":"Vertical Pod Autoscaler. Installed and removed together with addons.monitoringAgents.enabled; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true}}},"controlPlane":{"description":"Kubernetes control-plane configuration.","type":"object","default":{},"required":["apiServer","controllerManager","konnectivity","replicas","scheduler"],"properties":{"apiServer":{"description":"API Server configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"admissionControllers":{"description":"Admission plugins the tenant kube-apiserver enables, passed through to KamajiControlPlane `spec.admissionControllers`, which the control plane renders as `--enable-admission-plugins`. A non-empty list replaces the control plane's default set instead of adding to it. The kube-apiserver enables these plugins in addition to its own default ones, so leaving a plugin out does not turn it off; to turn one off, name it in `--disable-admission-plugins` in `controlPlane.apiServer.extraArgs` and keep it out of this list, since the apiserver refuses to start with a plugin in both, and the control plane's default set names several. Empty by default, which keeps that default set, taken from the TenantControlPlane CRD: CertificateApproval, CertificateSigning, CertificateSubjectRestriction, DefaultIngressClass, DefaultStorageClass, DefaultTolerationSeconds, LimitRanger, MutatingAdmissionWebhook, NamespaceLifecycle, PersistentVolumeClaimResize, Priority, ResourceQuota, RuntimeClass, ServiceAccount, StorageObjectInUseProtection, TaintNodesByCondition, ValidatingAdmissionWebhook. `NodeRestriction` is not in it.","type":"array","default":[],"items":{"type":"string","enum":["AlwaysAdmit","AlwaysDeny","AlwaysPullImages","CertificateApproval","CertificateSigning","CertificateSubjectRestriction","DefaultIngressClass","DefaultStorageClass","DefaultTolerationSeconds","DenyEscalatingExec","DenyExecOnPrivileged","DenyServiceExternalIPs","EventRateLimit","ExtendedResourceToleration","ImagePolicyWebhook","LimitPodHardAntiAffinityTopology","LimitRanger","MutatingAdmissionWebhook","NamespaceAutoProvision","NamespaceExists","NamespaceLifecycle","NodeRestriction","OwnerReferencesPermissionEnforcement","PersistentVolumeClaimResize","PersistentVolumeLabel","PodNodeSelector","PodSecurity","PodSecurityPolicy","PodTolerationRestriction","Priority","ResourceQuota","RuntimeClass","SecurityContextDeny","ServiceAccount","StorageObjectInUseProtection","TaintNodesByCondition","ValidatingAdmissionWebhook"]}},"extraArgs":{"description":"Extra command-line flags appended to the tenant kube-apiserver, passed through to KamajiControlPlane `spec.apiServer.extraArgs`. For OIDC use `spec.oidc.mode` — this passthrough is the escape hatch for unrelated apiserver flags. The tenant control plane sets each of the following flags itself and drops an entry naming one before the apiserver sees it. The chart moves an `--enable-admission-plugins=` entry into `controlPlane.apiServer.admissionControllers` and a `--kubelet-preferred-address-types=` entry into `controlPlane.kubelet.preferredAddressTypes` while that field is empty, and refuses any other entry naming one of them: `--advertise-address`, `--client-ca-file`, `--enable-admission-plugins`, `--service-cluster-ip-range`, `--kubelet-client-certificate`, `--kubelet-client-key`, `--kubelet-preferred-address-types`, `--proxy-client-cert-file`, `--proxy-client-key-file`, `--requestheader-allowed-names`, `--requestheader-client-ca-file`, `--secure-port`, `--service-account-key-file`, `--service-account-signing-key-file`, `--tls-cert-file`, `--tls-private-key-file`, `--etcd-servers`, `--etcd-cafile`, `--etcd-certfile`, `--etcd-keyfile`, `--etcd-prefix`, `--etcd-compaction-interval`, `--egress-selector-config-file`. When `spec.oidc.mode` is not `None` the chart also renders OIDC flags here, reads what you have written on them, and refuses some combinations outright; the Aggregated API servers section of the Kubernetes OIDC guide on cozystack.io carries which flags, which combinations, and why. Do NOT add legacy `--oidc-*` flags here when `spec.oidc.mode` is not `None`; the chart injects `--authentication-config` and the apiserver refuses to boot with both. Empty by default.","type":"array","default":[],"items":{"type":"string"}},"extraVolumeMounts":{"description":"Extra volume mounts added to the tenant kube-apiserver container, passed through to KamajiControlPlane `spec.apiServer.extraVolumeMounts`. Each `name` must reference a volume declared in `extraVolumes`; the chart-managed talos secret volumes cannot be mounted. Each item is a core/v1 VolumeMount. Empty by default.","type":"array","default":[],"items":{"type":"object","x-kubernetes-preserve-unknown-fields":true}},"extraVolumes":{"description":"Extra volumes added to the control-plane Deployment, passed through to KamajiControlPlane `spec.deployment.extraVolumes`. Use to mount a ConfigMap or Secret holding an AuthenticationConfiguration file referenced by `extraArgs`. Each item is a core/v1 Volume, but because the control-plane pod runs on the management cluster only `configMap` and `secret` sources are allowed (host-reaching sources like `hostPath`/`csi` and token-projection via `projected` are rejected); each volume must have a unique, non-empty name and exactly one source. The names `talos-ca` and `talos-tls-cert` are reserved by the chart. Empty by default.","type":"array","default":[],"items":{"type":"object","x-kubernetes-preserve-unknown-fields":true}},"resources":{"description":"CPU and memory resources for API Server.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Preset if `resources` omitted.","type":"string","default":"c1.medium","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}},"controllerManager":{"description":"Controller Manager configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Controller Manager.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Preset if `resources` omitted.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}},"konnectivity":{"description":"Konnectivity configuration.","type":"object","default":{},"required":["server"],"properties":{"server":{"description":"Konnectivity Server configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Konnectivity.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Preset if `resources` omitted.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}}}},"kubelet":{"description":"Kubelet connection settings.","type":"object","default":{},"properties":{"preferredAddressTypes":{"description":"Node address types the tenant kube-apiserver tries, in order, when it connects to a kubelet, passed through to KamajiControlPlane `spec.kubelet.preferredAddressTypes`, which the control plane renders as `--kubelet-preferred-address-types`. The KamajiControlPlane CRD rejects a repeated name. Empty by default, which renders `InternalIP`, `ExternalIP`, or the list of a `--kubelet-preferred-address-types=` entry in `controlPlane.apiServer.extraArgs` when there is one.","type":"array","default":[],"items":{"type":"string","enum":["Hostname","InternalIP","ExternalIP","InternalDNS","ExternalDNS"]}}}},"replicas":{"description":"Number of control-plane replicas.","type":"integer","default":2},"scheduler":{"description":"Scheduler configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Scheduler.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Preset if `resources` omitted.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}}}},"etcd":{"description":"Dedicated etcd for this cluster's control plane, rendered with the cluster and deleted with it. Clusters that already run on their tenant's shared etcd keep it, and this section does not apply to them.","type":"object","default":{},"required":["replicas"],"properties":{"replicas":{"description":"Number of etcd members: `3` keeps quorum through the loss of one member, `1` runs a single member with no failover. Only `1` and `3` are accepted. The StorageClass is picked by the platform for each of the two shapes and fixed when the etcd is first created, so changing the count later keeps the class it started with. For that reason going from 3 members to 1 is refused when the etcd is on the class the platform names for 3 members, or off the class it names for 1: a single member would then hold the only copy of the control-plane state on storage that does not replicate it.","type":"integer","default":3,"maximum":3,"minimum":1}}},"oidc":{"description":"OIDC authentication and per-user RBAC for the tenant kube-apiserver. See https://cozystack.io/docs/v1.6/kubernetes/oidc-authentication/ for the operator guide.","type":"object","default":{},"required":["mode"],"properties":{"customConfig":{"description":"Tenant-supplied AuthenticationConfiguration; consumed only when `mode: CustomConfig`.","type":"object","default":{},"properties":{"config":{"description":"Inline AuthenticationConfiguration YAML (`apiserver.config.k8s.io/v1beta1`). The chart writes the value verbatim into a Secret mounted at `/etc/kubernetes/authentication-config/config.yaml` on the kube-apiserver. Mutually exclusive with `secretRef.name`.","type":"string","default":""},"secretRef":{"description":"Reference to an existing Secret in the tenant namespace carrying the `AuthenticationConfiguration`.","type":"object","default":{},"properties":{"name":{"description":"Name of an existing Secret in the tenant (release) namespace whose `config.yaml` key holds an `apiserver.config.k8s.io/v1beta1` `AuthenticationConfiguration`. Mutually exclusive with `customConfig.config`.","type":"string","default":""}}}}},"mode":{"description":"Identity mode. `None`: no OIDC, only the static admin kubeconfig works. `System`: trust the platform Keycloak realm (`cozy` by default) via a per-cluster public client with audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.","type":"string","default":"None","enum":["None","System","CustomConfig"]},"users":{"description":"Users granted access to the tenant cluster; each entry produces one ClusterRoleBinding inside the tenant cluster. Works for both `System` and `CustomConfig` modes.","type":"array","default":[],"items":{"type":"object","required":["email","role"],"properties":{"email":{"description":"Email address matched against the `email` claim from the issuer. Used verbatim as the `User:` subject in the ClusterRoleBinding inside the tenant cluster. The `email` claim is a built-in OIDC scope requested explicitly by the chart-generated `kubectl oidc-login` kubeconfig; every conformant OIDC provider (cozy realm included) emits it.","type":"string"},"role":{"description":"Role to bind: `admin` maps to `ClusterRole/cluster-admin`, `view` maps to `ClusterRole/view`.","type":"string","enum":["admin","view"]}}}}}},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other value is refused, and the pods of an application whose class is not, or no longer, in that list get the tenant's class. Empty means inherit from the tenant.","type":"string","default":"","maxLength":63}}} release: prefix: kubernetes- labels: @@ -50,7 +50,7 @@ spec: tags: - compute icon: PHN2ZyB3aWR0aD0iMTQ0IiBoZWlnaHQ9IjE0NCIgdmlld0JveD0iMCAwIDE0NCAxNDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxNDQiIGhlaWdodD0iMTQ0IiByeD0iMjQiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl82ODFfMjg0NSkiLz4KPHBhdGggZD0iTTcxLjk5NjggMTlDNzAuMzAzOSAxOS4wMDAyIDY4LjkzMTIgMjAuNTMyMiA2OC45MzE0IDIyLjQyMjFDNjguOTMxNCAyMi40NTExIDY4LjkzNzMgMjIuNDc4OCA2OC45Mzc5IDIyLjUwNzZDNjguOTM1NCAyMi43NjQ0IDY4LjkyMzEgMjMuMDczNyA2OC45MzE0IDIzLjI5NzNDNjguOTcxNyAyNC4zODczIDY5LjIwODIgMjUuMjIxNiA2OS4zNTA2IDI2LjIyNThDNjkuNjA4NCAyOC4zNzUyIDY5LjgyNDUgMzAuMTU2OSA2OS42OTEyIDMxLjgxM0M2OS41NjE1IDMyLjQzNzUgNjkuMTAzNyAzMy4wMDg2IDY4LjY5NTYgMzMuNDA1Nkw2OC42MjM1IDM0LjcwODZDNjYuNzgzOSAzNC44NjE3IDY0LjkzMTkgMzUuMTQyMSA2My4wODIxIDM1LjU2NDFDNTUuMTIyNiAzNy4zNzk4IDQ4LjI2OTUgNDEuNDk5MSA0My4wNTIgNDcuMDYwOUM0Mi43MTM0IDQ2LjgyODggNDIuMTIxMSA0Ni40MDE5IDQxLjk0NSA0Ni4yNzEyQzQxLjM5NzcgNDYuMzQ1NCA0MC44NDQ1IDQ2LjUxNTEgNDAuMTI0MSA0Ni4wOTM1QzM4Ljc1MjIgNDUuMTY1NyAzNy41MDI4IDQzLjg4NTEgMzUuOTkxIDQyLjM0MjRDMzUuMjk4MiA0MS42MDQ0IDM0Ljc5NjYgNDAuOTAxOCAzMy45NzM1IDQwLjE5MDRDMzMuNzg2NiA0MC4wMjg5IDMzLjUwMTQgMzkuODEwNCAzMy4yOTIzIDM5LjY0NDJDMzIuNjQ4OSAzOS4xMjg4IDMxLjg5IDM4Ljg2IDMxLjE1NyAzOC44MzQ4QzMwLjIxNDcgMzguODAyNCAyOS4zMDc1IDM5LjE3MjUgMjguNzEzOCAzOS45MjA2QzI3LjY1ODQgNDEuMjUwNiAyNy45OTYzIDQzLjI4MzMgMjkuNDY3MSA0NC40NjE0QzI5LjQ4MiA0NC40NzM0IDI5LjQ5NzkgNDQuNDgyNyAyOS41MTI5IDQ0LjQ5NDNDMjkuNzE1IDQ0LjY1ODkgMjkuOTYyNSA0NC44Njk4IDMwLjE0ODMgNDUuMDA3NkMzMS4wMjE3IDQ1LjY1NTUgMzEuODE5NSA0NS45ODcyIDMyLjY4OTcgNDYuNTAxNUMzNC41MjMxIDQ3LjYzOTEgMzYuMDQzIDQ4LjU4MjMgMzcuMjQ4NiA0OS43MTk2QzM3LjcxOTQgNTAuMjIzNyAzNy44MDE2IDUxLjExMjIgMzcuODY0MyA1MS40OTY0TDM4Ljg0NjggNTIuMzc4MkMzMy41ODcyIDYwLjMzMDggMzEuMTUzIDcwLjE1MzkgMzIuNTkxNSA4MC4xNjI3TDMxLjMwNzcgODAuNTM3OEMzMC45NjkzIDgwLjk3NjggMzAuNDkxMiA4MS42Njc2IDI5Ljk5MTEgODEuODczOEMyOC40MTM4IDgyLjM3MjkgMjYuNjM4NyA4Mi41NTYyIDI0LjQ5NTYgODIuNzgxOUMyMy40ODk0IDgyLjg2NiAyMi42MjEzIDgyLjgxNTggMjEuNTU0NiA4My4wMTg4QzIxLjMxOTggODMuMDYzNSAyMC45OTI3IDgzLjE0OTEgMjAuNzM1OCA4My4yMDk3QzIwLjcyNjkgODMuMjExNiAyMC43MTg2IDgzLjIxNDIgMjAuNzA5NiA4My4yMTYyQzIwLjY5NTYgODMuMjE5NSAyMC42NzcyIDgzLjIyNjMgMjAuNjYzOCA4My4yMjk0QzE4Ljg1NyA4My42NjggMTcuNjk2MyA4NS4zMzY1IDE4LjA2OTkgODYuOTgwNUMxOC40NDM3IDg4LjYyNDggMjAuMjA4NiA4OS42MjQ4IDIyLjAyNjIgODkuMjMxMkMyMi4wMzkzIDg5LjIyODIgMjIuMDU4NCA4OS4yMjc3IDIyLjA3MiA4OS4yMjQ2QzIyLjA5MjYgODkuMjE5OSAyMi4xMTA2IDg5LjIwOTkgMjIuMTMxIDg5LjIwNDlDMjIuMzg0NCA4OS4xNDkgMjIuNzAxOSA4OS4wODY4IDIyLjkyMzYgODkuMDI3MkMyMy45NzIzIDg4Ljc0NTEgMjQuNzMxOCA4OC4zMzA2IDI1LjY3NDYgODcuOTY3N0MyNy43MDI5IDg3LjIzNjggMjkuMzgyOCA4Ni42MjYyIDMxLjAxOTUgODYuMzg4M0MzMS43MDMgODYuMzM0NSAzMi40MjMyIDg2LjgxMiAzMi43ODE0IDg3LjAxMzRMMzQuMTE3NyA4Ni43ODMxQzM3LjE5MjYgOTYuMzYxMyA0My42MzY2IDEwNC4xMDMgNTEuNzk2MyAxMDguOTYxTDUxLjIzOTYgMTEwLjMwM0M1MS40NDAzIDExMC44MjQgNTEuNjYxNiAxMTEuNTMgNTEuNTEyMSAxMTIuMDQ1QzUwLjkxNzEgMTEzLjU5NSA0OS44OTggMTE1LjIzMSA0OC43Mzc0IDExNy4wNTVDNDguMTc1NSAxMTcuODk4IDQ3LjYwMDQgMTE4LjU1MiA0Ny4wOTM0IDExOS41MTZDNDYuOTcyIDExOS43NDcgNDYuODE3NSAxMjAuMTAyIDQ2LjcwMDQgMTIwLjM0NkM0NS45MTI1IDEyMi4wMzkgNDYuNDkwNCAxMjMuOTkgNDguMDAzOCAxMjQuNzIyQzQ5LjUyNjggMTI1LjQ1OSA1MS40MTcxIDEyNC42ODIgNTIuMjM1MiAxMjIuOTg1QzUyLjIzNjQgMTIyLjk4MiA1Mi4yNDA2IDEyMi45OCA1Mi4yNDE3IDEyMi45NzhDNTIuMjQyNiAxMjIuOTc2IDUyLjI0MDkgMTIyLjk3MyA1Mi4yNDE3IDEyMi45NzFDNTIuMzU4MiAxMjIuNzMxIDUyLjUyMzMgMTIyLjQxNSA1Mi42MjE2IDEyMi4xODhDNTMuMDU2IDEyMS4xODkgNTMuMjAwNSAxMjAuMzMyIDUzLjUwNTkgMTE5LjM2NUM1NC4zMTcgMTE3LjMxOCA1NC43NjI2IDExNS4xNyA1NS44NzkxIDExMy44MzJDNTYuMTg0OSAxMTMuNDY2IDU2LjY4MzMgMTEzLjMyNSA1Ny4yMDAxIDExMy4xODZMNTcuODk0NCAxMTEuOTIyQzY1LjAwOCAxMTQuNjY1IDcyLjk3MDUgMTE1LjQwMiA4MC45MjQ1IDExMy41ODdDODIuNzM5MSAxMTMuMTczIDg0LjQ5MDggMTEyLjYzNyA4Ni4xODQzIDExMS45OTRDODYuMzc5NCAxMTIuMzQyIDg2Ljc0MiAxMTMuMDExIDg2LjgzOTMgMTEzLjE3OUM4Ny4zNjQ0IDExMy4zNTEgODcuOTM3NyAxMTMuNDM5IDg4LjQwNDcgMTE0LjEzM0M4OS4yNDAxIDExNS41NjcgODkuODExNCAxMTcuMjYzIDkwLjUwNzMgMTE5LjMxMkM5MC44MTI4IDEyMC4yNzkgOTAuOTYzOCAxMjEuMTM2IDkxLjM5ODEgMTIyLjEzNkM5MS40OTcxIDEyMi4zNjMgOTEuNjYxNCAxMjIuNjg0IDkxLjc3OCAxMjIuOTI1QzkyLjU5NDQgMTI0LjYyOCA5NC40OTA3IDEyNS40MDcgOTYuMDE1OSAxMjQuNjY5Qzk3LjUyOTIgMTIzLjkzNyA5OC4xMDc3IDEyMS45ODYgOTcuMzE5NCAxMjAuMjkzQzk3LjIwMjMgMTIwLjA0OSA5Ny4wNDEyIDExOS42OTUgOTYuOTE5OCAxMTkuNDY0Qzk2LjQxMjcgMTE4LjQ5OSA5NS44Mzc3IDExNy44NTIgOTUuMjc1OCAxMTcuMDA5Qzk0LjExNTIgMTE1LjE4NSA5My4xNTI2IDExMy42NyA5Mi41NTc1IDExMi4xMkM5Mi4zMDg3IDExMS4zMiA5Mi41OTk1IDExMC44MjMgOTIuNzkzMyAxMTAuMzAzQzkyLjY3NzIgMTEwLjE3IDkyLjQyODggMTA5LjQxNCA5Mi4yODI0IDEwOS4wNTlDMTAwLjc2MiAxMDQuMDI5IDEwNy4wMTcgOTUuOTk4NSAxMDkuOTU1IDg2LjcyMzlDMTEwLjM1MSA4Ni43ODY1IDExMS4wNDEgODYuOTA5MSAxMTEuMjY1IDg2Ljk1NDJDMTExLjcyNiA4Ni42NDg3IDExMi4xNDkgODYuMjUwMSAxMTIuOTgxIDg2LjMxNTlDMTE0LjYxNyA4Ni41NTM3IDExNi4yOTcgODcuMTY0NSAxMTguMzI2IDg3Ljg5NTNDMTE5LjI2OCA4OC4yNTgxIDEyMC4wMjggODguNjc5MyAxMjEuMDc3IDg4Ljk2MTRDMTIxLjI5OCA4OS4wMjEgMTIxLjYxNiA4OS4wNzY2IDEyMS44NjkgODkuMTMyNUMxMjEuODg5IDg5LjEzNzUgMTIxLjkwOCA4OS4xNDc1IDEyMS45MjggODkuMTUyMkMxMjEuOTQyIDg5LjE1NTMgMTIxLjk2MSA4OS4xNTU4IDEyMS45NzQgODkuMTU4OEMxMjMuNzkyIDg5LjU1MiAxMjUuNTU3IDg4LjU1MjYgMTI1LjkzIDg2LjkwODFDMTI2LjMwMyA4NS4yNjQxIDEyNS4xNDMgODMuNTk1MiAxMjMuMzM2IDgzLjE1N0MxMjMuMDc0IDgzLjA5NyAxMjIuNzAxIDgyLjk5NSAxMjIuNDQ2IDgyLjk0NjVDMTIxLjM3OSA4Mi43NDM1IDEyMC41MTEgODIuNzkzNSAxMTkuNTA1IDgyLjcwOTVDMTE3LjM2MSA4Mi40ODM5IDExNS41ODYgODIuMzAwNCAxMTQuMDA5IDgxLjgwMTRDMTEzLjM2NiA4MS41NTA3IDExMi45MDggODAuNzgxOSAxMTIuNjg2IDgwLjQ2NTVMMTExLjQ0OCA4MC4xMDM1QzExMi4wOSA3NS40MzggMTExLjkxNyA3MC41ODI1IDExMC44MDYgNjUuNzI0M0MxMDkuNjg1IDYwLjgyMDggMTA3LjcwNCA1Ni4zMzYxIDEwNS4wNjIgNTIuMzg0OEMxMDUuMzc5IDUyLjA5NDggMTA1Ljk3OSA1MS41NjEyIDEwNi4xNDkgNTEuNDA0M0MxMDYuMTk5IDUwLjg1MTcgMTA2LjE1NiA1MC4yNzIyIDEwNi43MjUgNDkuNjYwM0MxMDcuOTMxIDQ4LjUyMyAxMDkuNDUxIDQ3LjU3OTkgMTExLjI4NCA0Ni40NDIzQzExMi4xNTQgNDUuOTI3OSAxMTIuOTU5IDQ1LjU5NjQgMTEzLjgzMiA0NC45NDg0QzExNC4wMyA0NC44MDE5IDExNC4yOTkgNDQuNTY5OSAxMTQuNTA3IDQ0LjQwMjJDMTE1Ljk3NyA0My4yMjM3IDExNi4zMTYgNDEuMTkxMSAxMTUuMjYgMzkuODYxNEMxMTQuMjA0IDM4LjUzMTcgMTEyLjE1OSAzOC40MDY1IDExMC42ODggMzkuNTg1QzExMC40NzkgMzkuNzUxNiAxMTAuMTk1IDM5Ljk2ODggMTEwLjAwNyA0MC4xMzEyQzEwOS4xODQgNDAuODQyNiAxMDguNjc2IDQxLjU0NTIgMTA3Ljk4MyA0Mi4yODMyQzEwNi40NzEgNDMuODI1OSAxMDUuMjIyIDQ1LjExMyAxMDMuODUgNDYuMDQwOUMxMDMuMjU1IDQ2LjM4ODUgMTAyLjM4NSA0Ni4yNjgyIDEwMS45OSA0Ni4yNDQ5TDEwMC44MjQgNDcuMDgwNkM5NC4xNzUzIDQwLjA3NjMgODUuMTIzNSAzNS41OTgyIDc1LjM3NjYgMzQuNzI4M0M3NS4zNDk0IDM0LjMxNzkgNzUuMzEzNyAzMy41NzYxIDc1LjMwNDYgMzMuMzUyOUM3NC45MDU2IDMyLjk2OTMgNzQuNDIzNSAzMi42NDE4IDc0LjMwMjQgMzEuODEzQzc0LjE2OTEgMzAuMTU2OSA3NC4zOTE3IDI4LjM3NTIgNzQuNjQ5NiAyNi4yMjU4Qzc0Ljc5MTkgMjUuMjIxNiA3NS4wMjg0IDI0LjM4NzMgNzUuMDY4OCAyMy4yOTczQzc1LjA3OCAyMy4wNDk1IDc1LjA2MzIgMjIuNjkgNzUuMDYyMiAyMi40MjIxQzc1LjA2MiAyMC41MzIyIDczLjY4OTggMTguOTk5OCA3MS45OTY4IDE5Wk02OC4xNTg1IDQyLjg4ODZMNjcuMjQ4IDU5LjA0NDdMNjcuMTgyNSA1OS4wNzc2QzY3LjEyMTQgNjAuNTIyOSA2NS45Mzc1IDYxLjY3NyA2NC40ODM5IDYxLjY3N0M2My44ODg0IDYxLjY3NyA2My4zMzg4IDYxLjQ4NDkgNjIuODkyMiA2MS4xNTcxTDYyLjg2NiA2MS4xNzAzTDQ5LjY4MDcgNTEuNzc5NEM1My43MzMxIDQ3Ljc3NTkgNTguOTE2NCA0NC44MTcyIDY0Ljg5IDQzLjQ1NDZDNjUuOTgxMiA0My4yMDU2IDY3LjA3MTkgNDMuMDIwOSA2OC4xNTg1IDQyLjg4ODZaTTc1Ljg0MTcgNDIuODg4NkM4Mi44MTU5IDQzLjc1MDQgODkuMjY1NyA0Ni45MjMyIDk0LjIwODEgNTEuNzg2TDgxLjEwOCA2MS4xMTc2TDgxLjA2MjEgNjEuMDk3OUM3OS44OTk0IDYxLjk1MTIgNzguMjYxMSA2MS43Mzk0IDc3LjM1NDggNjAuNTk3OEM3Ni45ODM1IDYwLjEzMDEgNzYuNzg4NyA1OS41ODAxIDc2Ljc2NTMgNTkuMDI0OUw3Ni43NTIyIDU5LjAxODRMNzUuODQxNyA0Mi44ODg2Wk00NC44OTkxIDU3LjgxNEw1Ni45MzgyIDY4LjYzM0w1Ni45MjUxIDY4LjY5ODhDNTguMDExNyA2OS42NDc5IDU4LjE3MiA3MS4yOTQ5IDU3LjI2NTcgNzIuNDM2OEM1Ni44OTQ0IDcyLjkwNDUgNTYuMzk3NSA3My4yMTgyIDU1Ljg2MzkgNzMuMzY0N0w1NS44NTA4IDczLjQxNzNMNDAuNDE4OCA3Ny44OTIzQzM5LjYzMzQgNzAuNjc2NSA0MS4zMjYxIDYzLjY2MjEgNDQuODk5MSA1Ny44MTRaTTk5LjAwOTQgNTcuODIwNkMxMDAuNzk4IDYwLjczMzYgMTAyLjE1MyA2My45ODcxIDEwMi45NTkgNjcuNTE0M0MxMDMuNzU2IDcwLjk5OTEgMTAzLjk1NiA3NC40Nzc4IDEwMy42MjcgNzcuODM5N0w4OC4xMTY2IDczLjM1MTVMODguMTAzNSA3My4yODU3Qzg2LjcxNDUgNzIuOTA0MyA4NS44NjA5IDcxLjQ4NDggODYuMTg0MyA3MC4wNjExQzg2LjMxNjggNjkuNDc3OCA4Ni42MjQ5IDY4Ljk4NDQgODcuMDQyMyA2OC42MTk4TDg3LjAzNTggNjguNTg2OUw5OS4wMDk0IDU3LjgyMDZaTTY5LjUyNzQgNjkuNDY4OEg3NC40NTk2TDc3LjUyNTEgNzMuMzE4Nkw3Ni40MjQ3IDc4LjEyMjZMNzEuOTk2OCA4MC4yNjE0TDY3LjU1NTggNzguMTE2MUw2Ni40NTU0IDczLjMxMkw2OS41Mjc0IDY5LjQ2ODhaTTg1LjMzOTMgODIuNjQzN0M4NS41NDg5IDgyLjYzMzEgODUuNzU3NiA4Mi42NTIgODUuOTYxNiA4Mi42ODk4TDg1Ljk4NzggODIuNjU2OUwxMDEuOTUgODUuMzY4MkM5OS42MTQyIDkxLjk2MjQgOTUuMTQ0IDk3LjY3NSA4OS4xNzExIDEwMS40OThMODIuOTc0NyA4Ni40NjA2TDgyLjk5NDQgODYuNDM0M0M4Mi40MjUyIDg1LjEwNTUgODIuOTk0OCA4My41NDcyIDg0LjMwNDQgODIuOTEzNUM4NC42Mzk3IDgyLjc1MTMgODQuOTkgODIuNjYxNCA4NS4zMzkzIDgyLjY0MzdaTTU4LjUyOTggODIuNzA5NUM1OS43NDggODIuNzI2NyA2MC44NDA2IDgzLjU3NjEgNjEuMTIzNyA4NC44MjJDNjEuMjU2MiA4NS40MDUyIDYxLjE5MTcgODUuOTgzMSA2MC45NzMgODYuNDkzNUw2MS4wMTg5IDg2LjU1MjdMNTQuODg4IDEwMS40MzlDNDkuMTU1OSA5Ny43NDMyIDQ0LjU5MDQgOTIuMjA5OSA0Mi4xNDgxIDg1LjQyMDhMNTcuOTczMSA4Mi43MjI3TDU3Ljk5OTMgODIuNzU1NkM1OC4xNzYzIDgyLjcyMjkgNTguMzU1OCA4Mi43MDcxIDU4LjUyOTggODIuNzA5NVpNNzEuODk4NiA4OS4yMzEyQzcyLjMyMjkgODkuMjE1NSA3Mi43NTM0IDg5LjMwMyA3My4xNjI3IDg5LjUwMUM3My42OTkyIDg5Ljc2MDYgNzQuMTEzNiA5MC4xNjkyIDc0LjM3NDUgOTAuNjU5Mkg3NC40MzM0TDgyLjIzNDYgMTA0LjgyMUM4MS4yMjIxIDEwNS4xNjIgODAuMTgxMyAxMDUuNDU0IDc5LjExNjcgMTA1LjY5N0M3My4xNTA1IDEwNy4wNTggNjcuMjAzMiAxMDYuNjQ1IDYxLjgxOCAxMDQuODAyTDY5LjU5OTUgOTAuNjY1OEg2OS42MTI2QzcwLjA3OTUgODkuNzg4OCA3MC45NjUgODkuMjY1NiA3MS44OTg2IDg5LjIzMTJaIiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIwLjI1Ii8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNjgxXzI4NDUiIHgxPSIxMCIgeTE9IjE1LjUiIHgyPSIxNDQiIHkyPSIxMzEuNSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjNEQ4N0ZGIi8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzA1NDdEMCIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo= - keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "storageClass"], ["spec", "version"], ["spec", "host"], ["spec", "substrate"], ["spec", "proxmox"], ["spec", "proxmox", "allowedNodes"], ["spec", "proxmox", "dnsServers"], ["spec", "proxmox", "insecure"], ["spec", "proxmox", "ccm"], ["spec", "proxmox", "ccm", "credentialsSecretName"], ["spec", "proxmox", "csi"], ["spec", "proxmox", "csi", "enabled"], ["spec", "proxmox", "csi", "credentialsSecretName"], ["spec", "proxmox", "csi", "storageClasses"], ["spec", "proxmox", "ipv4Config"], ["spec", "proxmox", "ipv4Config", "addresses"], ["spec", "proxmox", "ipv4Config", "gateway"], ["spec", "proxmox", "ipv4Config", "prefix"], ["spec", "addons"], ["spec", "addons", "certManager"], ["spec", "addons", "certManager", "enabled"], ["spec", "addons", "certManager", "valuesOverride"], ["spec", "addons", "cilium"], ["spec", "addons", "cilium", "valuesOverride"], ["spec", "addons", "gatewayAPI"], ["spec", "addons", "gatewayAPI", "enabled"], ["spec", "addons", "ingressNginx"], ["spec", "addons", "ingressNginx", "enabled"], ["spec", "addons", "ingressNginx", "exposeMethod"], ["spec", "addons", "ingressNginx", "hosts"], ["spec", "addons", "ingressNginx", "valuesOverride"], ["spec", "addons", "gpuOperator"], ["spec", "addons", "gpuOperator", "enabled"], ["spec", "addons", "gpuOperator", "valuesOverride"], ["spec", "addons", "hami"], ["spec", "addons", "hami", "enabled"], ["spec", "addons", "hami", "valuesOverride"], ["spec", "addons", "monitoringAgents"], ["spec", "addons", "monitoringAgents", "enabled"], ["spec", "addons", "monitoringAgents", "valuesOverride"], ["spec", "addons", "verticalPodAutoscaler"], ["spec", "addons", "verticalPodAutoscaler", "valuesOverride"], ["spec", "addons", "velero"], ["spec", "addons", "velero", "enabled"], ["spec", "addons", "velero", "valuesOverride"], ["spec", "addons", "coredns"], ["spec", "addons", "coredns", "valuesOverride"], ["spec", "addons", "ouroboros"], ["spec", "addons", "ouroboros", "enabled"], ["spec", "addons", "ouroboros", "valuesOverride"], ["spec", "controlPlane"], ["spec", "controlPlane", "replicas"], ["spec", "controlPlane", "apiServer"], ["spec", "controlPlane", "apiServer", "resources"], ["spec", "controlPlane", "apiServer", "resourcesPreset"], ["spec", "controlPlane", "apiServer", "extraArgs"], ["spec", "controlPlane", "apiServer", "admissionControllers"], ["spec", "controlPlane", "apiServer", "extraVolumes"], ["spec", "controlPlane", "apiServer", "extraVolumeMounts"], ["spec", "controlPlane", "controllerManager"], ["spec", "controlPlane", "controllerManager", "resources"], ["spec", "controlPlane", "controllerManager", "resourcesPreset"], ["spec", "controlPlane", "scheduler"], ["spec", "controlPlane", "scheduler", "resources"], ["spec", "controlPlane", "scheduler", "resourcesPreset"], ["spec", "controlPlane", "konnectivity"], ["spec", "controlPlane", "konnectivity", "server"], ["spec", "controlPlane", "konnectivity", "server", "resources"], ["spec", "controlPlane", "konnectivity", "server", "resourcesPreset"], ["spec", "controlPlane", "kubelet"], ["spec", "controlPlane", "kubelet", "preferredAddressTypes"], ["spec", "oidc"], ["spec", "oidc", "mode"], ["spec", "oidc", "customConfig"], ["spec", "oidc", "customConfig", "config"], ["spec", "oidc", "customConfig", "secretRef"], ["spec", "oidc", "customConfig", "secretRef", "name"], ["spec", "oidc", "users"], ["spec", "schedulingClass"]] + keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "storageClass"], ["spec", "version"], ["spec", "host"], ["spec", "substrate"], ["spec", "proxmox"], ["spec", "proxmox", "allowedNodes"], ["spec", "proxmox", "dnsServers"], ["spec", "proxmox", "insecure"], ["spec", "proxmox", "ccm"], ["spec", "proxmox", "ccm", "credentialsSecretName"], ["spec", "proxmox", "csi"], ["spec", "proxmox", "csi", "enabled"], ["spec", "proxmox", "csi", "credentialsSecretName"], ["spec", "proxmox", "csi", "storageClasses"], ["spec", "proxmox", "ipv4Config"], ["spec", "proxmox", "ipv4Config", "addresses"], ["spec", "proxmox", "ipv4Config", "gateway"], ["spec", "proxmox", "ipv4Config", "prefix"], ["spec", "addons"], ["spec", "addons", "certManager"], ["spec", "addons", "certManager", "enabled"], ["spec", "addons", "certManager", "valuesOverride"], ["spec", "addons", "cilium"], ["spec", "addons", "cilium", "valuesOverride"], ["spec", "addons", "gatewayAPI"], ["spec", "addons", "gatewayAPI", "enabled"], ["spec", "addons", "ingressNginx"], ["spec", "addons", "ingressNginx", "enabled"], ["spec", "addons", "ingressNginx", "exposeMethod"], ["spec", "addons", "ingressNginx", "hosts"], ["spec", "addons", "ingressNginx", "valuesOverride"], ["spec", "addons", "gpuOperator"], ["spec", "addons", "gpuOperator", "enabled"], ["spec", "addons", "gpuOperator", "valuesOverride"], ["spec", "addons", "hami"], ["spec", "addons", "hami", "enabled"], ["spec", "addons", "hami", "valuesOverride"], ["spec", "addons", "monitoringAgents"], ["spec", "addons", "monitoringAgents", "enabled"], ["spec", "addons", "monitoringAgents", "valuesOverride"], ["spec", "addons", "verticalPodAutoscaler"], ["spec", "addons", "verticalPodAutoscaler", "valuesOverride"], ["spec", "addons", "velero"], ["spec", "addons", "velero", "enabled"], ["spec", "addons", "velero", "valuesOverride"], ["spec", "addons", "coredns"], ["spec", "addons", "coredns", "valuesOverride"], ["spec", "addons", "ouroboros"], ["spec", "addons", "ouroboros", "enabled"], ["spec", "addons", "ouroboros", "valuesOverride"], ["spec", "controlPlane"], ["spec", "controlPlane", "replicas"], ["spec", "controlPlane", "apiServer"], ["spec", "controlPlane", "apiServer", "resources"], ["spec", "controlPlane", "apiServer", "resourcesPreset"], ["spec", "controlPlane", "apiServer", "extraArgs"], ["spec", "controlPlane", "apiServer", "admissionControllers"], ["spec", "controlPlane", "apiServer", "extraVolumes"], ["spec", "controlPlane", "apiServer", "extraVolumeMounts"], ["spec", "controlPlane", "controllerManager"], ["spec", "controlPlane", "controllerManager", "resources"], ["spec", "controlPlane", "controllerManager", "resourcesPreset"], ["spec", "controlPlane", "scheduler"], ["spec", "controlPlane", "scheduler", "resources"], ["spec", "controlPlane", "scheduler", "resourcesPreset"], ["spec", "controlPlane", "konnectivity"], ["spec", "controlPlane", "konnectivity", "server"], ["spec", "controlPlane", "konnectivity", "server", "resources"], ["spec", "controlPlane", "konnectivity", "server", "resourcesPreset"], ["spec", "controlPlane", "kubelet"], ["spec", "controlPlane", "kubelet", "preferredAddressTypes"], ["spec", "etcd"], ["spec", "etcd", "replicas"], ["spec", "oidc"], ["spec", "oidc", "mode"], ["spec", "oidc", "customConfig"], ["spec", "oidc", "customConfig", "config"], ["spec", "oidc", "customConfig", "secretRef"], ["spec", "oidc", "customConfig", "secretRef", "name"], ["spec", "oidc", "users"], ["spec", "schedulingClass"]] secrets: exclude: [] include: