Skip to content

Commit

Permalink
feat: add "helm.sh/resource-policy" annotation (#234)
Browse files Browse the repository at this point in the history
Signed-off-by: Engin Diri <engin.diri@ediri.de>
  • Loading branch information
dirien authored Apr 25, 2023
1 parent ca1718e commit b7e4957
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ jobs:

- name: Run helm unittest
run: |
helm plugin install https://github.com/quintush/helm-unittest
helm unittest charts/node-red -3
helm plugin install https://github.com/helm-unittest/helm-unittest
helm unittest charts/node-red
- name: Create kind cluster
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00 # v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions charts/node-red/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ icon: https://nodered.org/about/resources/media/node-red-icon-2.png

type: application

version: 0.22.8
version: 0.23.1
appVersion: 3.0.2

keywords:
Expand All @@ -29,7 +29,7 @@ maintainers:
annotations:
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/changes: |
- update quay.io/kiwigrid/k8s-sidecar to 1.23.1
- add "helm.sh/resource-policy" annotation to prevent helm from deleting the PVC
artifacthub.io/images: |
- name: node-red
image: docker.io/nodered/node-red:3.0.2
Expand Down
7 changes: 4 additions & 3 deletions charts/node-red/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# node-red ⚙

![Version: 0.22.8](https://img.shields.io/badge/Version-0.22.8-informational?style=for-the-badge) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=for-the-badge) ![AppVersion: 3.0.2](https://img.shields.io/badge/AppVersion-3.0.2-informational?style=for-the-badge)
![Version: 0.23.1](https://img.shields.io/badge/Version-0.23.1-informational?style=for-the-badge) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=for-the-badge) ![AppVersion: 3.0.2](https://img.shields.io/badge/AppVersion-3.0.2-informational?style=for-the-badge)

[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/node-red&style=for-the-badge)](https://artifacthub.io/packages/search?repo=node-red)
[![SIT](https://img.shields.io/badge/SIT-awesome-blueviolet.svg?style=for-the-badge)](https://jobs.schwarz)
Expand All @@ -16,7 +16,7 @@ A Helm chart for Node-Red, a low-code programming for event-driven applications
To install the chart using the OCI artifact, run:

```bash
helm install node-red oci://ghcr.io/schwarzit/charts/node-red --version 0.22.8
helm install node-red oci://ghcr.io/schwarzit/charts/node-red --version 0.23.1
```

## Usage
Expand All @@ -32,7 +32,7 @@ helm repo update
To install the chart with the release name node-red run:

```bash
helm install node-red node-red/node-red --version 0.22.8
helm install node-red node-red/node-red --version 0.23.1
```

After a few seconds, node-red should be running.
Expand Down Expand Up @@ -98,6 +98,7 @@ The command removes all the Kubernetes components associated with the chart and
| npmrc.registry | string | `"https://registry.npmjs.org"` | Configuration to use any compatible registry |
| persistence.accessMode | string | `"ReadWriteOnce"` | Persistence access mode |
| persistence.enabled | bool | `false` | Use persistent volume to store data |
| persistence.keepPVC | bool | `false` | ## Keep a created Persistent volume claim when uninstalling the helm chart (default: false) |
| persistence.size | string | `"5Gi"` | Size of persistent volume claim |
| podAnnotations | object | `{}` | Pod annotations |
| podLabels | object | `{}` | Labels to add to the node-red pod. default: {} |
Expand Down
6 changes: 5 additions & 1 deletion charts/node-red/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ metadata:
helm.sh/chart: {{ include "node-red.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.persistence.keepPVC }}
annotations:
helm.sh/resource-policy: keep
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
Expand All @@ -21,4 +25,4 @@ spec:
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/node-red/tests/flow_refresh_cm_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ tests:
- ./values/sidecar_values.yaml
asserts:
- isNotEmpty:
path: data.flow_refresh\.sh
path: data
2 changes: 2 additions & 0 deletions charts/node-red/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ persistence:
accessMode: ReadWriteOnce
# -- Size of persistent volume claim
size: 5Gi
# -- ## Keep a created Persistent volume claim when uninstalling the helm chart (default: false)
keepPVC: false

# -- containers which are run before the app containers are started
initContainers: []
Expand Down

0 comments on commit b7e4957

Please sign in to comment.