Skip to content

Commit

Permalink
Merge pull request #186 from stakater/change-tenant
Browse files Browse the repository at this point in the history
Change tenant
  • Loading branch information
ayeshasiddiqa161 authored Nov 28, 2023
2 parents dcdb389 + a9ea622 commit fd2f75c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ This AppProject will be used to sync all the Applications in `Infra Gitops Confi
1. Inside the folder created in step 2, add two folders; one named `argocd-apps`, and another one named `tenant-operator-config`
> The `argocd-apps` folder will contain ArgoCD applications that will _watch_ different resources added to the same repository. Let's spare ourselves from the details for now.
1. Open the `tenant-operator-config` folder and add two folders inside it: `quotas` and `tenants`
1. The tenants folder will contain the tenant you want to add to your cluster. Let's create one called `gabbar` by adding the file below:
1. The tenants folder will contain the tenant you want to add to your cluster. Let's create one called `arsenal` by adding the file below:

```yaml
apiVersion: tenantoperator.stakater.com/v1beta1
kind: Tenant
metadata:
name: gabbar
name: arsenal
spec:
quota: gabbar-large
quota: arsenal-large
owners:
users:
- [email protected]
Expand All @@ -67,13 +67,13 @@ This AppProject will be used to sync all the Applications in `Infra Gitops Confi
- stage
```
1. We also need to add a quota for our `gabbar` tenant in our `quotas` folder created in step 4. So let's do it using the file below. The name of this quota need to match the name you specified in tenant CR.
1. We also need to add a quota for our `arsenal` tenant in our `quotas` folder created in step 4. So let's do it using the file below. The name of this quota need to match the name you specified in tenant CR.

```yaml
apiVersion: tenantoperator.stakater.com/v1beta1
kind: Quota
metadata:
name: gabbar-large
name: arsenal-large
annotations:
quota.tenantoperator.stakater.com/is-default: "false"
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,33 @@ This GitOps structure supports:

Lets proceed by adding a tenant to the `apps-gitops-config` repository.

1. Create a folder at root level for your tenant. Lets use `gabbar` as tenant name which was deployed in the previous section via `infra-gitops-config` repository.
1. Create a folder at root level for your tenant. Lets use `arsenal` as tenant name which was deployed in the previous section via `infra-gitops-config` repository.

```bash
├── gabbar
├── arsenal
```

Inside this folder we can define multiple applications per tenant.

1. We need to create a `argocd-apps` folder inside this `gabbar` folder. This folder will deploy the applications defined inside its siblings folders (in `gabbar` folder).
1. We need to create a `argocd-apps` folder inside this `arsenal` folder. This folder will deploy the applications defined inside its siblings folders (in `arsenal` folder).

```bash
├── gabbar
├── arsenal
└── argocd-apps
```

1. Lets add an application for tenant `gabbar`, Lets call this application `stakater-nordmart-review`. Create a folder named `stakater-nordmart-review` in `gabbar` folder.
1. Lets add an application for tenant `arsenal`, Lets call this application `stakater-nordmart-review`. Create a folder named `stakater-nordmart-review` in `arsenal` folder.

```bash
├── gabbar
├── arsenal
└── stakater-nordmart-review
```

This application has two environments: dev and stage. Former is deployed to dev cluster and latter is deployed to stage cluster.
We need to create two new folders now:

```bash
├── gabbar
├── arsenal
└── stakater-nordmart-review
├── dev
└── stage
Expand All @@ -83,7 +83,7 @@ Lets proceed by adding a tenant to the `apps-gitops-config` repository.
We need the corresponding folders inside `argocd-apps` folder and define ArgoCD applications pointing to these folders.

