diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05c5d0ee319caf460180bfa0917e7b479c5f35dd..396e9316dd146921d64ec19f277f6010c6e8438c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,8 @@ stages: - release include: - actual/pipeline.yml +- asynqmon/pipeline.yml +- imghost/pipeline.yml - jellyfin/pipeline.yml - languagetool/pipeline.yml - mailu/pipeline.yml diff --git a/asynqmon/Chart.yaml b/asynqmon/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c348f33b4985a3feb342bfe76b84773ccfb20804 --- /dev/null +++ b/asynqmon/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: asynqmon +description: Helm Chart for asynqmon +type: application +version: 1.0.0 +appVersion: "v0.7.1" diff --git a/asynqmon/pipeline.yml b/asynqmon/pipeline.yml new file mode 100644 index 0000000000000000000000000000000000000000..b3aea8dc57184236dc7131c500c3c170f2f12b0d --- /dev/null +++ b/asynqmon/pipeline.yml @@ -0,0 +1,12 @@ +lint-asynqmon: + stage: lint + script: + - helm lint asynqmon + +release-asynqmon: + stage: release + script: + - apk add --no-cache git + - helm plugin install https://github.com/chartmuseum/helm-push.git + - helm repo add --username gitlab-ci-token --password $CI_JOB_TOKEN repo ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/stable + - helm cm-push asynqmon repo diff --git a/asynqmon/templates/_helpers.tpl b/asynqmon/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..41eb512781faad74be8f6624260936ea0265d8d6 --- /dev/null +++ b/asynqmon/templates/_helpers.tpl @@ -0,0 +1,56 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "asynqmon-helm.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "asynqmon-helm.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 "asynqmon-helm.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "asynqmon-helm.labels" -}} +helm.sh/chart: {{ include "asynqmon-helm.chart" . }} +{{ include "asynqmon-helm.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "asynqmon-helm.selectorLabels" -}} +app.kubernetes.io/name: {{ include "asynqmon-helm.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + + +{{- define "asynqmon-helm.sslPath" -}} +/certs +{{- end }} diff --git a/asynqmon/templates/configmap.yaml b/asynqmon/templates/configmap.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c2b433af88bea2bbcfb9aacd51a8691aabbd6d13 --- /dev/null +++ b/asynqmon/templates/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "asynqmon-helm.fullname" . }} + labels: + {{- include "asynqmon-helm.labels" . | nindent 4 }} +data: + redis-address: {{ .Values.redis.address }} + redis-database: {{ .Values.redis.database }} diff --git a/asynqmon/templates/deployment.yaml b/asynqmon/templates/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9a94784c9d1c9ff0b3afd3609d6d592913c0ea94 --- /dev/null +++ b/asynqmon/templates/deployment.yaml @@ -0,0 +1,85 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "asynqmon-helm.fullname" . }} + labels: + {{- include "asynqmon-helm.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "asynqmon-helm.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "asynqmon-helm.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: REDIS_ADDRESS + valueFrom: + configMapKeyRef: + name: {{ include "asynqmon-helm.fullname" . }} + key: redis-address + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "asynqmon-helm.fullname" . }} + key: redis-password + - name: REDIS_DATABASE + valueFrom: + configMapKeyRef: + name: {{ include "asynqmon-helm.fullname" . }} + key: redis-database + args: + - "--redis-addr=${REDIS_ADDRESS}" + - "--redis-password=${REDIS_PASSWORD}" + - "--redis-db=${REDIS_DATABASE}" + {{ if .Values.metrics.enabled }} + - "--enable-metrics-exporter" + {{ end }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + startupProbe: + httpGet: + path: / + port: http + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + 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 }} diff --git a/asynqmon/templates/ingress.yaml b/asynqmon/templates/ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6d5e583ee2522c07e3cecd973794e378f57381a0 --- /dev/null +++ b/asynqmon/templates/ingress.yaml @@ -0,0 +1,20 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "asynqmon-helm.fullname" . }} + labels: + {{- include "asynqmon-helm.labels" . | nindent 4 }} + annotations: + {{- .Values.ingress.annotations | toYaml | nindent 4 }} +spec: + rules: + - host: "{{ .Values.ingress.host }}" + http: + paths: + - path: "{{ .Values.ingress.path }}" + backend: + service: + name: {{ include "asynqmon-helm.fullname" . }} + port: + name: http + pathType: Prefix diff --git a/asynqmon/templates/secret.yaml b/asynqmon/templates/secret.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6d235385cedad45a33b687636dd62beb9994651f --- /dev/null +++ b/asynqmon/templates/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "asynqmon-helm.fullname" . }} + labels: + {{- include "asynqmon-helm.labels" . | nindent 4 }} +stringData: + redis-password: {{ .Values.redis.password }} diff --git a/asynqmon/templates/service.yaml b/asynqmon/templates/service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bcf3f93d734dccc555586fd51f13f1662bd6dc47 --- /dev/null +++ b/asynqmon/templates/service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "asynqmon-helm.fullname" . }} + {{ if .Values.metrics.enabled }} + annotations: + prometheus.io/path: "/metrics" + prometheus.io/port: "80" + prometheus.io/scrape: "true" + {{ end }} + labels: + {{- include "asynqmon-helm.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + selector: + {{- include "asynqmon-helm.selectorLabels" . | nindent 4 }} diff --git a/asynqmon/values.yaml b/asynqmon/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4a7b72faa2b0465760533b7e516edbe1963393a3 --- /dev/null +++ b/asynqmon/values.yaml @@ -0,0 +1,52 @@ +replicaCount: 1 + +image: + repository: hibiken/asynqmon + pullPolicy: IfNotPresent + tag: "" + +imagePullSecrets: [ ] +nameOverride: "" +fullnameOverride: "" + +redis: + address: "example.com:6379" + database: 0 + password: "" + +metrics: + enabled: false + +service: + type: ClusterIP + +ingress: + host: "example.com" + path: "/" + annotations: { } + +podAnnotations: { } + +podSecurityContext: + fsGroup: 2000 + +securityContext: + capabilities: + drop: + - ALL + runAsNonRoot: true + runAsUser: 1000 + +resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 10m + memory: 64Mi + +nodeSelector: { } + +tolerations: [ ] + +affinity: { } diff --git a/imghost/Chart.yaml b/imghost/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e8efff28cc738910da341a7c1d5b452a1c8919a5 --- /dev/null +++ b/imghost/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: imghost +description: Helm Chart for imghost +type: application +version: 1.0.0 +appVersion: "b05ab1e2" diff --git a/imghost/pipeline.yml b/imghost/pipeline.yml new file mode 100644 index 0000000000000000000000000000000000000000..913bff0c4500fc651db9313bca1db80947ff110c --- /dev/null +++ b/imghost/pipeline.yml @@ -0,0 +1,12 @@ +lint-imghost: + stage: lint + script: + - helm lint imghost + +release-imghost: + stage: release + script: + - apk add --no-cache git + - helm plugin install https://github.com/chartmuseum/helm-push.git + - helm repo add --username gitlab-ci-token --password $CI_JOB_TOKEN repo ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/stable + - helm cm-push imghost repo diff --git a/imghost/templates/_helpers.tpl b/imghost/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..b05418277e8a35a7602ce81f4a524b42effa6600 --- /dev/null +++ b/imghost/templates/_helpers.tpl @@ -0,0 +1,56 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "imghost-helm.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "imghost-helm.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 "imghost-helm.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "imghost-helm.labels" -}} +helm.sh/chart: {{ include "imghost-helm.chart" . }} +{{ include "imghost-helm.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "imghost-helm.selectorLabels" -}} +app.kubernetes.io/name: {{ include "imghost-helm.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + + +{{- define "imghost-helm.sslPath" -}} +/certs +{{- end }} diff --git a/imghost/templates/deployment-backend.yaml b/imghost/templates/deployment-backend.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c44132a935ee64251f8506ed1666991ab283631e --- /dev/null +++ b/imghost/templates/deployment-backend.yaml @@ -0,0 +1,82 @@ +{{- $defaultName := printf "%s-%s" "backend" .Chart.AppVersion -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "imghost-helm.fullname" . }}-backend + labels: + component: backend + {{- include "imghost-helm.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + component: backend + {{- include "imghost-helm.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + component: backend + {{- include "imghost-helm.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: data + {{- .Values.volumes.data | nindent 10 }} + - name: cache + {{- .Values.volumes.cache | nindent 10 }} + - name: config + secret: + secretName: {{ include "imghost-helm.fullname" . }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.backend.repository }}:{{ .Values.backend.tag | default $defaultName }}" + imagePullPolicy: {{ .Values.backend.pullPolicy }} + ports: + - name: metrics + containerPort: 2112 + protocol: TCP + startupProbe: + httpGet: + path: /healthz + port: metrics + livenessProbe: + httpGet: + path: /healthz + port: metrics + readinessProbe: + httpGet: + path: /healthz + port: metrics + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - mountPath: "/config.yaml" + name: config + subPath: "config" + - mountPath: "/data" + name: data + - mountPath: "/cache" + name: cache + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/imghost/templates/deployment-frontend.yaml b/imghost/templates/deployment-frontend.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2ae1b66b158b4e7ec3235aa8b6b454b6a22a40bc --- /dev/null +++ b/imghost/templates/deployment-frontend.yaml @@ -0,0 +1,82 @@ +{{- $defaultName := printf "%s-%s" "frontend" .Chart.AppVersion -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "imghost-helm.fullname" . }}-frontend + labels: + component: frontend + {{- include "imghost-helm.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + component: frontend + {{- include "imghost-helm.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + component: frontend + {{- include "imghost-helm.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: data + {{- .Values.volumes.data | nindent 10 }} + - name: cache + {{- .Values.volumes.cache | nindent 10 }} + - name: config + secret: + secretName: {{ include "imghost-helm.fullname" . }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.frontend.repository }}:{{ .Values.frontend.tag | default $defaultName }}" + imagePullPolicy: {{ .Values.frontend.pullPolicy }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + startupProbe: + httpGet: + path: /healthz + port: metrics + livenessProbe: + httpGet: + path: /healthz + port: metrics + readinessProbe: + httpGet: + path: /healthz + port: metrics + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - mountPath: "/config.yaml" + name: config + subPath: "config" + - mountPath: "/data" + name: data + - mountPath: "/cache" + name: cache + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/imghost/templates/ingress.yaml b/imghost/templates/ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7b0c9b35a2fe9b4db57cb518138ecf95ff572f8e --- /dev/null +++ b/imghost/templates/ingress.yaml @@ -0,0 +1,21 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "imghost-helm.fullname" . }}-frontend + labels: + component: frontend + {{- include "imghost-helm.labels" . | nindent 4 }} + annotations: + {{- .Values.ingress.annotations | toYaml | nindent 4 }} +spec: + rules: + - host: "{{ .Values.ingress.host }}" + http: + paths: + - path: "{{ .Values.ingress.path }}" + backend: + service: + name: {{ include "imghost-helm.fullname" . }}-frontend + port: + name: http + pathType: Prefix diff --git a/imghost/templates/secret.yaml b/imghost/templates/secret.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6eefcc10292ba05d54da30e5b856448972454aa4 --- /dev/null +++ b/imghost/templates/secret.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "imghost-helm.fullname" . }} + labels: + {{- include "imghost-helm.labels" . | nindent 4 }} +stringData: + config: |- + sourceFolder: /cache + targetFolder: /data + {{ .Values.config | toYaml | nindent 4 }} diff --git a/imghost/templates/service-backend.yaml b/imghost/templates/service-backend.yaml new file mode 100644 index 0000000000000000000000000000000000000000..eb295faca24a137b2cc94df7aafd5748236ffff0 --- /dev/null +++ b/imghost/templates/service-backend.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "imghost-helm.fullname" . }}-backend + {{ if .Values.metrics.enabled }} + annotations: + prometheus.io/path: "/metrics" + prometheus.io/port: "80" + prometheus.io/scrape: "true" + {{ end }} + labels: + component: backend + {{- include "imghost-helm.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 80 + targetPort: metrics + protocol: TCP + name: metrics + selector: + component: backend + {{- include "imghost-helm.selectorLabels" . | nindent 4 }} diff --git a/imghost/templates/service-frontend.yaml b/imghost/templates/service-frontend.yaml new file mode 100644 index 0000000000000000000000000000000000000000..eeb5e2894c6d75e07275f2989eb30e5fe9caca2a --- /dev/null +++ b/imghost/templates/service-frontend.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "imghost-helm.fullname" . }}-frontend + {{ if .Values.metrics.enabled }} + annotations: + prometheus.io/path: "/metrics" + prometheus.io/port: "80" + prometheus.io/scrape: "true" + {{ end }} + labels: + component: frontend + {{- include "imghost-helm.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + selector: + component: frontend + {{- include "imghost-helm.selectorLabels" . | nindent 4 }} diff --git a/imghost/values.yaml b/imghost/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..161f39e8d5b7e4516f148fdd0fd7351e7f7763f3 --- /dev/null +++ b/imghost/values.yaml @@ -0,0 +1,84 @@ +replicaCount: 1 + +imagePullSecrets: [ ] +nameOverride: "" +fullnameOverride: "" + +frontend: + repository: k8r.eu/justjanne/imghost + pullPolicy: IfNotPresent + tag: "" + +backend: + repository: k8r.eu/justjanne/imghost + pullPolicy: IfNotPresent + tag: "" + +config: + sizes: + - suffix: "s" + size: + format: "cover" + height: 90 + width: 90 + - suffix: "" + size: + format: "contain" + height: 0 + width: 0 + quality: + compressionQuality: 100 + samplingFactors: [1, 1] + redis: + address: "example.com" + password: "" + database: 0 + database: + format: "postgres" + url: "postgresql://user:pass@host/db" + concurrency: 10 + uploadTimeout: "15m" + baseUrl: "http://example.com" + +metrics: + enabled: false + +volumes: + data: |- + emptyDir: {} + cache: |- + emptyDir: {} + +service: + type: ClusterIP + +ingress: + host: "example.com" + path: "/" + annotations: { } + +podAnnotations: { } + +podSecurityContext: + fsGroup: 2000 + +securityContext: + capabilities: + drop: + - ALL + runAsNonRoot: true + runAsUser: 1000 + +resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 10m + memory: 64Mi + +nodeSelector: { } + +tolerations: [ ] + +affinity: { }