Skip to content

Commit

Permalink
Merge pull request #102 from stakater/mto-helm
Browse files Browse the repository at this point in the history
Add example for private helm charts
  • Loading branch information
SheryarButt authored Mar 11, 2024
2 parents cdaa76b + a12dda5 commit af6c27a
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
1 change: 1 addition & 0 deletions content/how-to-guides/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resources:
repository:
name: redis
repoUrl: https://charts.bitnami.com/bitnami
version: 0.0.15
values: |
redisPort: 6379
---
Expand Down
105 changes: 105 additions & 0 deletions content/reference-guides/deploying-private-helm-charts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Deploying Private Helm Chart to Multiple Namespaces

Multi Tenant Operator uses its `helm` functionality from `Template` and `TemplateGroupInstance` to deploy private and public charts to multiple namespaces.

## Deploying Helm Chart to Namespaces via TemplateGroupInstances from OCI Registry

Bill, the cluster admin, wants to deploy a helm chart from `OCI` registry in namespaces where certain labels exists.

First, Bill creates a template:

```yaml
apiVersion: tenantoperator.stakater.com/v1alpha1
kind: Template
metadata:
name: chart-deploy
resources:
helm:
releaseName: random-release
chart:
repository:
name: random-chart
repoUrl: 'oci://ghcr.io/stakater/charts/random-chart'
version: 0.0.15
password:
key: password
name: repo-user
namespace: shared-ns
username:
key: username
name: repo-user
namespace: shared-ns
```
Once the template has been created, Bill makes a `TemplateGroupInstance` referring to the `Template` he wants to deploy with `MatchLabels`:

```yaml
apiVersion: tenantoperator.stakater.com/v1alpha1
kind: TemplateGroupInstance
metadata:
name: chart-deploy
spec:
selector:
matchExpressions:
- key: stakater.com/kind
operator: In
values:
- system
sync: true
template: chart-deploy
```

Multi Tenant Operator will pick up the credentials from the mentioned namespace to pull the chart and apply it.

Afterward, Bill can see that manifests in the chart have been successfully created in all label matching namespaces.

## Deploying Helm Chart to Namespaces via TemplateGroupInstances from HTTPS Registry

Bill, the cluster admin, wants to deploy a helm chart from `HTTPS` registry in namespaces where certain labels exists.

First, Bill creates a template:

```yaml
apiVersion: tenantoperator.stakater.com/v1alpha1
kind: Template
metadata:
name: chart-deploy
resources:
helm:
releaseName: random-release
chart:
repository:
name: random-chart
repoUrl: 'nexus-helm-url/registry'
version: 0.0.15
password:
key: password
name: repo-user
namespace: shared-ns
username:
key: username
name: repo-user
namespace: shared-ns
```

Once the template has been created, Bill makes a `TemplateGroupInstance` referring to the `Template` he wants to deploy with `MatchLabels`:

```yaml
apiVersion: tenantoperator.stakater.com/v1alpha1
kind: TemplateGroupInstance
metadata:
name: chart-deploy
spec:
selector:
matchExpressions:
- key: stakater.com/kind
operator: In
values:
- system
sync: true
template: chart-deploy
```

Multi Tenant Operator will pick up the credentials from the mentioned namespace to pull the chart and apply it.

Afterward, Bill can see that manifests in the chart have been successfully created in all label matching namespaces.
1 change: 1 addition & 0 deletions content/tutorials/template/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ resources:
repository:
name: redis
repoUrl: https://charts.bitnami.com/bitnami
version: 0.0.15
values: |
redisPort: 6379
```
Expand Down
1 change: 1 addition & 0 deletions theme_override/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ nav:
- reference-guides/distributing-secrets.md
- reference-guides/resource-sync-by-tgi.md
- reference-guides/distributing-secrets-using-sealed-secret-template.md
- reference-guides/deploying-private-helm-charts.md
- reference-guides/extend-default-roles.md
- reference-guides/integrationconfig.md
- reference-guides/mattermost.md
Expand Down

0 comments on commit af6c27a

Please sign in to comment.