projectcapsule / capsule

Multi-tenancy and policy-based framework for Kubernetes.

Home Page:https://capsule.clastix.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When preventDeletion is set to false, the field is removed

sandert-k8s opened this issue · comments

Bug description

preventDeletion is deleted from the tenant spec when it's on false.

How to reproduce

Steps to reproduce the behavior:

  1. Provide the Capsule Tenant YAML definitions
kind: Tenant
metadata:
  name: test-tenant
spec:
  owners:
    - clusterRoles:
        - admin
      kind: Group
      name: test-dev-admin-group
  preventDeletion: false

When preventDeletion is set to false in the tenant spec, this field is deleted in the applied spec, because the default is false. Due to this, some of our tenants keep out of sync in our GitOps tooling (ArgoCD), because Argo tries to add preventDeletion every time, and it gets deleted by Capsule.
Other than that, I think when you specifically set a value (even it's false), it should be added in the config spec.

  • Helm Chart version: (helm list -n capsule-system)
    Helm chart 0.6.2

  • Kubernetes version: (kubectl version)
    OpenShift 4.14.18

You can use this until this is fixed:

  ignoreDifferences:
  - group: capsule.clastix.io
    kind: Tenant
    jqPathExpressions:
      - >-
      - '.spec.preventDeletion'