Skip to content

Commit

Permalink
feat(helm chart): add unified helm installer for openebs local and re…
Browse files Browse the repository at this point in the history
…plicated engines (openebs#3704)

* feat(helm chart): add unified helm installer for openebs engines

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* refactor(charts): update NOTES.txt with updated storage plugin info

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(charts): bump dependent chart versions

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* refactor(charts): source localpv from dependency helm chart
This removes all templates from this chart, including localpv provisioner
and NDM. This now uses the localpv-provisioner helm chart to install
hostpath localpv.

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(charts): add crd as a helm chart

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(charts): add openebs unified helm installer charts

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(charts): enable init containers for mayastor csi node

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* fix: crds getting removed on helm upgrades

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* chore: address review comments-1

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* ci: add helm chart lint and release GitHub Actions workflows

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>

* chore: update gitignore and add helmignore

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>

* feat(chart): add pre-upgrade hook to patch crds

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(charts): add rbac to pre-upgrade hook

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>

* ci: add ct.yaml

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(chart): update readme

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(chart): make image properties configurable for upgrade hook

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>

* chore(gitignore): add helm chart charts directory

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>

* feat(chart): add new chart toggles

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>

* feat(chart): use umbrella crds

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(chart): add the localpv deployment delete in upgrade hook

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* refactor(charts): change the dependency chart toggles

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>

* fix: helm chart notes

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(charts): update readme and values

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(charts): update values

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* chore: add entry to gitignore

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

* feat(chart): rename pre upgrade hook

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>

---------

Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>
Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
Co-authored-by: Niladri Halder <niladri.halder26@gmail.com>
  • Loading branch information
Abhinandan-Purkait and niladrih authored Apr 16, 2024
1 parent 3858100 commit d8227cb
Show file tree
Hide file tree
Showing 19 changed files with 1,609 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/workflows/chart-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Chart Lint and Test

on:
push:
paths:
- 'charts/**'
branches:
- main
pull_request:
paths:
- 'charts/**'
branches:
- main

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.14.3

- uses: actions/setup-python@v5
with:
python-version: '3.10'
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml)
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml

- name: Create kind cluster
uses: helm/kind-action@v1.9.0
if: steps.list-changed.outputs.changed == 'true'

- name: Add dependency chart repos
run: |
helm repo add openebs-mayastor https://openebs.github.io/mayastor-extensions
helm repo add openebs-localpv https://openebs.github.io/dynamic-localpv-provisioner
helm repo add openebs-zfslocalpv https://openebs.github.io/zfs-localpv
helm repo add openebs-lvmlocalpv https://openebs.github.io/lvm-localpv
helm repo update
- name: Run chart-testing (install)
run: ct install --config ct.yaml
32 changes: 32 additions & 0 deletions .github/workflows/chart-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release Charts

on:
push:
paths:
- 'charts/**'
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.14.3

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.CR_TOKEN }}"
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@ k8s/lib/vagrant/*.box
k8s/lib/vagrant/*.log

# Local build for docs
documentation/build/
documentation/build/

# IDEs
**/.idea

