Skip to content

Commit

Permalink
refactor(chart): provide CRDs in a subchart
Browse files Browse the repository at this point in the history
This changeset is mainly intended to skip Jaeger CRDs if it is not
enabled. This is especially relevant when Jaeger tracing is installed
separately from OpenEBS Mayastor.

Helm 3 does not manage CRDs.
- https://helm.sh/docs/chart_best_practices/custom_resource_definitions

`helm uninstall` won't remove CRDs, and `helm updgrade` won't upgrade
them. Manual intervention is required with the current setup.
 - CRDs installed from `crds` folder are not included into the
 helm release.

Additionally, it is not possible to template CRDs in Helm 3 in the
`crds` folder.

Moving CRDs to a chart solves several issues: clean uninstall,
possibility for upgrades, templating.

Also make volumeSnapshots CRD optional
  • Loading branch information
cmontemuino committed Mar 12, 2024
1 parent 18efa0f commit 5ecab24
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
/result*
__pycache__
/tests/bdd/openapi/
/chart/charts/
/chart/charts/*
# charts/crds is valid chart for git
!/chart/charts/crds/
/chart/Chart.lock
!/openapi/Cargo.toml
!/openapi/build.rs
Expand Down
3 changes: 3 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ version: 0.0.0
appVersion: "0.0.0"

dependencies:
- name: crds
version: "0.0.0"
condition: crds.enabled
- name: etcd
repository: https://charts.bitnami.com/bitnami
version: 8.6.0
Expand Down
19 changes: 16 additions & 3 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,28 @@ $ helm install mayastor . -n <mayastor-namespace>

### Installing the Chart via Helm Registry

To install the chart with the release name `my-release`:
To install the chart with the release name `mymayastor`:

```console
$ helm repo add openebs https://openebs.github.io/mayastor-extensions/
$ helm install my-release openebs/mayastor
$ helm repo add mayastor https://openebs.github.io/mayastor-extensions/
$ helm install mymayastor mayastor/mayastor
```

### Uninstall Helm Chart

```console
$ helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

*See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation.*

## Chart Dependencies

| Repository | Name | Version |
|------------|------|---------|
| | crds | 0.0.0 |
| https://charts.bitnami.com/bitnami | etcd | 8.6.0 |
| https://grafana.github.io/helm-charts | loki-stack | 2.9.11 |
| https://jaegertracing.github.io/helm-charts | jaeger-operator | 2.25.0 |
Expand Down Expand Up @@ -93,6 +104,8 @@ $ helm install my-release openebs/mayastor
| base.&ZeroWidthSpace;jaeger.&ZeroWidthSpace;enabled | Enable jaeger tracing | `false` |
| base.&ZeroWidthSpace;logSilenceLevel | Silence specific module components | `nil` |
| base.&ZeroWidthSpace;metrics.&ZeroWidthSpace;enabled | Enable the metrics exporter | `true` |
| crds.&ZeroWidthSpace;enabled | Install CRDs | `true` |
| crds.&ZeroWidthSpace;jaeger.&ZeroWidthSpace;enabled | Install Jaeger CRDs | `false` |
| csi.&ZeroWidthSpace;controller.&ZeroWidthSpace;logLevel | Log level for the csi controller | `"info"` |
| csi.&ZeroWidthSpace;controller.&ZeroWidthSpace;preventVolumeModeConversion | Prevent modifying the volume mode when creating a PVC from an existing VolumeSnapshot | `true` |
| csi.&ZeroWidthSpace;controller.&ZeroWidthSpace;priorityClassName | Set PriorityClass, overrides global | `""` |
Expand Down
16 changes: 13 additions & 3 deletions chart/README.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@ $ helm install mayastor . -n <mayastor-namespace>

### Installing the Chart via Helm Registry

To install the chart with the release name `my-release`:
To install the chart with the release name `mymayastor`:

```console
$ helm repo add openebs https://openebs.github.io/mayastor-extensions/
$ helm install my-release openebs/{{ template "chart.name" . }}
$ helm repo add mayastor https://openebs.github.io/mayastor-extensions/
$ helm install mymayastor mayastor/{{ template "chart.name" . }}
```

### Uninstall Helm Chart

```console
$ helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

*See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation.*

## Chart Dependencies

{{ template "chart.requirementsTable" . }}
Expand Down
7 changes: 7 additions & 0 deletions chart/charts/crds/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: crds
version: 0.0.0
description: |
A Helm chart that collects custom resource definitions (CRDs) from Mayastor. It also includes one CRD
from Jaeger tracing when enabled.
4 changes: 4 additions & 0 deletions chart/charts/crds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Mayastor CRDs

This chart brings Custom Resource Definitions (CRDs) used by Mayastor.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.volumeSnapshots.enabled -}}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -145,3 +146,4 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.volumeSnapshots.enabled -}}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -483,3 +484,4 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.volumeSnapshots.enabled -}}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -385,3 +386,4 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.jaeger.enabled -}}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -42,3 +43,4 @@ spec:
storage: true
subresources:
status: {}
{{- end -}}
6 changes: 6 additions & 0 deletions chart/charts/crds/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jaeger:
# -- Install Jaeger CRDs
enabled: true
# -- Install Volume Snapshots CRD
volumeSnapshots:
enabled: true
7 changes: 7 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
crds:
# -- Install CRDs
enabled: true
jaeger:
# -- Install Jaeger CRDs
enabled: false

image:
# -- Image registry to pull our product images
registry: docker.io
Expand Down

0 comments on commit 5ecab24

Please sign in to comment.