git.iko.soy/typeable/octopod
on master help sign in
Helm3 chart (#44)

* add helm3 chart * add reference to a helm3 chart to docs Co-authored-by: Aleksei Sizov <a.sizov@typeable.io>

commit291c3c4c4ea569d70e608c42f1068a30f55ae14e authorAlex-Sizov <45825279+Alex-Sizov@users.noreply.github.com> dateWed 12 May 2021, 17:02 (5 years ago) parent92ee8d3
21 files changed+1041
charts/helm3/octopod/.helmignore+23 charts/helm3/octopod/Chart.lock+6 charts/helm3/octopod/Chart.yaml+20 charts/helm3/octopod/README.md+158 charts/helm3/octopod/templates/_helpers.tpl+98 charts/helm3/octopod/templates/deployment.yaml+163 charts/helm3/octopod/templates/ingress-app.yaml+47 charts/helm3/octopod/templates/ingress-powerapp.yaml+40 charts/helm3/octopod/templates/ingress-ui.yaml+41 charts/helm3/octopod/templates/ingress-ws.yaml+41 charts/helm3/octopod/templates/migration-job.yaml+77 charts/helm3/octopod/templates/nginx-configmap.yaml+24 charts/helm3/octopod/templates/octopod-basic-auth-secret.yaml+10 charts/helm3/octopod/templates/octopod-configmap.yaml+20 charts/helm3/octopod/templates/rbac.yaml+30 charts/helm3/octopod/templates/service.yaml+16 charts/helm3/octopod/templates/serviceaccount.yaml+12 charts/helm3/octopod/values-test.yaml+104 charts/helm3/octopod/values.yaml+104 docs/en/Octopod_deployment_guide.md+4 docs/ru/Octopod_deployment_with_K8S.md+3
charts/helm3/octopod/.helmignorenew file+23
@@ -0,0 +1,23 @@
1+# Patterns to ignore when building packages.
2+# This supports shell glob matching, relative path matching, and
3+# negation (prefixed with !). Only one pattern per line.
4+.DS_Store
5+# Common VCS dirs
6+.git/
7+.gitignore
8+.bzr/
9+.bzrignore
10+.hg/
11+.hgignore
12+.svn/
13+# Common backup files
14+*.swp
15+*.bak
16+*.tmp
17+*.orig
18+*~
19+# Various IDEs
20+.project
21+.idea/
22+*.tmproj
23+.vscode/
charts/helm3/octopod/Chart.locknew file+6
@@ -0,0 +1,6 @@
1+dependencies:
2+- name: postgresql
3+ repository: https://charts.bitnami.com/bitnami
4+ version: 10.4.2
5+digest: sha256:616138842fd07e138b0e8d6b7dac7989942b01a94967c37ca41c94e3fe93e9e4
6+generated: "2021-05-07T21:02:01.403373727+03:00"
charts/helm3/octopod/Chart.yamlnew file+20
@@ -0,0 +1,20 @@
1+apiVersion: v2
2+name: octopod
3+description: An opensource self-hosted solution for managing multiple deployments in a Kubernetes cluster.
4+type: application
5+version: 0.0.1
6+appVersion: 1.1
7+keywords:
8+ - kubernetes
9+ - octopod
10+home: https://octopod.site
11+sources:
12+ - https://github.com/typeable/octopod
13+maintainers:
14+ - name: Alex Sizov
15+ email: a.sizov@typeable.io
16+dependencies:
17+ - name: postgresql
18+ version: 10.4.2
19+ repository: https://charts.bitnami.com/bitnami
20+ condition: postgresql.enabled
charts/helm3/octopod/README.mdnew file+158
@@ -0,0 +1,158 @@
1+# Octopod
2+
3+### This is beta version of a chart!
4+
5+[Octopod](https://octopod.site/) is a fully open-source self-hosted solution for managing multiple deployments in a Kubernetes cluster with a user-friendly web interface. Managing deployments does not require any technical expertise.
6+
7+## TL;DR
8+TBD (install chart from typeable's chart repository)
9+
10+## Introduction
11+
12+This chart bootstraps an Octopod deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
13+
14+## Prerequisites
15+
16+- Kubernetes 1.12+
17+- Helm 3.1.0
18+- PV support (for postgresql persistense)
19+- nginx-ingress controller
20+
21+## Installing the Chart
22+This chart will not create or delete any namespaces for you.
23+You'll need to create 2 namespaces before installing:
24+First in which octopod will be installed
25+```console
26+$ kubectl create namespace octopod
27+```
28+Second in which Octopod will deploy all it's deployments (configured in octopod.deploymentNamespace)
29+```console
30+$ kubectl create namespace octopod-deployments
31+```
32+Also you need to generate certificates for octo client<->octopod server communication.
33+
34+Generate certificates
35+```bash
36+mkdir certs
37+cd certs && \
38+openssl req -x509 -newkey rsa:4096 -keyout server_key.pem -out server_cert.pem -nodes -subj "/CN=localhost/O=Server" && \
39+openssl req -newkey rsa:4096 -keyout client_key.pem -out client_csr.pem -nodes -subj "/CN=Client" && \
40+openssl x509 -req -in client_csr.pem -CA server_cert.pem -CAkey server_key.pem -out client_cert.pem -set_serial 01 -days 3650
41+
42+```
43+Create configmap from generated certificates
44+```console
45+kubectl create configmap octopod-certs -n octopod --from-file=./certs
46+```
47+Name for configmap is cofigured in octopod.certsConfigMapName
48+To install the chart with the release name `my-release` from current directory execute:
49+
50+```console
51+$ helm dependency build
52+$ helm -n octopod install my-release .
53+```
54+
55+The command deploys Octopod on the Kubernetes cluster in the default configuration inside octopod namespace. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
56+
57+## Uninstalling the Chart
58+
59+To uninstall/delete the `my-release` deployment:
60+
61+```console
62+$ helm -n octopod delete my-release
63+```
64+
65+The command removes all the Kubernetes components but PVC's associated with the postgres chart and deletes the release.
66+
67+## Parameters
68+
69+The following tables lists the configurable parameters of the Octopod chart and their default values.
70+
71+| Key | Type | Default | Description |
72+|-----|------|---------|-------------|
73+| affinity | object | `{}` | Octopod deployment affinity |
74+| controlScripts.image.pullPolicy | string | `"IfNotPresent"` | control scripts image pull policy |
75+| controlScripts.image.repository | string | `"typeable/octopod-helm-example"` | Control scripts image repository (you probably want to use your own control scripts) |
76+| controlScripts.image.tag | float | `1.1` | Control scitpts image tag |
77+| fullnameOverride | string | `""` | Override chart full name |
78+| image.pullPolicy | string | `"IfNotPresent"` | Octopod image pull policy |
79+| image.repository | string | `"typeable/octopod"` | Octopod image repository |
80+| image.tag | string | `""` | Octopod image tag (default values is taken from chart metadata) |
81+| imagePullSecrets | list | `[]` | Pull secrets if you want to use private registry |
82+| ingress.app.annotations | object | `{}` | Additional ingress annotations for app service |
83+| ingress.app.host | string | `"octopod-app.example.com"` | Hostname for app service |
84+| ingress.enabled | bool | `true` | Create ingress objects or not |
85+| ingress.ingressClass | string | `"nginx"` | Ingress class |
86+| ingress.powerApp.annotations | object | `{}` | Additional ingress annotations for power-app service |
87+| ingress.powerApp.host | string | `"octopod-powerapp.example.com"` | Hostname for power-app |
88+| ingress.tls.clusterIssuer | string | `"letsencrypt"` | Name of cluster issuer you want to use |
89+| ingress.tls.enabled | bool | `true` | Use https for all services |
90+| ingress.ui.annotations | object | `{}` | Additional ingress annotations for ui service |
91+| ingress.ui.host | string | `"octopod.example.com"` | Hostname for main UI |
92+| ingress.ws.annotations | object | `{}` | Additional ingress annotations for ws service |
93+| ingress.ws.host | string | `"octopod-ws.example.com"` | Hostname for websockets ingress |
94+| nameOverride | string | `""` | Name ovveride (default is Release.Name) |
95+| nodeSelector | object | `{}` | Node selector if you want octopod to use specific nodes onn your cluster |
96+| octopod.archiveRetention | int | `1209600` | |
97+| octopod.baseDomain | string | `""` | Domain that will be used as a ase for Octopod deploymets |
98+| octopod.certsConfigMapName | string | `"octopod-certs"` | Config map with self-signed certificates |
99+| octopod.deploymentNamespace | string | `"octopod-deployment"` | Name of a namespace which will be used for all Octopod deployments (you need to create it yourself) |
100+| octopod.migrations.enabled | bool | `true` | Enable or not automatic DB schema migrations |
101+| octopod.projectName | string | `"Octopod"` | Project name |
102+| octopod.statusUpdateTimeout | int | `600` | Time to wait before deployment is marked as failed |
103+| podAnnotations | object | `{}` | Additional pod annotations |
104+| podSecurityContext | object | `{}` | Additional security context |
105+| postgresql.enabled | bool | `true` | Use bitnami postgres chart |
106+| postgresql.postgresqlDatabase | string | `"octopod"` | Database name for octopod |
107+| postgresql.postgresqlUsername | string | `"octopod"` | Octopod DB username |
108+| rbac.create | bool | `true` | Creates ClusterRoles and Bindings for Octopod service account |
109+| replicaCount | int | `1` | Number of Octopod replicas |
110+| resources.limits.cpu | string | `"200m"` | CPU limits |
111+| resources.limits.memory | string | `"512Mi"` | Memory limits |
112+| resources.requests.cpu | string | `"200m"` | CPU requests |
113+| resources.requests.memory | string | `"256Mi"` | Memory requests |
114+| securityContext.runAsGroup | int | `1000` | Use non-root GID |
115+| securityContext.runAsUser | int | `1000` | Use non-root UID |
116+| service.ports.app | int | `4000` | App service port |
117+| service.ports.powerApp | int | `4443` | Power app service port |
118+| service.ports.ui | int | `80` | UI service port |
119+| service.ports.ws | int | `4020` | WebSockets service port |
120+| service.type | string | `"ClusterIP"` | Octopod service type |
121+| serviceAccount.annotations | object | `{}` | Additional anotations for Octopod's SA |
122+| serviceAccount.create | bool | `true` | Create ServiceAccount |
123+| serviceAccount.name | string | `""` | ServiceAccount name override |
124+| sqitch.image.pullPolicy | string | `"IfNotPresent"` | squitch image pull policy |
125+| sqitch.image.repository | string | `"typeable/sqitch"` | squitch image repository |
126+| sqitch.image.tag | string | `"v2.0.0"` | squitch image tag |
127+| tolerations | list | `[]` | Octpod deploymet tolerations |
128+
129+
130+Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
131+
132+```console
133+$ helm -n octopod install my-release \
134+ --set controlScripts.image.repository=registry.example.com/control,controlScripts.image.tag=0.0.1 \
135+ .
136+```
137+
138+The above command sets control scripts image to your custom repository
139+
140+Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
141+
142+```console
143+$ helm install my-release -f values.yaml .
144+```
145+
146+> **Tip**: You can use the default [values.yaml](values.yaml)
147+
148+## Configuration and installation details
149+
150+If you want to have authentication for Octopod UI you can use project like [Oauth2-Proxy](https://github.com/oauth2-proxy/oauth2-proxy) or directly use your oauth provider.
151+After that you can add following annotations to UI ingress (considering that your oauth provider installed on oath.example.com):
152+```yaml
153+ingress:
154+ ui:
155+ annotations:
156+ nginx.ingress.kubernetes.io/auth-url: "https://oauth.example.com/oauth2/auth"
157+ nginx.ingress.kubernetes.io/auth-signin: "https://oauth.example.com/oauth2/start?rd=/redirect/$http_host$request_uri"
158+```
charts/helm3/octopod/templates/_helpers.tplnew file+98
@@ -0,0 +1,98 @@
1+{{/*
2+Expand the name of the chart.
3+*/}}
4+{{- define "octopod.name" -}}
5+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+{{- end }}
7+
8+{{/*
9+Create a default fully qualified app name.
10+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+If release name contains chart name it will be used as a full name.
12+*/}}
13+{{- define "octopod.fullname" -}}
14+{{- if .Values.fullnameOverride }}
15+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+{{- else }}
17+{{- $name := default .Chart.Name .Values.nameOverride }}
18+{{- if contains $name .Release.Name }}
19+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+{{- else }}
21+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+{{- end }}
23+{{- end }}
24+{{- end }}
25+
26+{{/*
27+Create chart name and version as used by the chart label.
28+*/}}
29+{{- define "octopod.chart" -}}
30+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+{{- end }}
32+
33+{{/*
34+Common labels
35+*/}}
36+{{- define "octopod.labels" -}}
37+helm.sh/chart: {{ include "octopod.chart" . }}
38+{{ include "octopod.selectorLabels" . }}
39+{{- if .Chart.AppVersion }}
40+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+{{- end }}
42+app.kubernetes.io/managed-by: {{ .Release.Service }}
43+{{- end }}
44+
45+{{/*
46+Selector labels
47+*/}}
48+{{- define "octopod.selectorLabels" -}}
49+app.kubernetes.io/name: {{ include "octopod.name" . }}
50+app.kubernetes.io/instance: {{ .Release.Name }}
51+{{- end }}
52+
53+{{/*
54+Create the name of the service account to use
55+*/}}
56+{{- define "octopod.serviceAccountName" -}}
57+{{- if .Values.serviceAccount.create }}
58+{{- default (include "octopod.fullname" .) .Values.serviceAccount.name }}
59+{{- else }}
60+{{- default "default" .Values.serviceAccount.name }}
61+{{- end }}
62+{{- end }}
63+
64+{{- define "controlScriptsPath" -}}
65+/utils
66+{{- end }}
67+
68+{{- define "octopodAppAuthSecretName" -}}
69+{{- printf "%s-app-auth-secret" (include "octopod.fullname" .) }}
70+{{- end }}
71+
72+{{- define "octopodAppAuthPassword" -}}
73+{{- randAlphaNum 32 }}
74+{{- end }}
75+
76+{{- define "httpScheme" -}}
77+{{- if .Values.ingress.tls.enabled -}}
78+https
79+{{- else -}}
80+http
81+{{- end }}
82+{{- end }}
83+
84+{{- define "wsScheme" -}}
85+{{- if .Values.ingress.tls.enabled -}}
86+wss
87+{{- else -}}
88+ws
89+{{- end }}
90+{{- end }}
91+
92+{{- define "postgresqlHost" -}}
93+{{ .Release.Name }}-postgresql
94+{{- end }}
95+
96+{{- define "postgresqlSecretName" -}}
97+{{ .Release.Name }}-postgresql
98+{{- end }}
charts/helm3/octopod/templates/deployment.yamlnew file+163
@@ -0,0 +1,163 @@
1+apiVersion: apps/v1
2+kind: Deployment
3+metadata:
4+ name: {{ include "octopod.fullname" . }}
5+ labels:
6+ {{- include "octopod.labels" . | nindent 4 }}
7+spec:
8+ replicas: {{ .Values.replicaCount }}
9+ selector:
10+ matchLabels:
11+ {{- include "octopod.selectorLabels" . | nindent 6 }}
12+ template:
13+ metadata:
14+ {{- with .Values.podAnnotations }}
15+ annotations:
16+ {{- toYaml . | nindent 8 }}
17+ {{- end }}
18+ labels:
19+ {{- include "octopod.selectorLabels" . | nindent 8 }}
20+ spec:
21+ {{- with .Values.imagePullSecrets }}
22+ imagePullSecrets:
23+ {{- toYaml . | nindent 8 }}
24+ {{- end }}
25+ serviceAccountName: {{ include "octopod.serviceAccountName" . }}
26+ securityContext:
27+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
28+ initContainers:
29+ - name: copy-control-scripts
30+ image: "{{ .Values.controlScripts.image.repository }}:{{ .Values.controlScripts.image.tag }}"
31+ imagePullPolicy: {{ .Values.controlScripts.image.pullPolicy }}
32+ command:
33+ - sh
34+ - -c
35+ - 'cp /utils/* /copy/'
36+ volumeMounts:
37+ - name: control-scripts
38+ mountPath: /copy
39+
40+ - name: run-init
41+ image: typeable/octopod:1.1
42+ command:
43+ - sh
44+ - -c
45+ - '/utils/init'
46+ volumeMounts:
47+ - name: home
48+ mountPath: /home/octopod
49+ - name: control-scripts
50+ mountPath: {{ include "controlScriptsPath" . }}
51+ - name: copy-www
52+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
53+ command:
54+ - sh
55+ - -c
56+ - |
57+ set -ex
58+ cp -a /www/* /copy/
59+ find /www -type f -exec touch {} +
60+ volumeMounts:
61+ - name: www
62+ mountPath: /copy
63+ containers:
64+ - name: octopod
65+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
66+ imagePullPolicy: {{ .Values.image.pullPolicy }}
67+ ports:
68+ - containerPort: 4443
69+ protocol: TCP
70+ - containerPort: 4000
71+ protocol: TCP
72+ args:
73+ - --port
74+ - {{ .Values.service.ports.powerApp | quote }}
75+ - --ui-port
76+ - {{ .Values.service.ports.app | quote }}
77+ - --ws-port
78+ - {{ .Values.service.ports.ws | quote }}
79+ - --db
80+ - host='{{ include "postgresqlHost" . }}' port=5432 user='{{ .Values.postgresql.postgresqlUsername }}' password=$(PG_PASS)
81+ - --db-pool-size
82+ - "10"
83+ - --tls-cert-path
84+ - /tls/server_cert.pem
85+ - --tls-key-path
86+ - /tls/server_key.pem
87+ - --tls-store-path
88+ - /tls_store
89+ envFrom:
90+ - configMapRef:
91+ name: {{ include "octopod.fullname" . }}
92+ env:
93+ - name: PG_PASS
94+ valueFrom:
95+ secretKeyRef:
96+ name: {{ include "postgresqlSecretName" . }}
97+ key: postgresql-password
98+ volumeMounts:
99+ - name: home
100+ mountPath: /home/octopod
101+ - name: control-scripts
102+ mountPath: {{ include "controlScriptsPath" . }}
103+ - name: certs
104+ mountPath: /tls/server_cert.pem
105+ subPath: server_cert.pem
106+ - name: certs
107+ mountPath: /tls/server_key.pem
108+ subPath: server_key.pem
109+ - name: certs
110+ mountPath: /tls_store/server_cert.pem
111+ subPath: server_cert.pem
112+ readinessProbe:
113+ httpGet:
114+ port: {{ .Values.service.ports.app }}
115+ path: /api/v1/ping
116+ periodSeconds: 20
117+ livenessProbe:
118+ httpGet:
119+ port: {{ .Values.service.ports.app }}
120+ path: /api/v1/ping
121+ initialDelaySeconds: 15
122+ periodSeconds: 5
123+ resources:
124+ {{- toYaml .Values.resources | nindent 12 }}
125+ - name: nginx
126+ image: nginx:1.17.5
127+ volumeMounts:
128+ - name: nginx-config
129+ mountPath: /etc/nginx/conf.d/app.conf
130+ subPath: app.conf
131+ - name: nginx-config
132+ mountPath: /www/config.json
133+ subPath: config.json
134+ - name: www
135+ mountPath: /www
136+ ports:
137+ - containerPort: {{ .Values.service.ports.ui }}
138+ protocol: TCP
139+ {{- with .Values.nodeSelector }}
140+ nodeSelector:
141+ {{- toYaml . | nindent 8 }}
142+ {{- end }}
143+ {{- with .Values.affinity }}
144+ affinity:
145+ {{- toYaml . | nindent 8 }}
146+ {{- end }}
147+ {{- with .Values.tolerations }}
148+ tolerations:
149+ {{- toYaml . | nindent 8 }}
150+ {{- end }}
151+ volumes:
152+ - name: home
153+ emptyDir: {}
154+ - name: control-scripts
155+ emptyDir: {}
156+ - name: www
157+ emptyDir: {}
158+ - name: nginx-config
159+ configMap:
160+ name: {{ include "octopod.fullname" . }}-nginx-config
161+ - name: certs
162+ configMap:
163+ name: {{ .Values.octopod.certsConfigMapName }}
charts/helm3/octopod/templates/ingress-app.yamlnew file+47
@@ -0,0 +1,47 @@
1+{{- if .Values.ingress.enabled -}}
2+{{- $fullName := include "octopod.fullname" . -}}
3+{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
4+apiVersion: networking.k8s.io/v1beta1
5+{{- else -}}
6+apiVersion: extensions/v1beta1
7+{{- end }}
8+kind: Ingress
9+metadata:
10+ name: {{ $fullName }}-app
11+ labels:
12+ {{- include "octopod.labels" . | nindent 4 }}
13+ annotations:
14+ {{- if .Values.ingress.tls.enabled }}
15+ kubernetes.io/tls-acme: "true"
16+ cert-manager.io/cluster-issuer: {{ .Values.ingress.tls.clusterIssuer | quote }}
17+ {{- end }}
18+ kubernetes.io/ingress.class: {{ .Values.ingress.ingressClass | quote }}
19+ nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
20+ nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
21+ nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
22+ nginx.ingress.kubernetes.io/proxy-next-upstream: "http_502 error timeout"
23+ nginx.ingress.kubernetes.io/auth-secret: {{ include "octopodAppAuthSecretName" . }}
24+ nginx.ingress.kubernetes.io/auth-secret-type: auth-file
25+ nginx.ingress.kubernetes.io/auth-type: basic
26+ nginx.ingress.kubernetes.io/enable-cors: "true"
27+ nginx.ingress.kubernetes.io/cors-allow-origin: {{ printf "%s://%s" (include "httpScheme" .) .Values.ingress.ui.host | quote }}
28+ nginx.ingress.kubernetes.io/cors-allow-methods: "GET, POST, PUT, DELETE, PATCH, OPTIONS"
29+ {{- with .Values.ingress.app.annotations }}
30+ {{- toYaml . | nindent 4 }}
31+ {{- end }}
32+spec:
33+ {{- if .Values.ingress.tls.enabled }}
34+ tls:
35+ - hosts:
36+ - {{ .Values.ingress.app.host }}
37+ secretName: {{ $fullName }}-app-tls
38+ {{- end }}
39+ rules:
40+ - host: {{ .Values.ingress.app.host | quote }}
41+ http:
42+ paths:
43+ - path: /
44+ backend:
45+ serviceName: {{ $fullName }}
46+ servicePort: {{ .Values.service.ports.app }}
47+{{- end }}
charts/helm3/octopod/templates/ingress-powerapp.yamlnew file+40
@@ -0,0 +1,40 @@
1+{{- if .Values.ingress.enabled -}}
2+{{- $fullName := include "octopod.fullname" . -}}
3+{{- $svcPort := .Values.service.port -}}
4+{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
5+apiVersion: networking.k8s.io/v1beta1
6+{{- else -}}
7+apiVersion: extensions/v1beta1
8+{{- end }}
9+kind: Ingress
10+metadata:
11+ name: {{ $fullName }}-powerapp
12+ labels:
13+ {{- include "octopod.labels" . | nindent 4 }}
14+ annotations:
15+ kubernetes.io/ingress.class: {{ .Values.ingress.ingressClass | quote }}
16+ nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
17+ nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
18+ nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
19+ nginx.ingress.kubernetes.io/proxy-next-upstream: "http_502 error timeout"
20+ nginx.ingress.kubernetes.io/ssl-passthrough: "true"
21+ nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
22+ {{- with .Values.ingress.powerApp.annotations }}
23+ {{- toYaml . | nindent 4 }}
24+ {{- end }}
25+spec:
26+ {{- if .Values.ingress.tls }}
27+ tls:
28+ - hosts:
29+ - {{ .Values.ingress.powerApp.host }}
30+ secretName: {{ $fullName }}-powerapp-tls
31+ {{- end }}
32+ rules:
33+ - host: {{ .Values.ingress.powerApp.host | quote }}
34+ http:
35+ paths:
36+ - path: /
37+ backend:
38+ serviceName: {{ $fullName }}
39+ servicePort: {{ .Values.service.ports.powerApp }}
40+{{- end }}
charts/helm3/octopod/templates/ingress-ui.yamlnew file+41
@@ -0,0 +1,41 @@
1+{{- if .Values.ingress.enabled -}}
2+{{- $fullName := include "octopod.fullname" . -}}
3+{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
4+apiVersion: networking.k8s.io/v1beta1
5+{{- else -}}
6+apiVersion: extensions/v1beta1
7+{{- end }}
8+kind: Ingress
9+metadata:
10+ name: {{ $fullName }}-ui
11+ labels:
12+ {{- include "octopod.labels" . | nindent 4 }}
13+ annotations:
14+ {{- if .Values.ingress.tls.enabled }}
15+ kubernetes.io/tls-acme: "true"
16+ cert-manager.io/cluster-issuer: {{ .Values.ingress.tls.clusterIssuer | quote }}
17+ {{- end }}
18+ kubernetes.io/ingress.class: {{ .Values.ingress.ingressClass | quote }}
19+ nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
20+ nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
21+ nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
22+ nginx.ingress.kubernetes.io/proxy-next-upstream: "http_502 error timeout"
23+ {{- with .Values.ingress.ui.annotations }}
24+ {{- toYaml . | nindent 4 }}
25+ {{- end }}
26+spec:
27+ {{- if .Values.ingress.tls.enabled }}
28+ tls:
29+ - hosts:
30+ - {{ .Values.ingress.ui.host }}
31+ secretName: {{ $fullName }}-ui-tls
32+ {{- end }}
33+ rules:
34+ - host: {{ .Values.ingress.ui.host | quote }}
35+ http:
36+ paths:
37+ - path: /
38+ backend:
39+ serviceName: {{ $fullName }}
40+ servicePort: {{ .Values.service.ports.ui }}
41+{{- end }}
charts/helm3/octopod/templates/ingress-ws.yamlnew file+41
@@ -0,0 +1,41 @@
1+{{- if .Values.ingress.enabled -}}
2+{{- $fullName := include "octopod.fullname" . -}}
3+{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
4+apiVersion: networking.k8s.io/v1beta1
5+{{- else -}}
6+apiVersion: extensions/v1beta1
7+{{- end }}
8+kind: Ingress
9+metadata:
10+ name: {{ $fullName }}-ws
11+ labels:
12+ {{- include "octopod.labels" . | nindent 4 }}
13+ annotations:
14+ {{- if .Values.ingress.tls.enabled }}
15+ kubernetes.io/tls-acme: "true"
16+ cert-manager.io/cluster-issuer: {{ .Values.ingress.tls.clusterIssuer | quote }}
17+ {{- end }}
18+ kubernetes.io/ingress.class: {{ .Values.ingress.ingressClass | quote }}
19+ nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
20+ nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
21+ nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
22+ nginx.ingress.kubernetes.io/proxy-next-upstream: "http_502 error timeout"
23+ {{- with .Values.ingress.ws.annotations }}
24+ {{- toYaml . | nindent 4 }}
25+ {{- end }}
26+spec:
27+ {{- if .Values.ingress.tls.enabled }}
28+ tls:
29+ - hosts:
30+ - {{ .Values.ingress.ws.host }}
31+ secretName: {{ $fullName }}-ws-tls
32+ {{- end }}
33+ rules:
34+ - host: {{ .Values.ingress.ws.host | quote }}
35+ http:
36+ paths:
37+ - path: /
38+ backend:
39+ serviceName: {{ $fullName }}
40+ servicePort: {{ .Values.service.ports.ws }}
41+{{- end }}
charts/helm3/octopod/templates/migration-job.yamlnew file+77
@@ -0,0 +1,77 @@
1+{{- if .Values.octopod.migrations.enabled }}
2+apiVersion: batch/v1
3+kind: Job
4+metadata:
5+ name: {{ include "octopod.fullname" . }}-migrations
6+ labels:
7+ {{- include "octopod.labels" . | nindent 4 }}
8+ annotations:
9+ "helm.sh/hook": post-install,post-upgrade
10+ "helm.sh/hook-delete-policy": hook-succeeded
11+spec:
12+ activeDeadlineSeconds: 600
13+ template:
14+ spec:
15+ initContainers:
16+ - name: copy
17+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
18+ command:
19+ - "bash"
20+ - "-ec"
21+ - |
22+ set -ex
23+
24+ # copy migrations
25+ cp -av /migrations/* /mymigrations
26+
27+ # create sqitch.conf
28+ echo '[core]' > /mymigrations/sqitch.conf
29+ echo 'engine = pg' >> /mymigrations/sqitch.conf
30+ echo 'plan_file = sqitch.plan' >> /mymigrations/sqitch.conf
31+ echo 'top_dir = .' >> /mymigrations/sqitch.conf
32+ echo '[engine "pg"]' >> /mymigrations/sqitch.conf
33+ echo ' registry = sqitch' >> /mymigrations/sqitch.conf
34+ echo '[deploy]' >> /mymigrations/sqitch.conf
35+ echo ' verify = true' >> /mymigrations/sqitch.conf
36+ echo '[rebase]' >> /mymigrations/sqitch.conf
37+ echo ' verify = true' >> /mymigrations/sqitch.conf
38+ echo '[target "octopod"]' >> /mymigrations/sqitch.conf
39+ echo 'uri = db:pg://{{ .Values.postgresql.postgresqlUsername }}:$(PG_PASS)@{{ include "postgresqlHost" . }}/{{ .Values.postgresql.postgresqlDatabase }}' >> /mymigrations/sqitch.conf
40+ env:
41+ - name: PG_PASS
42+ valueFrom:
43+ secretKeyRef:
44+ name: {{ include "postgresqlSecretName" . }}
45+ key: postgresql-password
46+ volumeMounts:
47+ - name: migrations
48+ mountPath: /mymigrations
49+ containers:
50+ - name: migrations
51+ image: "{{ .Values.sqitch.image.repository }}:{{ .Values.sqitch.image.tag }}"
52+ command:
53+ - "bash"
54+ - "-c"
55+ - |
56+ set -x
57+ echo 'checking connection to postgresql...'
58+ for i in $(seq 1 6); do psql "postgres://{{ .Values.postgresql.postgresqlUsername }}:$(PG_PASS)@{{ include "postgresqlHost" . }}/{{ .Values.postgresql.postgresqlDatabase }}" -c ''; if [ $? -eq 0 ]; then break; fi; sleep 10; done
59+ set -e
60+ echo 'run migrations...'
61+ cd /migrations && /usr/local/bin/sqitch deploy octopod
62+ env:
63+ - name: PG_PASS
64+ valueFrom:
65+ secretKeyRef:
66+ name: {{ include "postgresqlSecretName" . }}
67+ key: postgresql-password
68+ volumeMounts:
69+ - name: migrations
70+ mountPath: /migrations
71+
72+ volumes:
73+ - name: migrations
74+ emptyDir: {}
75+ restartPolicy: Never
76+ backoffLimit: 3
77+{{- end }}
charts/helm3/octopod/templates/nginx-configmap.yamlnew file+24
@@ -0,0 +1,24 @@
1+apiVersion: v1
2+kind: ConfigMap
3+metadata:
4+ name: {{ include "octopod.fullname" . }}-nginx-config
5+ labels:
6+ {{- include "octopod.labels" . | nindent 4 }}
7+data:
8+ app.conf: |
9+ server {
10+ listen 80 default_server;
11+ server_name _;
12+ root /www;
13+ index index.html;
14+ error_page 404 =200 /index.html;
15+ }
16+ config.json: |
17+ {
18+ "app_url": "{{ printf "%s://%s" (include "httpScheme" .) .Values.ingress.app.host}}",
19+ "ws_url": "{{ printf "%s://%s" (include "wsScheme" .) .Values.ingress.ws.host}}",
20+ "app_auth": "Basic {{ printf "octopod:%s" (include "octopodAppAuthPassword" .) | b64enc }}",
21+
22+ "kubernetes_dashboard_url_template": null
23+
24+ }
charts/helm3/octopod/templates/octopod-basic-auth-secret.yamlnew file+10
@@ -0,0 +1,10 @@
1+apiVersion: v1
2+kind: Secret
3+type: Opaque
4+metadata:
5+ name: {{ include "octopodAppAuthSecretName" . }}
6+ labels:
7+ {{- include "octopod.labels" . | nindent 4 }}
8+data:
9+ auth: {{ htpasswd "octopod" (include "octopodAppAuthPassword" . ) | b64enc }}
10+
charts/helm3/octopod/templates/octopod-configmap.yamlnew file+20
@@ -0,0 +1,20 @@
1+apiVersion: v1
2+kind: ConfigMap
3+metadata:
4+ name: {{ include "octopod.fullname" . }}
5+ labels:
6+ {{- include "octopod.labels" . | nindent 4 }}
7+data:
8+ PROJECT_NAME: {{ .Values.octopod.projectName | quote }}
9+ BASE_DOMAIN: {{ .Values.octopod.baseDomain | quote }}
10+ NAMESPACE: {{ .Values.octopod.deploymentNamespace | quote }}
11+ STATUS_UPDATE_TIMEOUT: {{ .Values.octopod.statusUpdateTimeout | quote }}
12+ ARCHIVE_RETENTION: {{ .Values.octopod.archiveRetention | quote }}
13+ CREATION_COMMAND: {{ printf "%s/create" (include "controlScriptsPath" .) | quote }}
14+ UPDATE_COMMAND: {{ printf "%s/update" (include "controlScriptsPath" .) | quote }}
15+ ARCHIVE_COMMAND: {{ printf "%s/archive" (include "controlScriptsPath" .) | quote }}
16+ CHECKING_COMMAND: {{ printf "%s/check" (include "controlScriptsPath" .) | quote }}
17+ CLEANUP_COMMAND: {{ printf "%s/cleanup" (include "controlScriptsPath" .) | quote }}
18+ ARCHIVE_CHECKING_COMMAND: {{ printf "%s/archive_check" (include "controlScriptsPath" .) | quote }}
19+ TAG_CHECKING_COMMAND: {{ printf "%s/tag_check" (include "controlScriptsPath" .) | quote }}
20+ INFO_COMMAND: {{ printf "%s/info" (include "controlScriptsPath" .) | quote }}
charts/helm3/octopod/templates/rbac.yamlnew file+30
@@ -0,0 +1,30 @@
1+{{- if and .Values.rbac.create (eq .Values.serviceAccount.create true) -}}
2+apiVersion: rbac.authorization.k8s.io/v1
3+kind: ClusterRole
4+metadata:
5+ name: {{ include "octopod.fullname" . }}
6+ labels:
7+ {{- include "octopod.labels" . | nindent 4 }}
8+rules:
9+ - apiGroups: [""]
10+ resources: ["pods/portforward"]
11+ verbs: ["create"]
12+ - apiGroups: [""]
13+ resources: ["pods"]
14+ verbs: ["list", "get"]
15+---
16+apiVersion: rbac.authorization.k8s.io/v1
17+kind: ClusterRoleBinding
18+metadata:
19+ name: {{ include "octopod.fullname" . }}
20+ labels:
21+ {{- include "octopod.labels" . | nindent 4 }}
22+roleRef:
23+ kind: ClusterRole
24+ apiGroup: rbac.authorization.k8s.io
25+ name: {{ include "octopod.fullname" . }}
26+subjects:
27+ - kind: ServiceAccount
28+ name: {{ include "octopod.serviceAccountName" . }}
29+ namespace: {{ .Release.Namespace }}
30+{{- end -}}
charts/helm3/octopod/templates/service.yamlnew file+16
@@ -0,0 +1,16 @@
1+apiVersion: v1
2+kind: Service
3+metadata:
4+ name: {{ include "octopod.fullname" . }}
5+ labels:
6+ {{- include "octopod.labels" . | nindent 4 }}
7+spec:
8+ type: {{ .Values.service.type }}
9+ ports:
10+{{- range $portName, $portNumber := .Values.service.ports }}
11+ - name: octopod-{{ $portName | lower }}
12+ port: {{ $portNumber }}
13+ targetPort: {{ $portNumber }}
14+{{- end }}
15+ selector:
16+ {{- include "octopod.selectorLabels" . | nindent 4 }}
charts/helm3/octopod/templates/serviceaccount.yamlnew file+12
@@ -0,0 +1,12 @@
1+{{- if .Values.serviceAccount.create -}}
2+apiVersion: v1
3+kind: ServiceAccount
4+metadata:
5+ name: {{ include "octopod.serviceAccountName" . }}
6+ labels:
7+ {{- include "octopod.labels" . | nindent 4 }}
8+ {{- with .Values.serviceAccount.annotations }}
9+ annotations:
10+ {{- toYaml . | nindent 4 }}
11+ {{- end }}
12+{{- end }}
charts/helm3/octopod/values-test.yamlnew file+104
@@ -0,0 +1,104 @@
1+# Default values for octopod.
2+# This is a YAML-formatted file.
3+# Declare variables to be passed into your templates.
4+
5+replicaCount: 1
6+
7+image:
8+ repository: typeable/octopod
9+ pullPolicy: IfNotPresent
10+ # Overrides the image tag whose default is the chart appVersion.
11+ tag: ""
12+
13+imagePullSecrets: []
14+nameOverride: ""
15+fullnameOverride: ""
16+
17+serviceAccount:
18+ # Specifies whether a service account should be created
19+ create: true
20+ # Annotations to add to the service account
21+ annotations: {}
22+ # The name of the service account to use.
23+ # If not set and create is true, a name is generated using the fullname template
24+ name: ""
25+rbac:
26+ create: true
27+podAnnotations: {}
28+
29+podSecurityContext: {}
30+ # fsGroup: 2000
31+
32+securityContext:
33+ runAsUser: 1000
34+ runAsGroup: 1000
35+ # capabilities:
36+ # drop:
37+ # - ALL
38+ # readOnlyRootFilesystem: true
39+ # runAsNonRoot: true
40+
41+service:
42+ type: ClusterIP
43+ ports:
44+ powerApp: 4443
45+ ui: 80
46+ app: 4000
47+ ws: 4020
48+
49+ingress:
50+ enabled: true
51+ ingressClass: nginx
52+ tls:
53+ enabled: true
54+ clusterIssuer: letsencrypt
55+ powerApp:
56+ host: octopod-powerapp.sizov-test.thebestagent.pro
57+ annotations: {}
58+ ui:
59+ host: octopod.sizov-test.thebestagent.pro
60+ annotations: {}
61+ app:
62+ host: octopod-app.sizov-test.thebestagent.pro
63+ annotations: {}
64+ ws:
65+ host: octopod-ws.sizov-test.thebestagent.pro
66+ annotations: {}
67+
68+resources:
69+ limits:
70+ cpu: 200m
71+ memory: 512Mi
72+ requests:
73+ cpu: 200m
74+ memory: 256Mi
75+
76+nodeSelector: {}
77+
78+tolerations: []
79+
80+affinity: {}
81+
82+octopod:
83+ certsConfigMapName: octopod-certs
84+ projectName: Octopod
85+ deploymentNamespace: octopod-deployment
86+ baseDomain: "sizov-test.thebestagent.pro"
87+ statusUpdateTimeout: 600
88+ archiveRetention: 1209600
89+ migrations:
90+ enabled: true
91+controlScripts:
92+ image:
93+ repository: typeable/octopod-helm-example
94+ pullPolicy: IfNotPresent
95+ tag: 1.1
96+sqitch:
97+ image:
98+ repository: typeable/sqitch
99+ pullPolicy: IfNotPresent
100+ tag: v2.0.0
101+postgresql:
102+ enabled: true
103+ postgresqlUsername: octopod
104+ postgresqlDatabase: octopod
charts/helm3/octopod/values.yamlnew file+104
@@ -0,0 +1,104 @@
1+# Default values for octopod.
2+# This is a YAML-formatted file.
3+# Declare variables to be passed into your templates.
4+
5+replicaCount: 1
6+
7+image:
8+ repository: typeable/octopod
9+ pullPolicy: IfNotPresent
10+ # Overrides the image tag whose default is the chart appVersion.
11+ tag: ""
12+
13+imagePullSecrets: []
14+nameOverride: ""
15+fullnameOverride: ""
16+
17+serviceAccount:
18+ # Specifies whether a service account should be created
19+ create: true
20+ # Annotations to add to the service account
21+ annotations: {}
22+ # The name of the service account to use.
23+ # If not set and create is true, a name is generated using the fullname template
24+ name: ""
25+rbac:
26+ create: true
27+podAnnotations: {}
28+
29+podSecurityContext: {}
30+ # fsGroup: 2000
31+
32+securityContext:
33+ runAsUser: 1000
34+ runAsGroup: 1000
35+ # capabilities:
36+ # drop:
37+ # - ALL
38+ # readOnlyRootFilesystem: true
39+ # runAsNonRoot: true
40+
41+service:
42+ type: ClusterIP
43+ ports:
44+ powerApp: 4443
45+ ui: 80
46+ app: 4000
47+ ws: 4020
48+
49+ingress:
50+ enabled: true
51+ ingressClass: nginx
52+ tls:
53+ enabled: true
54+ clusterIssuer: letsencrypt
55+ powerApp:
56+ host: octopod-powerapp.example.com
57+ annotations: {}
58+ ui:
59+ host: octopod.example.com
60+ annotations: {}
61+ app:
62+ host: octopod-app.example.com
63+ annotations: {}
64+ ws:
65+ host: octopod-ws.example.com
66+ annotations: {}
67+
68+resources:
69+ limits:
70+ cpu: 200m
71+ memory: 512Mi
72+ requests:
73+ cpu: 200m
74+ memory: 256Mi
75+
76+nodeSelector: {}
77+
78+tolerations: []
79+
80+affinity: {}
81+
82+octopod:
83+ certsConfigMapName: octopod-certs
84+ projectName: Octopod
85+ deploymentNamespace: octopod-deployment
86+ baseDomain: ""
87+ statusUpdateTimeout: 600
88+ archiveRetention: 1209600
89+ migrations:
90+ enabled: true
91+controlScripts:
92+ image:
93+ repository: typeable/octopod-helm-example
94+ pullPolicy: IfNotPresent
95+ tag: 1.1
96+sqitch:
97+ image:
98+ repository: typeable/sqitch
99+ pullPolicy: IfNotPresent
100+ tag: v2.0.0
101+postgresql:
102+ enabled: true
103+ postgresqlUsername: octopod
104+ postgresqlDatabase: octopod
docs/en/Octopod_deployment_guide.md+4
@@ -422,3 +422,7 @@ helm upgrade --install octopod ./octopod \
422422[kubedog]: https://github.com/werf/kubedog
423423[lets-encrypt]: https://letsencrypt.org
424424[lets-encrypt-rate-limits]: https://letsencrypt.org/docs/rate-limits
425+
426+## Helm 3 chart
427+You can use a [Helm 3](../../charts/helm3/octopod) chart (beta!) to install octopod.
428+
docs/ru/Octopod_deployment_with_K8S.md+3
@@ -280,3 +280,6 @@
280280[minikube]: https://kubernetes.io/ru/docs/tasks/tools/install-minikube
281281[tiller]: https://v2.helm.sh/docs/install
282282[kubedog]: https://github.com/werf/kubedog
283+
284+## Helm 3
285+Для установки Octopod вы также можете использовать чарт [Helm 3](../../charts/helm3/octopod) (бета версия!).