Skip to content

Conversation

viccuad
Copy link
Member

@viccuad viccuad commented Jun 27, 2025

Part of https://github.com/rancher/kubewarden/issues/7.

This PR adds Kubewarden resources to the basic resourceset (without Secrets) and the default resourceset (with Secrets).

This comprises:

  • The default Rancher Namespace catttle-kubewarden-system (or
    cattle-kubewarden-*), and the default Kubewarden Namespace kubewarden.
  • Kubewarden needed resources installed via the Helm charts.
  • Kubewarden CRDs, which get reconciled after restore by the Kubewarden controller.
  • The policy-reporter subchart of the kubewarden-controller chart, for their
    default values. This doesn't include the Grafana integration nor other plugins.

The backup process doesn't include Secrets created to configure PolicyServers
for private registries unless those are correctly labeled by users.

Tested manually by,
applying also #787
and following the steps under kubewarden/docs#632

Documentation in Kubewarden side under:
kubewarden/docs#632

@viccuad viccuad requested a review from a team as a code owner June 27, 2025 11:56
@viccuad viccuad moved this to Blocked in Kubewarden Jun 27, 2025
@viccuad viccuad force-pushed the feat/add-kubewarden branch from c9913bd to 67ef478 Compare June 30, 2025 10:17
@viccuad
Copy link
Member Author

viccuad commented Jun 30, 2025

Rebased, added missing Namespace backups.

@kkaempf kkaempf added this to the 2.13.0 milestone Jul 3, 2025
@kkaempf kkaempf added the kind/enhancement New feature or request label Jul 3, 2025
@viccuad viccuad force-pushed the feat/add-kubewarden branch from 67ef478 to 3e7f9e3 Compare July 8, 2025 12:54
@viccuad
Copy link
Member Author

viccuad commented Jul 8, 2025

Rebased, added policy-reporter subchart Secrets to the sensitive-resourceset-contents in addition to the (soon to be removed) default-resourceset-contents (from info on #787 (review)).

@viccuad viccuad force-pushed the feat/add-kubewarden branch from 3e7f9e3 to 87a65e8 Compare July 9, 2025 09:35
@viccuad
Copy link
Member Author

viccuad commented Jul 9, 2025

Rebased on top of main. Now it adds only to the basic-resourceset-contents and sensitive-resourceset-contents, given that the default-resourceset-contents has been recently dropped.

@juadk
Copy link

juadk commented Jul 23, 2025

Tested and automated by Kubewarden QA here => https://github.com/juadk/helm-charts/actions/runs/16470799097

Copy link
Member

@jbiers jbiers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good. However, I'm worried about the possible performance implications of having so many rules that do not specify a namespace, implying in a query that searches through all resources of that kind in the entire cluster to find the ones which contain the desired label. Usually we avoid rules like that as much as possible and try to be namespace-specific.

I understand it might be the case that the resources you're trying to include could indeed be located in any namespace. If that is the case, I'd like to at least have these new rules be optional, something that only gets added to the ResourceSets if users explicitly opt-in. My suggestion would be adding a flag in the values file like Values.optionalResources.kubewarden.enabled to control that.

If you need assistance in navigating the codebase to implement those changes let us know and we can help!

@viccuad viccuad moved this to In Progress in Kubewarden Sep 17, 2025
@viccuad
Copy link
Member Author

viccuad commented Sep 17, 2025

Thanks for the review! Good point. Applied suggestions, now:

  • The resources to be backed up are further separated
  • Namespaced resources that are user-defined are backed up optionally, with .Values.optionalResources.kubewarden-user-crs.enabled, which is false by default.

@viccuad viccuad requested a review from jbiers September 17, 2025 10:34
@viccuad viccuad moved this from In Progress to Blocked in Kubewarden Sep 17, 2025
@viccuad viccuad moved this from Blocked to Pending review in Kubewarden Sep 22, 2025
@viccuad viccuad moved this from Pending review to Blocked in Kubewarden Sep 22, 2025
@viccuad viccuad moved this from Blocked to In Progress in Kubewarden Sep 24, 2025
@viccuad
Copy link
Member Author

viccuad commented Sep 25, 2025

@jbiers fixed the templating problem introduced with adding the optional Value. The resourcesets are under files/, which doesn't allow to use go templating. Instead of refactoring and moving all the resource sets under files/ into templates/, I have added a conditional in the templates for rancher-resourceset-{basic, full}.yaml . Please tell me if that's a fitting change.

Renamed the new value to optionalResources.kubewardenUserCRs.enabled=true instead of optionalResources.kubewarden-user-crs.enabled.

Added 2 new Hull tests for the change.

@viccuad viccuad moved this from In Progress to Blocked in Kubewarden Sep 25, 2025
@viccuad viccuad force-pushed the feat/add-kubewarden branch from b589707 to 0923e88 Compare September 25, 2025 09:47
@jbiers
Copy link
Member

jbiers commented Sep 26, 2025

@viccuad I opened a PR to your PR (lol) to try to illustrate an approach closer to the behavior I meant by my previous comment: viccuad#1. I only considered the first two commits from your PR which is why my PR shows my branch as stale.

Let me know if that is okay with you.

Also pinging @mallardduck for a review on Monday as my PR changes how the operator builds its ResourceSets so having more people from the team on the know is good.

@viccuad
Copy link
Member Author

viccuad commented Sep 30, 2025

Let me know if that is okay with you.

@jbiers Yes, it's totally ok! Thanks for looking into this. Feel free to drop the redone commits from this PR by force pushing it, or to close it and open a new PR. Looking forward to have this merged.

@jbiers jbiers force-pushed the feat/add-kubewarden branch from 0923e88 to 87a65e8 Compare October 1, 2025 15:16
@jbiers jbiers force-pushed the feat/add-kubewarden branch from 1449e03 to a9c6cae Compare October 1, 2025 15:25
@jbiers jbiers requested a review from mallardduck October 1, 2025 15:26
Copy link
Member

@mallardduck mallardduck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jbiers jbiers merged commit 6f4205a into rancher:main Oct 2, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from Blocked to Done in Kubewarden Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants