From 451e5b6310f847f672bf1160390525e4c0fe8d77 Mon Sep 17 00:00:00 2001 From: cmontemuino <1761056+cmontemuino@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:34:16 +0100 Subject: [PATCH 1/3] refactor(chart): provide CRDs in a subchart 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 Signed-off-by: cmontemuino <1761056+cmontemuino@users.noreply.github.com> --- .gitignore | 4 +++- chart/Chart.yaml | 3 +++ chart/README.md | 19 ++++++++++++++++--- chart/README.md.tmpl | 16 +++++++++++++--- chart/charts/crds/Chart.yaml | 7 +++++++ chart/charts/crds/README.md | 4 ++++ .../templates}/csi-volume-snapshot-class.yaml | 2 ++ .../csi-volume-snapshot-content.yaml | 2 ++ .../crds/templates}/csi-volume-snapshot.yaml | 2 ++ .../crds/templates}/jaeger.yaml | 2 ++ chart/charts/crds/values.yaml | 6 ++++++ chart/values.yaml | 7 +++++++ 12 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 chart/charts/crds/Chart.yaml create mode 100644 chart/charts/crds/README.md rename chart/{crds => charts/crds/templates}/csi-volume-snapshot-class.yaml (99%) rename chart/{crds => charts/crds/templates}/csi-volume-snapshot-content.yaml (99%) rename chart/{crds => charts/crds/templates}/csi-volume-snapshot.yaml (99%) rename chart/{crds => charts/crds/templates}/jaeger.yaml (96%) create mode 100644 chart/charts/crds/values.yaml diff --git a/.gitignore b/.gitignore index d33ad0357..4cc78bc91 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 8fabb0868..05f61aa8d 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -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 diff --git a/chart/README.md b/chart/README.md index 7d1e1bdca..e9fe277a6 100644 --- a/chart/README.md +++ b/chart/README.md @@ -33,17 +33,28 @@ $ helm install mayastor . -n ### 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 | @@ -93,6 +104,8 @@ $ helm install my-release openebs/mayastor | base.​jaeger.​enabled | Enable jaeger tracing | `false` | | base.​logSilenceLevel | Silence specific module components | `nil` | | base.​metrics.​enabled | Enable the metrics exporter | `true` | +| crds.​enabled | Install CRDs | `true` | +| crds.​jaeger.​enabled | Install Jaeger CRDs | `false` | | csi.​controller.​logLevel | Log level for the csi controller | `"info"` | | csi.​controller.​preventVolumeModeConversion | Prevent modifying the volume mode when creating a PVC from an existing VolumeSnapshot | `true` | | csi.​controller.​priorityClassName | Set PriorityClass, overrides global | `""` | diff --git a/chart/README.md.tmpl b/chart/README.md.tmpl index 3092c02fe..87bfb7e1c 100644 --- a/chart/README.md.tmpl +++ b/chart/README.md.tmpl @@ -32,13 +32,23 @@ $ helm install mayastor . -n ### 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" . }} diff --git a/chart/charts/crds/Chart.yaml b/chart/charts/crds/Chart.yaml new file mode 100644 index 000000000..6d0e2b536 --- /dev/null +++ b/chart/charts/crds/Chart.yaml @@ -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. + diff --git a/chart/charts/crds/README.md b/chart/charts/crds/README.md new file mode 100644 index 000000000..30b90b010 --- /dev/null +++ b/chart/charts/crds/README.md @@ -0,0 +1,4 @@ +# Mayastor CRDs + +This chart brings Custom Resource Definitions (CRDs) used by Mayastor. + diff --git a/chart/crds/csi-volume-snapshot-class.yaml b/chart/charts/crds/templates/csi-volume-snapshot-class.yaml similarity index 99% rename from chart/crds/csi-volume-snapshot-class.yaml rename to chart/charts/crds/templates/csi-volume-snapshot-class.yaml index 684986b6b..d855e29f2 100644 --- a/chart/crds/csi-volume-snapshot-class.yaml +++ b/chart/charts/crds/templates/csi-volume-snapshot-class.yaml @@ -1,3 +1,4 @@ +{{- if .Values.volumeSnapshots.enabled -}} apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -145,3 +146,4 @@ status: plural: "" conditions: [] storedVersions: [] +{{- end -}} diff --git a/chart/crds/csi-volume-snapshot-content.yaml b/chart/charts/crds/templates/csi-volume-snapshot-content.yaml similarity index 99% rename from chart/crds/csi-volume-snapshot-content.yaml rename to chart/charts/crds/templates/csi-volume-snapshot-content.yaml index 41feca9f4..c1bb468dd 100644 --- a/chart/crds/csi-volume-snapshot-content.yaml +++ b/chart/charts/crds/templates/csi-volume-snapshot-content.yaml @@ -1,3 +1,4 @@ +{{- if .Values.volumeSnapshots.enabled -}} apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -483,3 +484,4 @@ status: plural: "" conditions: [] storedVersions: [] +{{- end -}} diff --git a/chart/crds/csi-volume-snapshot.yaml b/chart/charts/crds/templates/csi-volume-snapshot.yaml similarity index 99% rename from chart/crds/csi-volume-snapshot.yaml rename to chart/charts/crds/templates/csi-volume-snapshot.yaml index ee4b5475f..c7ac9574c 100644 --- a/chart/crds/csi-volume-snapshot.yaml +++ b/chart/charts/crds/templates/csi-volume-snapshot.yaml @@ -1,3 +1,4 @@ +{{- if .Values.volumeSnapshots.enabled -}} apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -385,3 +386,4 @@ status: plural: "" conditions: [] storedVersions: [] +{{- end -}} diff --git a/chart/crds/jaeger.yaml b/chart/charts/crds/templates/jaeger.yaml similarity index 96% rename from chart/crds/jaeger.yaml rename to chart/charts/crds/templates/jaeger.yaml index 36f9fb8b8..4de8ab433 100644 --- a/chart/crds/jaeger.yaml +++ b/chart/charts/crds/templates/jaeger.yaml @@ -1,3 +1,4 @@ +{{- if .Values.jaeger.enabled -}} apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -42,3 +43,4 @@ spec: storage: true subresources: status: {} +{{- end -}} diff --git a/chart/charts/crds/values.yaml b/chart/charts/crds/values.yaml new file mode 100644 index 000000000..2e95c19e4 --- /dev/null +++ b/chart/charts/crds/values.yaml @@ -0,0 +1,6 @@ +jaeger: + # -- Install Jaeger CRDs + enabled: true + # -- Install Volume Snapshots CRD + volumeSnapshots: + enabled: true diff --git a/chart/values.yaml b/chart/values.yaml index 977fe6a9e..a98c26843 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -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 From 31f785288c5bbddfa04cab342c5180f0e7facf7f Mon Sep 17 00:00:00 2001 From: cmontemuino <1761056+cmontemuino@users.noreply.github.com> Date: Tue, 12 Mar 2024 20:24:19 +0100 Subject: [PATCH 2/3] fix: wrong indentation in crd values Signed-off-by: cmontemuino <1761056+cmontemuino@users.noreply.github.com> --- chart/charts/crds/values.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chart/charts/crds/values.yaml b/chart/charts/crds/values.yaml index 2e95c19e4..149e8b3a5 100644 --- a/chart/charts/crds/values.yaml +++ b/chart/charts/crds/values.yaml @@ -1,6 +1,6 @@ jaeger: # -- Install Jaeger CRDs enabled: true - # -- Install Volume Snapshots CRD - volumeSnapshots: - enabled: true +# -- Install Volume Snapshots CRD +volumeSnapshots: + enabled: true From 92e2c387e994087250464246c7a21e88ffdf3900 Mon Sep 17 00:00:00 2001 From: cmontemuino <1761056+cmontemuino@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:19:09 +0100 Subject: [PATCH 3/3] docs: update readme Signed-off-by: cmontemuino <1761056+cmontemuino@users.noreply.github.com> --- chart/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart/README.md b/chart/README.md index e9fe277a6..590c444f0 100644 --- a/chart/README.md +++ b/chart/README.md @@ -43,7 +43,7 @@ $ helm install mymayastor mayastor/mayastor ### Uninstall Helm Chart ```console -$ helm uninstall [RELEASE_NAME] +$ helm uninstall [RELEASE_NAME] ``` This removes all the Kubernetes components associated with the chart and deletes the release.