|
Dies ist eine unveröffentlichte Dokumentation für Admission Controller 1.38-dev. |
Community Kubewarden v1.36 to SUSE Security v1.37 (Fleet)
This guide shows how to migrate an existing Fleet-managed Kubewarden installation based on the legacy three-chart setup in v1.36 to the unified SUSE Security Admission Controller chart in v1.37.
There are two ways to migrate:
-
A downtime migration: reinstall the stack from scratch, with the cluster unprotected meanwhile.
-
A no-downtime migration: handing over the deployed resources from the legacy Helm releases to the new one. There is no policy enforcement gap nor data loss.
Cross-vendor changes
Starting from Admission Controller 1.37, a single Helm chart,
suse-security-admission-controller 1.0.0, manages the whole stack. Compared to the
legacy three charts:
-
There is no need for a staggered install order between charts anymore, so the
dependsOnordering between the legacy Fleet bundles disappears. -
The new chart values are the flat union of the values of the three legacy charts. You can concatenate your existing values files into a single values file.
-
The SUSE Security Admission Controller chart uses different conventions for image registries and pull secrets compared to the community charts.
| Aspect | Community charts (source) | SUSE Security Admission Controller chart (target) |
|---|---|---|
Helm releases |
Three independent releases: |
One release: |
Chart source |
|
|
Image registry key |
|
|
Pull secrets key |
|
|
Component images |
|
|
Policy module registry |
|
|
Values shape |
Three separate files, one per chart |
One flat file covering all components |
To validate the new Values file, you can run:
helm pull oci://dp.apps.rancher.io/charts/suse-security-admission-controller --version 1.0.0 --untar
helm lint suse-security-admission-controller -f new-values.yaml
|
The SUSE Security Admission Controller chart does not read Note that the SUSE Security Admission Controller chart also reads a top-level |
Downtime migration
Prerequisites
-
Access token or Service Account already set up for SUSE Application Collection. See the Application Collection authentication documentation for how to obtain credentials.
-
The three community charts must be at version Kubewarden Admission Controller v1.36 before starting. As described in the Kubewarden upgrade path documentation, version jumping isn’t allowed.
-
Backup of your policies without committing them to Fleet, as their CRDs will be removed as part of 1.36 uninstallation.
-
values.yaml for the new chart. Concatenate the values of the three legacy charts to form the new values for the
admission-controllerchart. Only the.globalvalues are repeated, make sure that there aren’t any collisions between them.-
Amend the values as provided in the [#what-changes] section, either setting the new values or cleaning up old values for those keys.
-
-
New chart Namespace (optional). This migration is the only one that allows for a Namespace change.
-
A Fleet
GitRepodeploying the three legacy bundles, and push access to its git repository. -
The SUSE Security Admission Controller chart available at appVersion
1.37.0(fromoci://dp.apps.rancher.io/charts/suse-security-admission-controller).
Migration
Remove the three legacy bundles from the git repository watched by Fleet, and wait for Fleet to uninstall them. Uninstalling 1.36 removes the CRDs and the user-managed policies and PolicyServers.
Add a bundle for the suse-security-admission-controller chart, using the
concatenated values of the three legacy charts.
If wanted, deploy the new chart in a different Namespace. If changing the Namespace,
remember to create a new Secret for pulling from Application Collection.
Finally, restore your policies by committing them back into Git.
Between the removal of the legacy bundles and the restore, admission requests are not validated. You can use the Audit Scanner after the migration to identify resources that entered the cluster during that window.
No-downtime migration
For this migration we hand over the resources from the legacy releases to the new one, using two Fleet/Helm mechanisms:
-
keepResources: true(fleet.yaml, bundle level): when the bundle is later removed from the git repository, Fleet abandons the deployment instead of runninghelm uninstall. All deployed resources stay in the cluster. -
helm.takeOwnership: true(fleet.yaml, Helm options): the new chart is installed ignoring Helm’s ownership checks, adopting the resources left behind by the legacy releases.
The migration is done as a sequence of git commits in the repository watched by
Fleet, one commit per step. We will pin the Fleet GitRepo to a commit with
spec.revision and move it forward one commit at a time, verifying each step.
Given that we hand over the resources from the old 3 Helm releases to the new one, we are forced to keep the same Namespace that was used for the legacy charts.
Prerequisites
-
Access token or Service Account already set up for SUSE Application Collection. See the Application Collection authentication documentation for how to obtain credentials.
-
The three community charts must be at version Kubewarden Admission Controller v1.36 before starting. As described in the Kubewarden upgrade path documentation, version jumping isn’t allowed.
-
values.yaml for the new chart. Concatenate the values of the three legacy charts to form the new values for the
admission-controllerchart. Only the.globalvalues are repeated, make sure that there aren’t any collisions between them.-
Amend the values as provided in the [#what-changes] section, either setting the new values or cleaning up old values for those keys.
-
-
The Namespace inherited from the legacy charts cannot be changed, given Helm constraints.
-
A Fleet
GitRepodeploying the three legacy bundles, and push access to its git repository. -
The SUSE Security Admission Controller chart available at appVersion
1.37.0(fromoci://dp.apps.rancher.io/charts/suse-security-admission-controller). -
kubectl(and optionallyhelm) access to the downstream cluster, for verification and cleanup.
Migration commits
Create the following commits in your Fleet repository, in this order.
Commit 0: legacy v1.36 bundles installed
<commit-0-sha> is the starting point. We have Kubewarden Admission Controller installed
in v1.36 with your own values, and we pin our GitRepo per-commit instead
of following a branch:
spec:
repo: https://github.com/<your-org>/<your-fleet-repo>
revision: <commit-0-sha>
# branch: main # make sure spec.branch is commented out
paths: [...]
|
Ensure only |
Commit 1: prepare for uninstall of the legacy v1.36 bundles
In this commit <commit-1-sha>:
-
Add
keepResources: trueto the three legacy bundles:
# kubewarden-crds, kubewarden-controller and kubewarden-defaults fleet.yaml
defaultNamespace: cattle-kubewarden-system
keepResources: true
-
Disable the policy-reporter subchart in the values of the
kubewarden-controllerbundle:
helm:
values:
auditScanner:
policyReporter: false
This takes care of not having any immutable fields that will not change with
the release name handover. Both policy-reporter and policy-reporter-ui
Deployments embed the Helm release name in spec.selector, which is immutable
on Deployments. Disabling the subchart makes the legacy release delete both
Deployments now, so the new chart can recreate them fresh later. Both are
stateless; this only pauses report collection during the migration window.
Commit 2: remove the legacy bundles
In this commit <commit-2-sha>, delete the directories of the three legacy
bundles from the repository. When deployed, Fleet leaves the three Helm
releases unmanaged because we have set keepResources: true.
After applying commit 2, helm ls -A still lists the three legacy releases.
This is expected: keepResources: true skips helm uninstall entirely, and
only the Helm release secrets (sh.helm.release.v1.*) remain, as inert
bookkeeping. They are cleaned up after the migration.
Commit 3: add the suse-security-admission-controller bundle
In this <commit-3-sha>:
-
Add a new bundle for the
suse-security-admission-controllerchart, withtakeOwnershipenabled and the concatenated values of the three legacy charts:
defaultNamespace: cattle-kubewarden-system
helm:
releaseName: suse-security-admission-controller
chart: suse-security-admission-controller
repo: oci://dp.apps.rancher.io/charts/suse-security-admission-controller
version: 1.0.0
# Adopt the resources left behind by the legacy releases:
takeOwnership: true
values:
# flat union of the values of the 3 legacy charts, with minimal changes
...
-
Re-enable the policy-reporter subchart in the values of the
suse-security-admission-controllerbundle:
helm:
values:
auditScanner:
policyReporter: true
When deployed, the new release adopts the kept resources.
Run the migration
Move spec.revision forward, one commit at a time
(<commit-0-sha>,<commit-1-sha>, <commit-2-sha>, <commit-3-sha>,
<commit-4-sha>). After each commit, wait until all bundles are Ready before
continuing:
kubectl get bundles -n fleet-local
kubectl get gitrepos -n fleet-local
Clean up
Once the suse-security-admission-controller bundle is Ready, remove the
leftovers from the legacy releases:
-
The stale Helm release bookkeeping. Remove it by deleting the release Secrets. These Secrets are in the namespace where you deployed the v1.36 Helm charts, and are of type
helm.sh/release.v1. For example:
kubectl delete secret -n kubewarden -l owner=helm,name=kubewarden-controller
kubectl delete secret -n kubewarden -l owner=helm,name=kubewarden-crds
kubectl delete secret -n kubewarden -l owner=helm,name=kubewarden-defaults
|
Never run |
-
The resources whose names derive from the legacy release names.
takeOwnershiponly adopts resources whose names match the new chart’s rendered manifests, so these keep running, orphaned, next to their new counterparts. Remove them manually:
kubectl delete -n kubewarden \
deployment/kubewarden-controller \
service/kubewarden-controller-webhook-service \
serviceaccount/kubewarden-controller \
configmap/kubewarden-controller-manager-config
This is safe: the new controller is already running, and the webhook configurations were adopted and point at the new service.
Verify
helm ls -A # only the admission-controller release remains
kubectl get bundles -n fleet-local # all Ready
kubectl get pods -n kubewarden
kubectl get clusteradmissionpolicies # policies survived
At no point during the migration were the webhook configurations deleted, so there was no window without policy enforcement. The following were handed over cleanly:
-
The Kubewarden CRDs (and every custom resource, i.e. all policies)
-
The
defaultPolicyServer and its resources -
The Validating/Mutating webhook configurations
The PolicyServer and the recommended policies are no longer managed as Helm
resources: the new chart ships them in the kubewarden-defaults ConfigMap,
and the controller applies them at runtime.
Troubleshooting
Fleet retries failed bundles with a backoff. After fixing a problem, force an immediate retry with:
kubectl patch gitrepo -n fleet-local <gitrepo-name> --type=merge \
-p '{"spec":{"forceSyncGeneration":1}}'
Commit 3 fails with spec.selector: field is immutable
Deployment.apps "policy-reporter" is invalid: spec.selector: field is immutable
The policy-reporter subchart was still enabled when the legacy bundles were removed (commit 1 was skipped or incomplete), so its Deployments were kept and cannot be adopted. Delete them and force a sync; the new release recreates them:
kubectl delete deployment policy-reporter policy-reporter-ui -n kubewarden