Skip to content

Feature Request: Allow users to specify policies that also apply to kubewarden namespace #1201

@sventenraa

Description

@sventenraa

Is your feature request related to a problem?

Currently the kubewarden-controller adds an exclusion rule to all webhookconfigurations to ignore the namespace in which kubewarden itself is running.

We would like a feature toggle to be added to allow policies to bypass this anti-lockout mechanism so that some resources can be protected/mutated even in the kubewarden namespace.

The implementation would ideally introduce a feature toggle on the clusteradmissionpolicy resource that is evaluated for true false in

func (r *policySubReconciler) namespaceSelector(policy policiesv1.Policy) *metav1.LabelSelector {
(with a default of apply the exclusion of kubewarden namespace).

Solution you'd like

So flow would be:

apiVersion: policies.kubewarden.io/v1
kind: ClusterAdmissionPolicy
metadata:
  name: loadbalancerdeny
spec:
  module: registry://<registry>v0.0.1
  settings: {}
  rules:
  - apiGroups:
    - ''
    apiVersions:
    - v1
    resources:
    - namespaces
    operations:
    - CREATE
    - UPDATE
  mutating: false
  defaultexclusion: true

If you don't want the webhook to have the deployed namespace for kubewarden excluded.
This setting would default to false if not specified and thereby allow current users to experience existing behaviour of kubewarden.

Alternatives you've considered

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions