first commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
notely/values.testing.yaml
|
||||||
6
notely/Chart.yaml
Normal file
6
notely/Chart.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: notely
|
||||||
|
description: Helm chart for deploying Notely (notely) with MongoDB and optional Redis
|
||||||
|
type: application
|
||||||
|
version: 0.1.0
|
||||||
|
appVersion: "latest"
|
||||||
69
notely/README.md
Normal file
69
notely/README.md
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# notely Helm Chart
|
||||||
|
|
||||||
|
This chart deploys Notely (notely) and can also provision MongoDB and Redis.
|
||||||
|
|
||||||
|
## What this chart creates
|
||||||
|
|
||||||
|
- notely Deployment and Service
|
||||||
|
- ConfigMap and Secret for application configuration
|
||||||
|
- Optional MongoDB StatefulSet, Service, Secret, and PVC
|
||||||
|
- Optional Redis Deployment and Service
|
||||||
|
- Optional Ingress
|
||||||
|
- Optional HPA
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm install notely ./notely -n notely --create-namespace
|
||||||
|
```
|
||||||
|
|
||||||
|
## Upgrade
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm upgrade notely ./notely -n notely
|
||||||
|
```
|
||||||
|
|
||||||
|
## Uninstall
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm uninstall notely -n notely
|
||||||
|
```
|
||||||
|
|
||||||
|
## Important values
|
||||||
|
|
||||||
|
- `image.repository`, `image.tag`
|
||||||
|
- `secrets.jwtSecret`, `secrets.encryptionKey`
|
||||||
|
- `secrets.defaultAdminEmail`, `secrets.defaultAdminUsername`, `secrets.defaultAdminPassword`
|
||||||
|
- `secrets.redisUser`, `secrets.redisPassword`
|
||||||
|
- `mongodb.enabled` and `mongodb.auth.*`
|
||||||
|
- `redis.enabled` and `redis.auth.enabled`
|
||||||
|
- `ingress.enabled`
|
||||||
|
- `autoscaling.enabled`
|
||||||
|
|
||||||
|
## Example override file
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
image:
|
||||||
|
repository: your-registry/notely
|
||||||
|
tag: v1.0.0
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
jwtSecret: replace-with-production-secret
|
||||||
|
encryptionKey: 32-char-encryption-key-goes-here
|
||||||
|
defaultAdminEmail: admin@example.com
|
||||||
|
defaultAdminUsername: admin
|
||||||
|
defaultAdminPassword: replace-with-strong-password
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
className: nginx
|
||||||
|
annotations:
|
||||||
|
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
||||||
|
hosts:
|
||||||
|
- host: notely.local
|
||||||
|
paths:
|
||||||
|
- path: /api
|
||||||
|
pathType: Prefix
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
```
|
||||||
5
notely/templates/NOTES.txt
Normal file
5
notely/templates/NOTES.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
1. Get the application URL by running these commands:
|
||||||
|
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "notely.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||||
|
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||||
|
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||||
|
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||||
58
notely/templates/_helpers.tpl
Normal file
58
notely/templates/_helpers.tpl
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{{/* Expand the name of the chart. */}}
|
||||||
|
{{- define "notely.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Create a default fully qualified app name. */}}
|
||||||
|
{{- define "notely.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride }}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||||
|
{{- if contains $name .Release.Name }}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Create chart name and version as used by the chart label. */}}
|
||||||
|
{{- define "notely.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Common labels. */}}
|
||||||
|
{{- define "notely.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "notely.chart" . }}
|
||||||
|
{{ include "notely.selectorLabels" . }}
|
||||||
|
{{- if .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Selector labels. */}}
|
||||||
|
{{- define "notely.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "notely.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Create the name of the service account to use */}}
|
||||||
|
{{- define "notely.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
{{- default (include "notely.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else }}
|
||||||
|
{{- default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* MongoDB resource name */}}
|
||||||
|
{{- define "notely.mongodb.fullname" -}}
|
||||||
|
{{- printf "%s-mongodb" (include "notely.fullname" .) | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Redis resource name */}}
|
||||||
|
{{- define "notely.redis.fullname" -}}
|
||||||
|
{{- printf "%s-redis" (include "notely.fullname" .) | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end }}
|
||||||
69
notely/templates/app-deployment.yaml
Normal file
69
notely/templates/app-deployment.yaml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
{{- if not .Values.autoscaling.enabled }}
|
||||||
|
replicas: {{ .Values.replicaCount }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "notely.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
{{- with .Values.podAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.selectorLabels" . | nindent 8 }}
|
||||||
|
{{- with .Values.podLabels }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
serviceAccountName: {{ include "notely.serviceAccountName" . }}
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: {{ include "notely.name" . }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: {{ .Values.service.port }}
|
||||||
|
protocol: TCP
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: {{ include "notely.fullname" . }}-config
|
||||||
|
- secretRef:
|
||||||
|
name: {{ include "notely.fullname" . }}-secrets
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: http
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: http
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
15
notely/templates/app-service.yaml
Normal file
15
notely/templates/app-service.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.service.port }}
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
{{- include "notely.selectorLabels" . | nindent 4 }}
|
||||||
12
notely/templates/configmap.yaml
Normal file
12
notely/templates/configmap.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.fullname" . }}-config
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
PORT: {{ .Values.appConfig.port | quote }}
|
||||||
|
FRONTEND_URL: {{ .Values.appConfig.frontendUrl | quote }}
|
||||||
|
SESSION_TTL_HOURS: {{ .Values.appConfig.sessionTtlHours | quote }}
|
||||||
|
REDIS_DB: {{ .Values.appConfig.redisDb | quote }}
|
||||||
|
REDIS_ADDR: {{- if .Values.appConfig.redisAddr }} {{ .Values.appConfig.redisAddr | quote }} {{- else if .Values.redis.enabled }} {{ printf "%s:%v" (include "notely.redis.fullname" .) .Values.redis.service.port | quote }} {{- else }} "" {{- end }}
|
||||||
28
notely/templates/hpa.yaml
Normal file
28
notely/templates/hpa.yaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{{- if .Values.autoscaling.enabled }}
|
||||||
|
apiVersion: autoscaling/v2
|
||||||
|
kind: HorizontalPodAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
scaleTargetRef:
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
name: {{ include "notely.fullname" . }}
|
||||||
|
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||||
|
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||||
|
metrics:
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: cpu
|
||||||
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: memory
|
||||||
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||||
|
{{- end }}
|
||||||
35
notely/templates/ingress.yaml
Normal file
35
notely/templates/ingress.yaml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.ingress.className }}
|
||||||
|
ingressClassName: {{ .Values.ingress.className }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
- host: {{ .host | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- range .paths }}
|
||||||
|
- path: {{ .path }}
|
||||||
|
pathType: {{ .pathType }}
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: {{ include "notely.fullname" $ }}
|
||||||
|
port:
|
||||||
|
number: {{ $.Values.service.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
17
notely/templates/mongodb-pvc.yaml
Normal file
17
notely/templates/mongodb-pvc.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{{- if and .Values.mongodb.enabled .Values.mongodb.persistence.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.mongodb.fullname" . }}-pvc
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.mongodb.persistence.size }}
|
||||||
|
{{- if .Values.mongodb.persistence.storageClass }}
|
||||||
|
storageClassName: {{ .Values.mongodb.persistence.storageClass | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
12
notely/templates/mongodb-secret.yaml
Normal file
12
notely/templates/mongodb-secret.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{{- if .Values.mongodb.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.mongodb.fullname" . }}-credentials
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
username: {{ .Values.mongodb.auth.username | quote }}
|
||||||
|
password: {{ .Values.mongodb.auth.password | quote }}
|
||||||
|
{{- end }}
|
||||||
18
notely/templates/mongodb-service.yaml
Normal file
18
notely/templates/mongodb-service.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{{- if .Values.mongodb.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.mongodb.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
clusterIP: None
|
||||||
|
ports:
|
||||||
|
- port: 27017
|
||||||
|
targetPort: mongodb
|
||||||
|
protocol: TCP
|
||||||
|
name: mongodb
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: {{ include "notely.name" . }}-mongodb
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
74
notely/templates/mongodb-statefulset.yaml
Normal file
74
notely/templates/mongodb-statefulset.yaml
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
{{- if .Values.mongodb.enabled }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.mongodb.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
serviceName: {{ include "notely.mongodb.fullname" . }}
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ include "notely.name" . }}-mongodb
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "notely.name" . }}-mongodb
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: mongodb
|
||||||
|
image: "{{ .Values.mongodb.image.repository }}:{{ .Values.mongodb.image.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.mongodb.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- containerPort: 27017
|
||||||
|
name: mongodb
|
||||||
|
env:
|
||||||
|
- name: MONGO_INITDB_ROOT_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "notely.mongodb.fullname" . }}-credentials
|
||||||
|
key: username
|
||||||
|
- name: MONGO_INITDB_ROOT_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "notely.mongodb.fullname" . }}-credentials
|
||||||
|
key: password
|
||||||
|
- name: MONGO_INITDB_DATABASE
|
||||||
|
value: {{ .Values.mongodb.auth.database | quote }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: mongodb-storage
|
||||||
|
mountPath: /data/db
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- mongosh "mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@localhost:27017/admin?authSource=admin" --quiet --eval "db.adminCommand('ping').ok"
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
timeoutSeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- mongosh "mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@localhost:27017/admin?authSource=admin" --quiet --eval "db.adminCommand('ping').ok"
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.mongodb.resources | nindent 12 }}
|
||||||
|
{{- if .Values.mongodb.persistence.enabled }}
|
||||||
|
volumes:
|
||||||
|
- name: mongodb-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ include "notely.mongodb.fullname" . }}-pvc
|
||||||
|
{{- else }}
|
||||||
|
volumes:
|
||||||
|
- name: mongodb-storage
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
90
notely/templates/redis-deployment.yaml
Normal file
90
notely/templates/redis-deployment.yaml
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
{{- if .Values.redis.enabled }}
|
||||||
|
{{- $redisUser := .Values.secrets.redisUser | default "" }}
|
||||||
|
{{- $redisPassword := .Values.secrets.redisPassword | default "" }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.redis.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ include "notely.name" . }}-redis
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "notely.name" . }}-redis
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: redis
|
||||||
|
image: "{{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.redis.image.pullPolicy }}
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: {{ include "notely.fullname" . }}-secrets
|
||||||
|
{{- if .Values.redis.auth.enabled }}
|
||||||
|
{{- if $redisUser }}
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
cat <<EOF > /tmp/users.acl
|
||||||
|
user default off
|
||||||
|
user ${REDIS_USER} on >${REDIS_PASSWORD} ~* &* +@all
|
||||||
|
EOF
|
||||||
|
exec redis-server --aclfile /tmp/users.acl
|
||||||
|
{{- else }}
|
||||||
|
command:
|
||||||
|
- redis-server
|
||||||
|
- --requirepass
|
||||||
|
- {{ required "secrets.redisPassword must be set when redis.auth.enabled=true" $redisPassword | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- containerPort: {{ .Values.redis.service.port }}
|
||||||
|
name: redis
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
{{- if .Values.redis.auth.enabled }}
|
||||||
|
{{- if $redisUser }}
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- redis-cli --user "$REDIS_USER" -a "$REDIS_PASSWORD" ping
|
||||||
|
{{- else }}
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- redis-cli -a "$REDIS_PASSWORD" ping
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
- redis-cli
|
||||||
|
- ping
|
||||||
|
{{- end }}
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
{{- if .Values.redis.auth.enabled }}
|
||||||
|
{{- if $redisUser }}
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- redis-cli --user "$REDIS_USER" -a "$REDIS_PASSWORD" ping
|
||||||
|
{{- else }}
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- redis-cli -a "$REDIS_PASSWORD" ping
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
- redis-cli
|
||||||
|
- ping
|
||||||
|
{{- end }}
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.redis.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
18
notely/templates/redis-service.yaml
Normal file
18
notely/templates/redis-service.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{{- if .Values.redis.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.redis.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.redis.service.port }}
|
||||||
|
targetPort: redis
|
||||||
|
protocol: TCP
|
||||||
|
name: redis
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: {{ include "notely.name" . }}-redis
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
16
notely/templates/secret.yaml
Normal file
16
notely/templates/secret.yaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.fullname" . }}-secrets
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
JWT_SECRET: {{ .Values.secrets.jwtSecret | quote }}
|
||||||
|
ENCRYPTION_KEY: {{ .Values.secrets.encryptionKey | quote }}
|
||||||
|
DEFAULT_ADMIN_EMAIL: {{ .Values.secrets.defaultAdminEmail | quote }}
|
||||||
|
DEFAULT_ADMIN_USERNAME: {{ .Values.secrets.defaultAdminUsername | quote }}
|
||||||
|
DEFAULT_ADMIN_PASSWORD: {{ .Values.secrets.defaultAdminPassword | quote }}
|
||||||
|
REDIS_USER: {{- if and .Values.redis.enabled (not .Values.redis.auth.enabled) }} "" {{- else }} {{ .Values.secrets.redisUser | quote }} {{- end }}
|
||||||
|
REDIS_PASSWORD: {{- if and .Values.redis.enabled (not .Values.redis.auth.enabled) }} "" {{- else }} {{ .Values.secrets.redisPassword | quote }} {{- end }}
|
||||||
|
MONGODB_URI: {{- if .Values.mongodb.enabled }} {{ printf "mongodb://%s:%s@%s:27017/%s?authSource=admin" .Values.mongodb.auth.username .Values.mongodb.auth.password (include "notely.mongodb.fullname" .) .Values.mongodb.auth.database | quote }} {{- else }} {{ .Values.secrets.mongodbUri | quote }} {{- end }}
|
||||||
13
notely/templates/serviceaccount.yaml
Normal file
13
notely/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ include "notely.serviceAccountName" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "notely.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
|
||||||
|
{{- end }}
|
||||||
111
notely/values.yaml
Normal file
111
notely/values.yaml
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
replicaCount: 2
|
||||||
|
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
image:
|
||||||
|
repository: gitea.hostxtra.co.uk/mrhid6/notely
|
||||||
|
tag: latest
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
imagePullSecrets: []
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
podLabels: {}
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
create: false
|
||||||
|
automount: true
|
||||||
|
annotations: {}
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 8080
|
||||||
|
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
|
||||||
|
appConfig:
|
||||||
|
port: "8080"
|
||||||
|
frontendUrl: "http://localhost"
|
||||||
|
sessionTtlHours: "168"
|
||||||
|
redisAddr: ""
|
||||||
|
redisDb: "0"
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
jwtSecret: "change-me-super-secret-jwt-key-minimum-32-characters"
|
||||||
|
encryptionKey: "00000000000000000000000000000000"
|
||||||
|
defaultAdminEmail: "admin@notely.local"
|
||||||
|
defaultAdminUsername: "admin"
|
||||||
|
defaultAdminPassword: "ChangeThisAdminPassword123!"
|
||||||
|
mongodbUri: ""
|
||||||
|
redisUser: ""
|
||||||
|
redisPassword: ""
|
||||||
|
|
||||||
|
mongodb:
|
||||||
|
enabled: true
|
||||||
|
image:
|
||||||
|
repository: mongo
|
||||||
|
tag: "8.0"
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
auth:
|
||||||
|
username: admin
|
||||||
|
password: password
|
||||||
|
database: notely
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
storageClass: ""
|
||||||
|
size: 10Gi
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
|
||||||
|
redis:
|
||||||
|
enabled: true
|
||||||
|
image:
|
||||||
|
repository: redis
|
||||||
|
tag: 8-alpine
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
service:
|
||||||
|
port: 6379
|
||||||
|
auth:
|
||||||
|
enabled: false
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 256Mi
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
className: nginx
|
||||||
|
annotations: {}
|
||||||
|
hosts:
|
||||||
|
- host: notely.local
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
tls: []
|
||||||
|
|
||||||
|
autoscaling:
|
||||||
|
enabled: false
|
||||||
|
minReplicas: 2
|
||||||
|
maxReplicas: 10
|
||||||
|
targetCPUUtilizationPercentage: 70
|
||||||
|
targetMemoryUtilizationPercentage: 80
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
tolerations: []
|
||||||
|
affinity: {}
|
||||||
Reference in New Issue
Block a user