# Helm chart
charts/Chart.lock
!/charts/charts/crds/
/charts/charts/*
23 changes: 23 additions & 0 deletions charts/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
# OWNERS file for Kubernetes
OWNERS
34 changes: 34 additions & 0 deletions charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v2
version: 4.0.0
name: openebs
appVersion: 4.0.0
description: Containerized Attached Storage for Kubernetes
icon: https://raw.githubusercontent.com/cncf/artwork/HEAD/projects/openebs/icon/color/openebs-icon-color.png
home: https://www.openebs.io/
keywords:
- cloud-native-storage
- block-storage
- local-storage
- NVMe
- storage
- kubernetes
sources:
- https://github.com/openebs/openebs
dependencies:
- name: openebs-crds
version: 4.0.0
- name: localpv-provisioner
version: 4.0.0
repository: "https://openebs.github.io/dynamic-localpv-provisioner"
- name: zfs-localpv
version: 2.5.1
repository: "https://openebs.github.io/zfs-localpv"
condition: engines.local.zfs.enabled
- name: lvm-localpv
version: 1.5.1
repository: "https://openebs.github.io/lvm-localpv"
condition: engines.local.lvm.enabled
- name: mayastor
version: 2.6.0
repository: "https://openebs.github.io/mayastor-extensions"
condition: engines.replicated.mayastor.enabled
126 changes: 126 additions & 0 deletions charts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# OpenEBS Helm Repository

<img width="200" align="right" alt="OpenEBS Logo" src="https://raw.githubusercontent.com/cncf/artwork/master/projects/openebs/stacked/color/openebs-stacked-color.png" xmlns="http://www.w3.org/1999/html">

[OpenEBS](https://openebs.io) helps Developers and Platform SREs easily deploy Kubernetes Stateful Workloads that require fast and highly reliable container attached storage. OpenEBS can be deployed on any Kubernetes cluster - either in cloud, on-premise (virtual or bare metal) or developer system (minikube).

OpenEBS Data Engines and Control Plane are implemented as micro-services, deployed as containers and orchestrated by Kubernetes itself. An added advantage of being a completely Kubernetes native solution is that administrators and developers can interact and manage OpenEBS using all the wonderful tooling that is available for Kubernetes like kubectl, Helm, Prometheus, Grafana, etc.

OpenEBS turns any storage available on the Kubernetes worker nodes into local or distributed Kubernetes Persistent Volumes.

#### Local PV

Local Volumes are accessible only from a single node in the cluster. Pods using Local Volume have to be scheduled on the node where volume is provisioned. Local Volumes are typically preferred for distributed workloads like Cassandra, MongoDB, Elastic, etc that are distributed in nature and have high availability built into them. Depending on the type of storage attached to the Kubernetes worker, OpenEBS offers different flavors of Local PV - Hostpath, LVM and ZFS.

#### Replicated PV

Replicated Volumes as the name suggests, are those that have their data synchronously replicated to multiple nodes. Volumes can sustain node failures. The replication also can be setup across availability zones helping applications move across availability zones. OpenEBS offers Replicated PV Mayastor as an replicated storage solution, which provides high availability and high performance.

## Documentation and user guides

OpenEBS can run on any Kubernetes 1.23+ cluster in a matter of minutes. See the [Quickstart Guide to OpenEBS](https://openebs.io/docs/quickstart-guide/installation) for detailed instructions.

## Getting started

### How to customize OpenEBS Helm chart?

OpenEBS Helm chart is a unified Helm chart that pulls together engine specific charts. The engine charts are included as [dependencies](https://github.com/openebs/openebs/tree/HEAD/charts/Chart.yaml).

```bash
openebs
├── (default) Local PV HostPath
├── (default) Local PV LVM
├── (default) Local PV ZFS
└── (default) Replicated PV Mayastor
```

### Prerequisites

- [Local PV Hostpath Prerequisites](https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-hostpath/hostpath-installation#prerequisites)
- [Local PV LVM Prerequisites](https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-lvm/lvm-installation#prerequisites)
- [Local PV ZFS Prerequisites](https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-zfs/zfs-installation#prerequisites)
- [Replicated PV Mayastor Prerequisites](https://openebs.io/docs/user-guides/replicated-storage-user-guide/replicated-pv-mayastor/rs-installation#prerequisites)

### Setup Helm Repository

Before installing OpenEBS Helm chart, the [OpenEBS Helm repository](https://openebs.github.io/openebs) needs to be added to the Helm client.

#### Setup Helm repository

```bash
helm repo add openebs https://openebs.github.io/openebs
helm repo update
```

#### Install OpenEBS Helm chart with default values.

```bash
helm install openebs --namespace openebs openebs/openebs --create-namespace
```

The above commands will install OpenEBS LocalPV Hostpath, OpenEBS LocalPV LVM, OpenEBS LocalPV ZFS and OpenEBS Mayastor components in openebs namespace with chart name as openebs.

Replicated PV Mayastor can be excluded during the installation with the following command:

```bash
helm install openebs --namespace openebs openebs/openebs --set engines.replicated.mayastor.enabled=false --create-namespace
```

To view the chart and get the following output.

```bash
helm ls -n openebs

NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
openebs openebs 1 2024-03-25 09:13:00.903321318 +0000 UTC deployed openebs-4.0.0 4.0.0
```

As a next step [verify the installation](https://openebs.io/docs/quickstart-guide/installation#verifying-openebs-installation) and do the [post installation](https://openebs.io/docs/quickstart-guide/installation#post-installation-considerations) steps.

For more details on customizing and installing OpenEBS please see the [chart values](https://github.com/openebs/openebs/tree/HEAD/charts/README.md).

### To uninstall/delete instance with release name

```bash
helm ls --all
helm delete `<RELEASE NAME>` -n `<RELEASE NAMESPACE>`
```

> **Tip**: Prior to deleting the Helm chart, make sure all the storage volumes and pools are deleted.
## Requirements

| Repository | Name | Version |
|------------|------|---------|
| | openebs-crds | 4.0.0 |
| https://openebs.github.io/dynamic-localpv-provisioner | localpv-provisioner | 4.0.0 |
| https://openebs.github.io/lvm-localpv | lvm-localpv | 1.5.1 |
| https://openebs.github.io/mayastor-extensions | mayastor | 2.6.0 |
| https://openebs.github.io/zfs-localpv | zfs-localpv | 2.5.1 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| engines.local.lvm.enabled | bool | `true` | |
| engines.local.zfs.enabled | bool | `true` | |
| engines.replicated.mayastor.enabled | bool | `true` | |
| localpv-provisioner.rbac.create | bool | `true` | |
| lvm-localpv.crds.csi.volumeSnapshots.enabled | bool | `false` | |
| lvm-localpv.crds.lvmLocalPv.enabled | bool | `true` | |
| lvm-localpv.enabled | bool | `true` | |
| mayastor.crds.csi.volumeSnapshots.enabled | bool | `false` | |
| mayastor.csi.node.initContainers.enabled | bool | `true` | |
| mayastor.enabled | bool | `true` | |
| mayastor.localpv-provisioner.enabled | bool | `false` | |
| openebs-crds.csi.volumeSnapshots.enabled | bool | `true` | |
| openebs-crds.csi.volumeSnapshots.keep | bool | `true` | |
| preUpgradeHook | object | `{"image":{"pullPolicy":"IfNotPresent","registry":"docker.io","repo":"bitnami/kubectl","tag":"1.25.15"}}` | Configuration options for pre-upgrade helm hook job. |
| preUpgradeHook.image.pullPolicy | string | `"IfNotPresent"` | The imagePullPolicy for the container |
| preUpgradeHook.image.registry | string | `"docker.io"` | The container image registry URL for the hook job |
| preUpgradeHook.image.repo | string | `"bitnami/kubectl"` | The container repository for the hook job |
| preUpgradeHook.image.tag | string | `"1.25.15"` | The container image tag for the hook job |
| release.version | string | `"4.0.0"` | |
| zfs-localpv.crds.csi.volumeSnapshots.enabled | bool | `false` | |
| zfs-localpv.crds.zfsLocalPv.enabled | bool | `true` | |
| zfs-localpv.enabled | bool | `true` | |
23 changes: 23 additions & 0 deletions charts/charts/openebs-crds/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
4 changes: 4 additions & 0 deletions charts/charts/openebs-crds/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v2
name: openebs-crds
version: 4.0.0
description: A Helm chart that collects CustomResourceDefinitions (CRDs) from OpenEBS.
13 changes: 13 additions & 0 deletions charts/charts/openebs-crds/helm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# openebs-crds

![Version: 4.0.0](https://img.shields.io/badge/Version-4.0.0-informational?style=flat-square)

A Helm chart that collects CustomResourceDefinitions (CRDs) from OpenEBS.

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| csi.volumeSnapshots.enabled | bool | `true` | Install Volume Snapshot CRDs |
| csi.volumeSnapshots.keep | bool | `true` | Keep CRDs on chart uninstall |

18 changes: 18 additions & 0 deletions charts/charts/openebs-crds/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Adds extra annotations to CRDs. This targets two scenarios: preventing CRD recycling in case
the chart is removed; and adding custom annotations.
NOTE: This function assumes the element `metadata.annotations` already exists.
Usage:
{{- include "crds.extraAnnotations" .Values.csi.volumeSnapshots | nindent 4 }}
*/}}

{{- define "crds.extraAnnotations" -}}
{{- if .keep -}}
helm.sh/resource-policy: keep
{{ end }}
{{- with .annotations }}
{{- toYaml . }}
{{- end }}
{{- end -}}
Loading

0 comments on commit d8227cb

Please sign in to comment.