Skip to content

Commit

Permalink
feat(helm): support ekuiper plugins volumes (#2403)
Browse files Browse the repository at this point in the history
Signed-off-by: Rory Z <[email protected]>
  • Loading branch information
Rory-Z authored Nov 14, 2023
1 parent a8b8d55 commit 4a0bd4e
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deploy/chart/ekuiper/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ version: 1.3.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 1.6.0
appVersion: 1.11
8 changes: 6 additions & 2 deletions deploy/chart/ekuiper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A lightweight IoT edge analytic software

## Install the Chart

- From Github
- From GitHub
```
git clone https://github.com/lf-edge/ekuiper.git
cd deploy/chart/ekuiper
Expand Down Expand Up @@ -33,9 +33,13 @@ helm uninstall my-ekuiper
| ekuiperEnv | object | `{"enabled":true,"key":{"mqttDefaultServer":"MQTT_SOURCE__DEFAULT__SERVER"},"value":{"mqttDefaultServer":"tcp://broker.emqx.io:1883"}}` | remove this when the mqtt_source configmap is available |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"lfedge/ekuiper"` | |
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
| nodeSelector | object | `{}` | |
| persistence.accessMode | string | `"ReadWriteOnce"` | |
| persistence.enabled | bool | `false` | |
| persistence.storageClass | string | "" | Storage class of backing PVC|
| persistence.existingClaim| string | "" | EMQX data Persistent Volume existing claim name, evaluated as a template |
| persistence.accessMode | string | ReadWriteOnce | PVC Access Mode for volume |
| persistence.size` | string | 20Mi | PVC Storage Request for EMQX volume |
| persistence.existingClaim | string | `""` | Existing PersistentVolumeClaims The value is evaluated as a template So, for example, the name can depend on .Release or .Chart |
| resources | object | `{}` | |
| service.annotations | object | `{}` | Provide any additional annotations which may be required. Evaluated as a template |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: {{ include "ekuiper.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "ekuiper.labels" . | nindent 4 }}
spec:
serviceName: {{ include "ekuiper.fullname" . }}-headless
replicas: 1
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
volumeClaimTemplates:
- metadata:
name: ekuiper-data
namespace: {{ .Release.Namespace }}
labels:
{{- include "ekuiper.labels" . | nindent 10 }}
spec:
{{- if .Values.persistence.storageClassName }}
storageClassName: {{ .Values.persistence.storageClassName | quote }}
{{- end }}
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
- metadata:
name: ekuiper-plugins
namespace: {{ .Release.Namespace }}
labels:
{{- include "ekuiper.labels" . | nindent 10 }}
spec:
{{- if .Values.persistence.storageClassName }}
storageClassName: {{ .Values.persistence.storageClassName | quote }}
{{- end }}
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}
selector:
matchLabels:
{{- include "ekuiper.selectorLabels" . | nindent 6 }}
Expand All @@ -17,13 +49,24 @@ spec:
spec:
serviceAccountName: {{ include "ekuiper.serviceAccountName" . }}
volumes:
- name: ekuiper-log
emptyDir: {}
{{- if not .Values.persistence.enabled }}
- name: ekuiper-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ (tpl .Values.persistence.existingClaim $) | default (include "ekuiper.fullname" .) }}
{{- else }}
emptyDir: {}
- name: ekuiper-plugins
{{- else if .Values.persistence.existingClaim }}
- name: ekuiper-data
persistentVolumeClaim:
{{- with .Values.persistence.existingClaim }}
claimName: {{ tpl . $ }}
{{- end }}
- name: ekuiper-plugins
persistentVolumeClaim:
{{- with .Values.persistence.existingClaim }}
claimName: {{ tpl . $ }}
{{- end }}
{{- end }}
- name: kuiper-config
configMap:
name: {{ include "ekuiper.fullname" . }}
Expand All @@ -44,14 +87,19 @@ spec:
{{- end }}
containers:
- name: ekuiper
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.ekuiperEnv.enabled }}
env:
- name: {{ .Values.ekuiperEnv.key.mqttDefaultServer }}
value: {{ .Values.ekuiperEnv.value.mqttDefaultServer }}
{{- end }}
command: ["./bin/kuiperd"]
command:
- /bin/sh
- -c
- |
mkdir -p /kuiper/plugins/functions /kuiper/plugins/portable /kuiper/plugins/sinks /kuiper/plugins/sources /kuiper/plugins/wasm
/kuiper/bin/kuiperd
readinessProbe:
httpGet:
{{- $restPort := index .Values "kuiperConfig" "kuiper.yaml" "basic" "restPort" }}
Expand All @@ -66,8 +114,12 @@ spec:
- name: ekuiper
containerPort: {{ $port | default 20498 }}
volumeMounts:
- name: ekuiper-log
mountPath: "/kuiper/log"
- name: ekuiper-data
mountPath: "/kuiper/data"
- name: ekuiper-plugins
mountPath: "/kuiper/plugins"
{{- if .Values.tls.enabled }}
- name: certs
mountPath: "/var/kuiper/xyz-rootca.pem"
Expand Down
22 changes: 22 additions & 0 deletions deploy/chart/ekuiper/templates/svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,25 @@ spec:
{{- end }}
selector:
{{- include "ekuiper.selectorLabels" . | nindent 4 }}

---
apiVersion: v1
kind: Service
metadata:
name: {{ include "ekuiper.fullname" . }}-headless
namespace: {{ .Release.Namespace }}
labels:
{{- include "ekuiper.labels" . | nindent 4 }}
spec:
clusterIP: None
ports:
- name: {{ .Values.service.ports.restapi.name }}
port: {{ .Values.service.ports.restapi.port | default 9081 }}
protocol: TCP
targetPort: restapi
- name: {{ .Values.service.ports.ekuiper.name }}
port: {{ .Values.service.ports.ekuiper.port | default 20498 }}
protocol: TCP
targetPort: ekuiper
selector:
{{- include "ekuiper.selectorLabels" . | nindent 4 }}
7 changes: 5 additions & 2 deletions deploy/chart/ekuiper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
image:
repository: lfedge/ekuiper
pullPolicy: IfNotPresent

# Overrides the image tag whose default is the chart appVersion.
tag: ""

serviceAccount:
# Specifies whether a service account should be created
Expand Down Expand Up @@ -56,7 +57,9 @@ service:
annotations: {}

persistence:
enabled: false
enabled: enabled
size: 20Mi
storageClassName: ""
accessMode: ReadWriteOnce
# -- Existing PersistentVolumeClaims
# The value is evaluated as a template
Expand Down

0 comments on commit 4a0bd4e

Please sign in to comment.