Tenant provisioning
What a tenant is made of
Section titled “What a tenant is made of”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), withforceTenantPrefixandpreventDeletion: true.namespaceOptionsis unset, so there is no namespace-count limit. -
TenantOwner: groupoidc:<RAP-group>with the directory’s case preserved (oidc:CCInternal-RAID), ClusterRoleadmin. -
ResourcePool: named after the tenant, sized byresourcePool.tier. -
CertificateRequestPolicies, only when enabled (both default to
false):<tenant>whencertificateRequestPolicy.enabled: true:<tenant>.kestrel.arbutus.cloudand*.<tenant>.kestrel.arbutus.cloudfrom theletsencrypt-*ClusterIssuers.<tenant>-namespaced-issuerswhencertificateRequestPolicy.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-limitsLimitRange come from CapsuleGlobalTenantResources inenvironments/arbutus/kestrel/default/addons/capsule/. - The ArgoCD AppProject
<tenant>comes from thetenant-onboardingArgoTranslator (environments/default/addons/capsule-argo-addon/argo-translator.yaml). - Storage classes and the
traefikIngressClass are cluster addons.
Pre-flight
Section titled “Pre-flight”- You have
cluster-adminon 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.
Step 1: Keycloak group
Section titled “Step 1: Keycloak group”- In the Keycloak admin console (
keycloak.arbutus.alliancecan.ca, realmatmosphere, shared with other Arbutus services), confirm a group named exactly after the RAP group exists, or create it. - Add the initial members (at least the requesting PI or lead).
Step 2: Values file
Section titled “Step 2: Values file”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 certificatesKestrel 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, orcustomwithresourcePool.quota.hard.extraObjects: for example a staticReadWriteManyPersistentVolume labelledcapsule.clastix.io/tenant: <tenant>(seemlp-explorer).
Merge. ArgoCD picks up the change on its next Git poll (about 3 minutes) and syncs tenant-<rap-group-lowercased>.
Post-provisioning checks
Section titled “Post-provisioning checks”<tenant> is the lowercased name.
-
kubectl get tenant <tenant>:STATE Active,READY True. -
The owner group can create namespaces.
--as-groupneeds--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 -
kubectl get certificaterequestpolicy <tenant>(and<tenant>-namespaced-issuersif enabled) exists and isREADY True. -
kubectl describe resourcepool <tenant>shows the tier’s limits. -
kubectl get argotranslator tenant-onboardingisReady. 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}' -
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}' -
Ask the tenant lead to log in and run
kubectl create namespace <tenant>-test. This exercises Keycloak → capsule-proxy → Capsule → RBAC end to end.
Deprovisioning
Section titled “Deprovisioning”-
Delete the tenant’s namespaces. This deletes their PVCs; volumes on
csi-cinder-sc-retainremain asReleasedPVs to dispose of separately. -
Remove the
tenants/<RAP-group>/directory and merge. The ApplicationSet setspreserveResourcesOnDeletion: true, so this deletes the Application but leaves its resources orphaned. -
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 suffixkubectl delete certificaterequestpolicy <tenant> <tenant>-namespaced-issuers --ignore-not-foundkubectl delete clusterrole,clusterrolebinding \cert-manager-policy:<tenant> cert-manager-policy:<tenant>-namespaced-issuers --ignore-not-foundAlso delete anything the tenant had in
extraObjects, such as static PVs. -
Verify that
kubectl get tenantno longer lists it andkubectl -n argo-cd get appproject <tenant>is gone. -
Disable (don’t delete) the Keycloak group, to keep the audit trail.