From 1d3c66d2432f2268c863a9db1e3ae484db8a9148 Mon Sep 17 00:00:00 2001 From: hussnain612 Date: Wed, 27 Jul 2022 14:31:49 +0500 Subject: [PATCH] Updated tenant use cases --- .../sre/tenant-operator/usecases/tenant.md | 51 ++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/content/sre/tenant-operator/usecases/tenant.md b/content/sre/tenant-operator/usecases/tenant.md index 9441ed8d..672760f2 100644 --- a/content/sre/tenant-operator/usecases/tenant.md +++ b/content/sre/tenant-operator/usecases/tenant.md @@ -163,7 +163,7 @@ bluesky-prod Active 5d5h ### Distributing common labels and annotations to tenant namespaces via Tenant Custom Resource -Bill now wants to add labels/annotations to all the namespaces for a tenant. To create those labels/annotations Bill will just add them into `namespaceLabels`/`namespaceAnnotations` field in the tenant CR. +Bill now wants to add labels/annotations to all the namespaces for a tenant. To create those labels/annotations Bill will just add them into `commonMetadata.labels`/`commonMetadata.annotations` field in the tenant CR. ```yaml kubectl apply -f - << EOF @@ -186,11 +186,50 @@ spec: - dev - build - prod - namespaceLabels: - app.kubernetes.io/managed-by: tenant-operator - app.kubernetes.io/part-of: tenant-alpha - namespaceAnnotations: - openshift.io/node-selector: node-role.kubernetes.io/infra= + commonMetadata: + labels: + app.kubernetes.io/managed-by: tenant-operator + app.kubernetes.io/part-of: tenant-alpha + annotations: + openshift.io/node-selector: node-role.kubernetes.io/infra= +EOF +``` + +With the above configuration all tenant namespaces will now contain the mentioned labels and annotations. + +### Distributing specific labels and annotations to tenant namespaces via Tenant Custom Resource + +Bill now wants to add labels/annotations to specific namespaces for a tenant. To create those labels/annotations Bill will just add them into `specificMetadata.labels`/`commonMetadata.annotations` and specific namespaces in `specificMetadata.namespaces` field in the tenant CR. + +```yaml +kubectl apply -f - << EOF +apiVersion: tenantoperator.stakater.com/v1beta1 +kind: Tenant +metadata: + name: bluesky +spec: + owners: + users: + - anna@aurora.org + - anthony@aurora.org + editors: + users: + - john@aurora.org + groups: + - alpha + quota: small + sandbox: true + namespaces: + - dev + - build + - prod + specificMetadata: + - namespaces: + - bluesky-anna-aurora-sandbox + labels: + app.kubernetes.io/is-sandbox: true + annotations: + openshift.io/node-selector: node-role.kubernetes.io/worker= EOF ```