Skip to content

Tenant provisioning

A tenant is a directory environments/arbutus/kestrel/<cluster>/tenants/<RAP-group>/ in ubernetes-applications holding one values.yaml. The rcs-tenants ApplicationSet turns each directory into an Application tenant-<rap-group-lowercased> that renders charts/tenant (0.4.x):

  • Tenant: named after the directory lowercased (CCInternal-RAID/ → ccinternal-raid), with forceTenantPrefix and preventDeletion: true. namespaceOptions is unset, so there is no namespace-count limit.

  • TenantOwner: group oidc:<RAP-group> with the directory’s case preserved (oidc:CCInternal-RAID), ClusterRole admin.

  • ResourcePool: named after the tenant, sized by resourcePool.tier.

  • CertificateRequestPolicies, only when enabled (both default to false):

    • <tenant> when certificateRequestPolicy.enabled: true: <tenant>.kestrel.arbutus.cloud and *.<tenant>.kestrel.arbutus.cloud from the letsencrypt-* ClusterIssuers.
    • <tenant>-namespaced-issuers when certificateRequestPolicy.namespacedIssuers.enabled: true: any name from Issuers in the tenant’s namespaces (custom domains).

    Each comes with a cert-manager-policy:<name> ClusterRole and ClusterRoleBinding. Without a policy, approver-policy never approves the tenant’s CertificateRequests.

Not rendered by the chart:

  • The default-deny NetworkPolicy, its allow rules, and the default-limits LimitRange come from Capsule GlobalTenantResources in environments/arbutus/kestrel/default/addons/capsule/.
  • The ArgoCD AppProject <tenant> comes from the tenant-onboarding ArgoTranslator (environments/default/addons/capsule-argo-addon/argo-translator.yaml).
  • Storage classes and the traefik IngressClass are cluster addons.
  • You have cluster-admin on the target cluster.
  • You have the exact Cloud RAP group name, case included (for example CCInternal-RAID). It becomes the directory name.
  • The requesting PI or lead is in the RCS intake tracker.
  1. In the Keycloak admin console (keycloak.arbutus.alliancecan.ca, realm atmosphere, shared with other Arbutus services), confirm a group named exactly after the RAP group exists, or create it.
  2. Add the initial members (at least the requesting PI or lead).

Create environments/arbutus/kestrel/kestrel-prod/tenants/<RAP-group>/values.yaml. A file containing only --- is a valid tenant, but it gets no certificates. Most tenants need platform certificates:

---
certificateRequestPolicy:
enabled: true
namespacedIssuers:
enabled: false # true only when the tenant has asked for custom-domain certificates

Kestrel defaults come from environments/arbutus/kestrel/default/tenants/values.yaml: the three allowed priority classes, and resourcePool enabled at tier standard. Override per tenant only what differs:

  • resourcePool.tier: sandbox, standard, premium, or custom with resourcePool.quota.hard.
  • extraObjects: for example a static ReadWriteMany PersistentVolume labelled capsule.clastix.io/tenant: <tenant> (see mlp-explorer).

Merge. ArgoCD picks up the change on its next Git poll (about 3 minutes) and syncs tenant-<rap-group-lowercased>.

<tenant> is the lowercased name.

  1. kubectl get tenant <tenant>: STATE Active, READY True.

  2. The owner group can create namespaces. --as-group needs --as; any placeholder user works. Keep the group’s case:

    Terminal window
    kubectl auth can-i create namespace --as=test-user --as-group='oidc:<RAP group>' # yes
  3. kubectl get certificaterequestpolicy <tenant> (and <tenant>-namespaced-issuers if enabled) exists and is READY True.

  4. kubectl describe resourcepool <tenant> shows the tier’s limits.

  5. kubectl get argotranslator tenant-onboarding is Ready. If it isn’t, list per-tenant errors:

    Terminal window
    kubectl get argotranslator tenant-onboarding \
    -o jsonpath='{range .status.tenants[*]}{.name}{": "}{.condition.message}{"\n"}{end}'
  6. The tenant’s AppProject lists the owner group, without the oidc: prefix:

    Terminal window
    kubectl -n argo-cd get appproject <tenant> -o jsonpath='{.spec.roles[*].groups}'
  7. Ask the tenant lead to log in and run kubectl create namespace <tenant>-test. This exercises Keycloak → capsule-proxy → Capsule → RBAC end to end.

  1. Delete the tenant’s namespaces. This deletes their PVCs; volumes on csi-cinder-sc-retain remain as Released PVs to dispose of separately.

  2. Remove the tenants/<RAP-group>/ directory and merge. The ApplicationSet sets preserveResourcesOnDeletion: true, so this deletes the Application but leaves its resources orphaned.

  3. Delete the orphaned resources:

    Terminal window
    kubectl patch tenant <tenant> --type merge -p '{"spec":{"preventDeletion":false}}'
    kubectl delete tenant <tenant>
    kubectl delete resourcepool <tenant>
    kubectl delete tenantowner -l projectcapsule.dev/tenant=<tenant> # names carry a hash suffix
    kubectl delete certificaterequestpolicy <tenant> <tenant>-namespaced-issuers --ignore-not-found
    kubectl delete clusterrole,clusterrolebinding \
    cert-manager-policy:<tenant> cert-manager-policy:<tenant>-namespaced-issuers --ignore-not-found

    Also delete anything the tenant had in extraObjects, such as static PVs.

  4. Verify that kubectl get tenant no longer lists it and kubectl -n argo-cd get appproject <tenant> is gone.

  5. Disable (don’t delete) the Keycloak group, to keep the audit trail.