From e4c5587c2615cc5bb83c887f6e9e9ff4026e5ce3 Mon Sep 17 00:00:00 2001 From: Will Arroyo Date: Tue, 17 Oct 2023 15:52:44 -0600 Subject: [PATCH] updates to docs --- CHANGELOG.md | 3 ++ README.md | 143 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 127 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61bc0f8..2ab1a48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ This release contains updates to the tenant management as well as a few minor fi * see docs [here](https://github.com/warroyo/flux-tmc-multitenant/tree/main/tenant-generator) * refactored tenants to use new helm chart * updated documentation for tenants to reflect new helm chart +* moved apps kustomization to use the existing `cluster_name` variable. related commits: + * https://github.com/warroyo/flux-tmc-multitenant/commit/158db32868af35c2a81d6cb8dce3e09002595093 +* Switched to using full cluster names rather than a mix. this is more consistent and allows for better re-usability # 1.0.0 diff --git a/README.md b/README.md index 2e214bb..00b7b2f 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,7 @@ clusters │ └── │ ├── apps.yml │ ├── infrastructure.yml -│ └── tenants -│ └── .yml +│ └── tenants.yml ``` subdirectories/files: @@ -105,7 +104,7 @@ subdirectories/files: `cluster-name>` - each cluster will have it's own directory that contains any cluster specific configuration. `apps.yml` - sets up the cluster specific kustomization pointing to the clusters directory in the `apps` folder. `infrastructure.yml` - sets up the cluster specifc kustomization ponting to the clusters directory `infrastructure` directory. -`tenants` - contains a yml file for each tenant. this yaml file sets up the tenants bootstrap namespace in the cluster as well as the `kustomization` and `gitrepo` that point to the tenants bootstrap git repo. +`tenants.yml` - this is a single kustomization with a patch that defines each tenant into the [helm chart](https://github.com/warroyo/flux-tmc-multitenant/tree/main/tenant-generator) values. This is used for bootstrapping tenants on a cluster ### infrastructure @@ -620,7 +619,7 @@ This will outline adding a new cluster to an existing environment, the process w 2. if using secret management be sure to create the bootstrap credential in the newly created cluster 4. create a new folder in the `clusters` directory with the name of the cluster from TMC. 5. add the neccessary files, examples of what are in the files can be foudn in this directory and are explained in the repo stucture. - 1. `tenants/.yml` + 1. `tenants.yml` 2. `apps.yml` 3. `infrastructure.yml` 6. create a new folder in the `apps/clusters` directory with the name of the cluster. this must match the path given in the `apps.yml` @@ -635,7 +634,7 @@ These steps would only be done if the tenant was added to the new cluster. The s ## Adding a new tenant -Adding a new Tenant has a few steps that could be automated. Some ideas around automating these are listed below. These steps should be completed any time a new team is wanting to be onboarded. These steps are outlined with commands referencing this repo's setup but these could be adpated to be done generically. +These steps should be completed any time a new team is wanting to be onboarded. These steps are outlined with commands referencing this repo's setup but these could be adpated to be done generically. using `iris-red` as the new tenant. @@ -653,24 +652,14 @@ tanzu tmc workspace create -f tmc/workspaces/iris-red.yaml tanzu tmc iam update-policy -s workspace -n iris-red -f tmc/iam/sa-rb-workspace-red.yaml ``` -3. create a tenant file in the infra-ops cluster folder. Replace the tenant name in all locations in the file. +3. add a tenant to the list of tenant in the `tenant.yml` in the infra-ops cluster folder. See more on the tenant automation below. -``` -cp clusters/eks.eks-warroyo2.us-west-2.infra-ops/tenants/iris-blue.yml clusters/eks.eks-warroyo2.us-west-2.infra-ops/tenants/iris-red.yml - -##replace the tenant name in the file -``` 4. create a tenant gitops repo, this could also be handled by the tenant initially and passed to the admins. In this case our git repo name is `iris-red-gitops` -5. create a tenant file in the clusters that you would like that tenant to exist in. for this example we will assume dev only. This file contains the `gitrepo` setup for the tenant so make sure it matches the git repo from step 4. +5. Add the tenant to the values in the `tenant.yml` for the cluster. See docs [here]() on tenant automation. -``` -cp clusters/eks.eks-warroyo2.us-west-2.iris-dev/tenants/iris-blue.yml clusters/eks.eks-warroyo2.us-west-2.iris-dev/tenants/iris-red.yml - -##replace the tenant name in the file -``` 6. commit these files into the git repo and wait for flux to reconcile. here is what is created 1. tenant workspace @@ -702,7 +691,7 @@ mkdir -p clusters/iris-dev/namespaces ### Automation ideas -In the steps above we just copied existing files and did search and replace. However in an automation scenario what you would most liklely do is template out the files and use variables to generate them. +In the steps above we used a helm chart to generate most of our tenant yaml. More automation could be done here or this could be done in another way. Here are some ideas. * TAP acelerators for tenant repos * ADO pipelines + YTT templated files @@ -715,4 +704,120 @@ The setup in the repo allows for tenants to self service namespaces. This is don 1. In the tenant git repo make sure you have the `clusters/