```bash
├── gabbar
├── arsenal
├── argocd-apps
├── dev
│ └── stakater-nordmart-review-dev.yaml
Expand All @@ -95,19 +95,19 @@ Lets proceed by adding a tenant to the `apps-gitops-config` repository.

```yaml
# Name: stakater-nordmart-review.yaml(APP_NAME.yaml)
# Path: gabbar/argocd-apps/dev (TENANT_NAME/argocd-apps/ENV_NAME/)
# Path: arsenal/argocd-apps/dev (TENANT_NAME/argocd-apps/ENV_NAME/)
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: gabbar-dev-stakater-nordmart-review
name: arsenal-dev-stakater-nordmart-review
namespace: rh-openshift-gitops-instance
spec:
destination:
namespace: TARGET_NAMESPACE_FOR_DEV
server: 'https://kubernetes.default.svc'
project: gabbar
project: arsenal
source:
path: gabbar/stakater-nordmart-review/dev
path: arsenal/stakater-nordmart-review/dev
repoURL: 'APPS_GITOPS_REPO_URL'
targetRevision: HEAD
syncPolicy:
Expand All @@ -120,19 +120,19 @@ Lets proceed by adding a tenant to the `apps-gitops-config` repository.

```yaml
# Name: stakater-nordmart-review.yaml (APP_NAME.yaml)
# Path: gabbar/argocd-apps/stage (TENANT_NAME/argocd-apps/ENV_NAME/)
# Path: arsenal/argocd-apps/stage (TENANT_NAME/argocd-apps/ENV_NAME/)
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: gabbar-stage-stakater-nordmart-review
name: arsenal-stage-stakater-nordmart-review
namespace: rh-openshift-gitops-instance
spec:
destination:
namespace: TARGET_NAMESPACE_FOR_STAGE
server: 'https://kubernetes.default.svc'
project: gabbar
project: arsenal
source:
path: gabbar/stakater-nordmart-review/stage
path: arsenal/stakater-nordmart-review/stage
repoURL: 'APPS_GITOPS_REPO_URL'
targetRevision: HEAD
syncPolicy:
Expand All @@ -146,7 +146,7 @@ Lets proceed by adding a tenant to the `apps-gitops-config` repository.
After performing all the steps you should have the following folder structure:

```bash
├── gabbar
├── arsenal
├── argocd-apps
├── dev
│ └── stakater-nordmart-review-dev.yaml
Expand All @@ -169,12 +169,12 @@ Lets proceed by adding a tenant to the `apps-gitops-config` repository.
└── stage
```

> Folders in `argocd-apps` corresponds to clusters, these folders contain ArgoCD applications pointing to 1 or more environments inside multiple tenant folders per cluster. Folders in `gabbar/argocd-apps` correspond to environments.
> Folders in `argocd-apps` corresponds to clusters, these folders contain ArgoCD applications pointing to 1 or more environments inside multiple tenant folders per cluster. Folders in `arsenal/argocd-apps` correspond to environments.

Next, create the following ArgoCD applications in each environment, dev and stage:

```yaml
# Name: gabbar-dev.yaml (TENANT_NAME-ENV_NAME.yaml)
# Name: arsenal-dev.yaml (TENANT_NAME-ENV_NAME.yaml)
# Path: argocd-apps/dev
apiVersion: argoproj.io/v1alpha1
kind: Application
Expand All @@ -185,7 +185,7 @@ Lets proceed by adding a tenant to the `apps-gitops-config` repository.
destination:
namespace: TARGET_NAMESPACE_FOR_DEV
server: 'https://kubernetes.default.svc'
project: gabbar
project: arsenal
source:
path: argocd-apps/dev
repoURL: 'APPS_GITOPS_REPO_URL'
Expand All @@ -195,18 +195,18 @@ Lets proceed by adding a tenant to the `apps-gitops-config` repository.
prune: true
selfHeal: true
---
# Name: gabbar-stage.yaml (TENANT_NAME-ENV_NAME.yaml)
# Name: arsenal-stage.yaml (TENANT_NAME-ENV_NAME.yaml)
# Path: argocd-apps/stage
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: gabbar-stage
name: arsenal-stage
namespace: rh-openshift-gitops-instance
spec:
destination:
namespace: TARGET_NAMESPACE_FOR_STAGE
server: 'https://kubernetes.default.svc'
project: gabbar
project: arsenal
source:
path: argocd-apps/stage
repoURL: 'APPS_GITOPS_REPO_URL'
Expand Down

0 comments on commit fd2f75c

Please sign in to comment.