From 57c2264c59d2e36e1483b006434bdad9f0a77528 Mon Sep 17 00:00:00 2001 From: Kirill Demchenko Date: Fri, 12 May 2023 20:36:45 +0400 Subject: [PATCH] Added Helm Chart --- README.md | 4 +++ helm/Chart.yaml | 4 +++ helm/README.md | 5 +++ helm/templates/NOTES.txt | 3 ++ helm/templates/deployment.yaml | 58 ++++++++++++++++++++++++++++++++++ helm/templates/ingress.yaml | 24 ++++++++++++++ helm/templates/service.yaml | 12 +++++++ helm/values.yaml | 45 ++++++++++++++++++++++++++ 8 files changed, 155 insertions(+) create mode 100644 helm/Chart.yaml create mode 100644 helm/README.md create mode 100644 helm/templates/NOTES.txt create mode 100644 helm/templates/deployment.yaml create mode 100644 helm/templates/ingress.yaml create mode 100644 helm/templates/service.yaml create mode 100644 helm/values.yaml diff --git a/README.md b/README.md index 94b4779..f4fa0a3 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,10 @@ docker run -d \ If you are looking for MinIO + Notea docker configuration [check this](https://www.reddit.com/r/selfhosted/comments/n0jacf/notea_selfhosted_notetaking_app_stored_on_s3_aka/gw89iyo?utm_source=share&utm_medium=web2x&context=3) +### Kubernetes Helm Chart + +Use [helm chart](/helm) to deploy to Kubernetes via Helm. + ## Storage Configure environment variables according to storage service. diff --git a/helm/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000..2205d42 --- /dev/null +++ b/helm/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +appVersion: 0.0.1 +version: 0.0.1 +name: notea diff --git a/helm/README.md b/helm/README.md new file mode 100644 index 0000000..0f4cf3f --- /dev/null +++ b/helm/README.md @@ -0,0 +1,5 @@ +### Just simple Helm Chart + +Use this command to insall notea to kubernetes: + +`helm upgrade --install notea -n notea -f values.yaml .` diff --git a/helm/templates/NOTES.txt b/helm/templates/NOTES.txt new file mode 100644 index 0000000..1bf861a --- /dev/null +++ b/helm/templates/NOTES.txt @@ -0,0 +1,3 @@ +🎉 Notea has been installed! + +📎 Please check the service at https://{{ .Values.host }} diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml new file mode 100644 index 0000000..4dfe0b1 --- /dev/null +++ b/helm/templates/deployment.yaml @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-deployment + labels: + app: {{ .Release.Name }} +spec: + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }} + spec: + containers: + - name: {{ .Release.Name }} + image: "{{ .Values.image }}" + env: + - name: PASSWORD + value: "{{ .Values.application.password }}" + - name: STORE_ACCESS_KEY + value: "{{ .Values.application.store_access_key }}" + - name: STORE_SECRET_KEY + value: "{{ .Values.application.store_secret_key }}" + - name: STORE_BUCKET + value: "{{ .Values.application.store_bucket }}" + {{- if .Values.application.store_end_point }} + - name: STORE_END_POINT + value: "{{ .Values.application.store_end_point }}" + {{- end}} + {{- if .Values.application.store_force_path_style }} + - name: STORE_FORCE_PATH_STYLE + value: "{{ .Values.application.store_force_path_style }}" + {{- end}} + {{- if .Values.application.store_prefix }} + - name: STORE_PREFIX + value: "{{ .Values.application.store_prefix }}" + {{- end}} + {{- if .Values.application.cookie_secure }} + - name: COOKIE_SECURE + value: "{{ .Values.application.cookie_secure }}" + {{- end}} + {{- if .Values.application.base_url }} + - name: BASE_URL + value: "{{ .Values.application.base_url }}" + {{- end}} + {{- if .Values.application.disable_password }} + - name: DISABLE_PASSWORD + value: "{{ .Values.application.disable_password }}" + {{- end}} + {{- if .Values.application.direct_response_attachment }} + - name: DIRECT_RESPONSE_ATTACHMENT + value: "{{ .Values.application.direct_response_attachment }}" + {{- end}} + ports: + - containerPort: {{ .Values.service.port }} diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml new file mode 100644 index 0000000..6ca0992 --- /dev/null +++ b/helm/templates/ingress.yaml @@ -0,0 +1,24 @@ +{{- if .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: "nginx" + name: {{ .Release.Name }}-ingress +spec: + rules: + - host: "{{ .Values.ingress.host }}" + http: + paths: + - backend: + service: + name: {{ .Release.Name }}-service + port: + number: {{ .Values.service.port }} + path: / + pathType: Prefix +{{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} +{{- end -}} +{{- end }} diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml new file mode 100644 index 0000000..23297e4 --- /dev/null +++ b/helm/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-service +spec: + type: {{ .Values.service.type }} + selector: + app: {{ .Release.Name }} + ports: + - protocol: TCP + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000..576698f --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1,45 @@ +# docker image +image: cinwell/notea + +service: +# service port + port: 3000 +# service type + type: NodePort + +application: + # Required parameters: + # Password to login to the app + password: "" + # AccessKey + store_access_key: "" + # SecretKey + store_secret_key: "" + # Bucket + store_bucket: "" + # Optional parameters: + # Host name or an IP address. + store_end_point: "" + # region + store_region: "" + # Whether to force path style URLs for S3 objects + store_force_path_style: "" + # Storage path prefix + store_prefix: "" + # Only works under https: scheme If the website is not https, you may not be able to log in, and you need to set it to false + cookie_secure: "" + # The domain of the website, used for SEO + base_url: "" + # Disable password protection. This means that you need to implement authentication on the server yourself, + # but the route /share/:id needs to be accessible anonymously, if you need share page. #31 + disable_password: "" + # By default, requesting attachment links will redirect to S3 URL, Set to true to directly output attachments from the notea services. #28 + direct_response_attachment: "" + +ingress: + enabled: false + host: hotea.example.com + tls: + - hosts: + - hotea.example.com + secretName: example-ca