Initial pass of a basic moqui helm chart, with opensearch and
postgresql.
Showing
10 changed files
with
390 additions
and
0 deletions
charts/moqui/Chart.lock
0 → 100644
1 | dependencies: | ||
2 | - name: opensearch | ||
3 | repository: https://opensearch-project.github.io/helm-charts/ | ||
4 | version: 2.10.0 | ||
5 | - name: postgresql | ||
6 | repository: https://charts.bitnami.com/bitnami | ||
7 | version: 12.1.14 | ||
8 | digest: sha256:32398ca9a1a4833794b8e26cfdbcf4281951a0fc4caad9951a078bcd0d646b7a | ||
9 | generated: "2023-02-08T12:41:35.591551351-06:00" |
charts/moqui/Chart.yaml
0 → 100644
1 | apiVersion: v2 | ||
2 | name: moqui | ||
3 | description: A Helm chart for Kubernetes | ||
4 | |||
5 | # A chart can be either an 'application' or a 'library' chart. | ||
6 | # | ||
7 | # Application charts are a collection of templates that can be packaged into versioned archives | ||
8 | # to be deployed. | ||
9 | # | ||
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as | ||
11 | # a dependency of application charts to inject those utilities and functions into the rendering | ||
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
13 | type: application | ||
14 | |||
15 | # This is the chart version. This version number should be incremented each time you make changes | ||
16 | # to the chart and its templates, including the app version. | ||
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
18 | version: 0.0.0 | ||
19 | |||
20 | # This is the version number of the application being deployed. This version number should be | ||
21 | # incremented each time you make changes to the application. Versions are not expected to | ||
22 | # follow Semantic Versioning. They should reflect the version the application is using. | ||
23 | # It is recommended to use it with quotes. | ||
24 | appVersion: "3.0.0+git" | ||
25 | |||
26 | |||
27 | dependencies: | ||
28 | - name: opensearch | ||
29 | condition: opensearch.enabled | ||
30 | repository: https://opensearch-project.github.io/helm-charts/ | ||
31 | version: "2.10.0" | ||
32 | import-values: | ||
33 | - child: . | ||
34 | parent: opensearch | ||
35 | - name: postgresql | ||
36 | condition: postgresql.enabled | ||
37 | repository: https://charts.bitnami.com/bitnami | ||
38 | version: "12.1.14" | ||
39 | import-values: | ||
40 | - child: . | ||
41 | parent: postgresql |
charts/moqui/templates/_helpers.tpl
0 → 100644
1 | {{/* | ||
2 | Expand the name of the chart. | ||
3 | */}} | ||
4 | {{- define "moqui.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 "moqui.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 "moqui.chart" -}} | ||
30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
31 | {{- end }} | ||
32 | |||
33 | {{/* | ||
34 | Common labels | ||
35 | */}} | ||
36 | {{- define "moqui.labels" -}} | ||
37 | helm.sh/chart: {{ include "moqui.chart" . }} | ||
38 | {{ include "moqui.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 "moqui.selectorLabels" -}} | ||
49 | app.kubernetes.io/name: {{ include "moqui.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 "moqui.serviceAccountName" -}} | ||
57 | {{- if .Values.serviceAccount.create }} | ||
58 | {{- default (include "moqui.fullname" .) .Values.serviceAccount.name }} | ||
59 | {{- else }} | ||
60 | {{- default "default" .Values.serviceAccount.name }} | ||
61 | {{- end }} | ||
62 | {{- end }} | ||
63 | |||
64 | {{- define "moqui.opensearch-url" -}} | ||
65 | {{- if .Values.opensearch.enabled -}} | ||
66 | "http://{{- include "opensearch.masterService" .Subcharts.opensearch }}:{{ .Values.opensearch.httpPort }}" | ||
67 | {{- else }} | ||
68 | {{- printf "%s" .Values.opensearch.url }} | ||
69 | {{- end }} | ||
70 | {{- end }} | ||
71 | |||
72 | {{- define "moqui.entity_ds_host" -}} | ||
73 | {{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }} | ||
74 | {{- include "postgresql.primary.svc.headless" .Subcharts.postgresql }} | ||
75 | {{- else -}} | ||
76 | {{ .Values.configMap.entity_ds_host }} | ||
77 | {{- end -}} | ||
78 | {{- end }} | ||
79 | |||
80 | {{- define "moqui.entity_ds_port" -}} | ||
81 | {{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }} | ||
82 | {{- include "postgresql.service.port" .Subcharts.postgresql }} | ||
83 | {{- else -}} | ||
84 | {{ .Values.configMap.entity_ds_port }} | ||
85 | {{- end -}} | ||
86 | {{- end }} | ||
87 | |||
88 | {{- define "moqui.entity_ds_database" -}} | ||
89 | {{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }} | ||
90 | {{- include "postgresql.database" .Subcharts.postgresql }} | ||
91 | {{- else -}} | ||
92 | {{ .Values.configMap.entity_ds_database }} | ||
93 | {{- end -}} | ||
94 | {{- end }} | ||
95 | |||
96 | {{- define "moqui.entity_ds_user" -}} | ||
97 | {{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }} | ||
98 | {{- include "postgresql.username" .Subcharts.postgresql }} | ||
99 | {{- else -}} | ||
100 | {{ .Values.configMap.entity_ds_user }} | ||
101 | {{- end -}} | ||
102 | {{- end }} | ||
103 | |||
104 | {{- define "moqui.entity_ds_password.secret.name" -}} | ||
105 | {{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) -}} | ||
106 | {{- include "postgresql.secretName" .Subcharts.postgresql }} | ||
107 | {{- else -}} | ||
108 | {{ include "moqui.fullname" . }}-dsauth | ||
109 | {{- end -}} | ||
110 | {{- end }} | ||
111 | |||
112 | {{- define "moqui.entity_ds_password.secret.key" -}} | ||
113 | {{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) -}} | ||
114 | password | ||
115 | {{- else -}} | ||
116 | entity_ds_password | ||
117 | {{- end -}} | ||
118 | {{- end }} | ||
119 |
charts/moqui/templates/config-map.yaml
0 → 100644
charts/moqui/templates/secret.yaml
0 → 100644
1 | {{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }} | ||
2 | {{- else }} | ||
3 | apiVersion: v1 | ||
4 | kind: Secret | ||
5 | metadata: | ||
6 | name: {{ include "moqui.fullname" . }}-dsauth | ||
7 | labels: | ||
8 | {{- include "moqui.labels" . | nindent 4 }} | ||
9 | stringData: | ||
10 | entity_ds_password: {{ .Values.configMap.entity_ds_password }} | ||
11 | {{- end }} | ||
12 |
charts/moqui/templates/service.yaml
0 → 100644
1 | apiVersion: /v1 | ||
2 | kind: Service | ||
3 | metadata: | ||
4 | name: {{ include "moqui.fullname" . }} | ||
5 | labels: | ||
6 | {{- include "moqui.labels" . | nindent 4 }} | ||
7 | spec: | ||
8 | type: {{ .Values.service.type }} | ||
9 | ports: | ||
10 | - port: {{ .Values.service.port }} | ||
11 | targetPort: http-moqui | ||
12 | protocol: http | ||
13 | name: http-moqui | ||
14 | selector: | ||
15 | {{- include "moqui.selectorLabels" . | nindent 4 }} |
charts/moqui/templates/stateful-set.yaml
0 → 100644
1 | apiVersion: apps/v1 | ||
2 | kind: StatefulSet | ||
3 | metadata: | ||
4 | name: {{ include "moqui.fullname" . }} | ||
5 | labels: | ||
6 | {{- include "moqui.labels" . | nindent 4 }} | ||
7 | spec: | ||
8 | {{- if not .Values.autoscaling.enabled }} | ||
9 | replicas: {{ .Values.replicaCount }} | ||
10 | {{- end }} | ||
11 | serviceName: {{ include "moqui.fullname" . }} | ||
12 | selector: | ||
13 | matchLabels: | ||
14 | {{- include "moqui.selectorLabels" . | nindent 6 }} | ||
15 | template: | ||
16 | metadata: | ||
17 | {{- with .Values.podAnnotations }} | ||
18 | annotations: | ||
19 | {{- toYaml . | nindent 8 }} | ||
20 | {{- end }} | ||
21 | labels: | ||
22 | {{- include "moqui.selectorLabels" . | nindent 8 }} | ||
23 | spec: | ||
24 | {{- with .Values.imagePullSecrets }} | ||
25 | imagePullSecrets: | ||
26 | {{- toYaml . | nindent 8 }} | ||
27 | {{- end }} | ||
28 | serviceAccountName: {{ include "moqui.serviceAccountName" . }} | ||
29 | securityContext: | ||
30 | {{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
31 | initContainers: | ||
32 | {{- if and (eq .Values.configMap.entity_ds_db_conf "postgres") (.Values.checkDsConnection) }} | ||
33 | - name: postgresql-check-connection | ||
34 | image: "{{ .Values.postgresql.image.registry }}/{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}" | ||
35 | imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }} | ||
36 | env: | ||
37 | - name: POSTGRES_HOST | ||
38 | value: {{ include "moqui.entity_ds_host" . }} | ||
39 | - name: POSTGRES_USER | ||
40 | value: {{ include "moqui.entity_ds_user" . }} | ||
41 | - name: POSTGRES_PORT | ||
42 | value: {{ include "moqui.entity_ds_port" . }} | ||
43 | command: | ||
44 | - bash | ||
45 | - -cx | ||
46 | - |- | ||
47 | until pg_isready -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -p ${POSTGRES_PORT}; do | ||
48 | sleep 5 | ||
49 | done | ||
50 | {{- end }} | ||
51 | |||
52 | containers: | ||
53 | - name: {{ .Chart.Name }} | ||
54 | securityContext: | ||
55 | {{- toYaml .Values.securityContext | nindent 12 }} | ||
56 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
57 | imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
58 | envFrom: | ||
59 | - configMapRef: | ||
60 | name: {{ include "moqui.fullname" . }} | ||
61 | env: | ||
62 | - name: entity_ds_db_conf | ||
63 | value: 'postgres' | ||
64 | - name: entity_ds_database | ||
65 | value: {{ include "moqui.entity_ds_database" . }} | ||
66 | - name: entity_ds_host | ||
67 | value: {{ include "moqui.entity_ds_host" . }} | ||
68 | - name: entity_ds_port | ||
69 | value: {{ include "moqui.entity_ds_port" . }} | ||
70 | - name: entity_ds_user | ||
71 | value: {{ include "moqui.entity_ds_user" . }} | ||
72 | - name: entity_ds_password | ||
73 | valueFrom: | ||
74 | secretKeyRef: | ||
75 | name: {{ include "moqui.entity_ds_password.secret.name" . }} | ||
76 | key: {{ include "moqui.entity_ds_password.secret.key" . }} | ||
77 | optional: false | ||
78 | - name: elasticsearch_url | ||
79 | value: {{ include "moqui.opensearch-url" . }} | ||
80 | |||
81 | ports: | ||
82 | - name: http-moqui | ||
83 | containerPort: 80 | ||
84 | protocol: TCP | ||
85 | livenessProbe: | ||
86 | httpGet: | ||
87 | path: / | ||
88 | port: http-moqui | ||
89 | readinessProbe: | ||
90 | httpGet: | ||
91 | path: / | ||
92 | port: http-moqui | ||
93 | resources: | ||
94 | {{- toYaml .Values.resources | nindent 12 }} | ||
95 | {{- with .Values.nodeSelector }} | ||
96 | nodeSelector: | ||
97 | {{- toYaml . | nindent 8 }} | ||
98 | {{- end }} | ||
99 | {{- with .Values.affinity }} | ||
100 | affinity: | ||
101 | {{- toYaml . | nindent 8 }} | ||
102 | {{- end }} | ||
103 | {{- with .Values.tolerations }} | ||
104 | itolerations: | ||
105 | {{- toYaml . | nindent 8 }} | ||
106 | {{- end }} | ||
107 |
charts/moqui/templates/virtual-service.yaml
0 → 100644
1 | {{- if .Values.virtualService.enabled }} | ||
2 | apiVersion: networking.istio.io/v1alpha3 | ||
3 | kind: VirtualService | ||
4 | metadata: | ||
5 | name: {{ include "moqui.fullname" }} | ||
6 | labels: | ||
7 | {{- include "moqui.labels" . | nindent 4 }} | ||
8 | spec: | ||
9 | gateways: {{ .Values.virtualService.gateways | toYaml | nindent 4 }} | ||
10 | hosts: {{ .Values.virtualService.hosts | toYaml | nindent 4 }} | ||
11 | http: | ||
12 | - match: {{ .Values.virtualService.match | toYaml | nindent 8 }} | ||
13 | route: | ||
14 | - destination: | ||
15 | port: | ||
16 | number: 8080 | ||
17 | host: {{ include "moqui.fullname" }} | ||
18 | {{- end }} |
charts/moqui/values.yaml
0 → 100644
1 | imagePullSecrets: {} | ||
2 | image: | ||
3 | pullPolicy: null | ||
4 | repository: moqui/moquidemo | ||
5 | tag: null | ||
6 | |||
7 | configMap: | ||
8 | entity_ds_db_conf: "postgres" | ||
9 | entity_ds_database: "moqui" | ||
10 | entity_ds_host: external-postgres | ||
11 | entity_ds_port: 5432 | ||
12 | entity_ds_user: "moqui" | ||
13 | entity_ds_password: "iuqom" | ||
14 | |||
15 | checkDsConnection: | ||
16 | enabled: true | ||
17 | |||
18 | postgresql: | ||
19 | enabled: true | ||
20 | auth: | ||
21 | database: moqui | ||
22 | username: moqui | ||
23 | password: iuqom | ||
24 | |||
25 | opensearch: | ||
26 | enabled: true | ||
27 | clusterName: foo-opensearch | ||
28 | url: "http://127.0.0.1:9200" | ||
29 | singleNode: true | ||
30 | masterService: "" | ||
31 | |||
32 | service: | ||
33 | type: ClusterIP | ||
34 | port: 8080 | ||
35 | ingress: | ||
36 | enabled: false | ||
37 | virtualService: | ||
38 | enabled: false | ||
39 | gateways: | ||
40 | - istio-system/ingress-gateway | ||
41 | hosts: | ||
42 | - moqui.local | ||
43 | match: | ||
44 | - uri: | ||
45 | prefix: "/" | ||
46 | |||
47 | serviceAccount: | ||
48 | create: false | ||
49 | name: default | ||
50 | podSecurityContext: {} | ||
51 | securityContext: {} | ||
52 | replicaCount: 1 | ||
53 | podAnnotations: {} | ||
54 | resources: {} | ||
55 | nodeSelector: {} | ||
56 | affinity: {} | ||
57 | tolerations: {} | ||
58 | autoscaling: | ||
59 | enabled: false | ||
60 |
-
Please register or sign in to post a comment