Created
October 14, 2019 08:24
-
-
Save ysv/dd49418e87ec787cc39c4e7d9bd0259b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {{/* vim: set filetype=mustache: */}} | |
| {{/* | |
| Expand the name of the chart. | |
| */}} | |
| {{- define "applogic.name" -}} | |
| {{- printf "applogic" -}} | |
| {{- end -}} | |
| {{/* | |
| Expands the image name. | |
| */}} | |
| {{- define "applogic.image" -}} | |
| {{- printf "%s:%s" .Values.image.repository .Values.image.tag -}} | |
| {{- end -}} | |
| {{/* | |
| Expands the component's name. | |
| */}} | |
| {{- define "applogic.fullname" -}} | |
| {{- printf "applogic" -}} | |
| {{- end -}} | |
| {{/* | |
| Environment for database migration job. | |
| It is pre-install hook, so we don't have secrets created yet and we need to use plain password. | |
| */}} | |
| {{- define "applogic.prepare-db-env" -}} | |
| - name: RAILS_ENV | |
| value: production | |
| - name: RABBITMQ_HOST | |
| value: {{ .Values.rabbitmq.host }} | |
| - name: RABBITMQ_PORT | |
| value: {{ default "5672" .Values.rabbitmq.port | quote }} | |
| - name: RABBITMQ_USER | |
| value: {{ default "user" .Values.rabbitmq.user }} | |
| - name: DATABASE_HOST | |
| value: {{ .Values.db.host }} | |
| - name: DATABASE_USER | |
| value: {{ default "root" .Values.db.user }} | |
| - name: DATABASE_NAME | |
| value: {{ default "applogic_production" .Values.db.name | quote }} | |
| {{- range $key, $value := .Values.app.vars }} | |
| - name: {{ $key }} | |
| value: {{ $value | quote }} | |
| {{- end }} | |
| {{- if .Values.db.password }} | |
| - name: DATABASE_PASS | |
| value: {{ .Values.db.password }} | |
| {{- end }} | |
| {{- end -}} | |
| {{/* | |
| Environment loaded into the main pod | |
| */}} | |
| {{- define "applogic.env" -}} | |
| - name: RAILS_ENV | |
| value: production | |
| - name: RABBITMQ_HOST | |
| value: {{ .Values.rabbitmq.host }} | |
| - name: RABBITMQ_PORT | |
| value: {{ default "5672" .Values.rabbitmq.port | quote }} | |
| - name: RABBITMQ_USER | |
| value: {{ default "user" .Values.rabbitmq.user }} | |
| - name: DATABASE_HOST | |
| value: {{ .Values.db.host }} | |
| - name: DATABASE_USER | |
| value: {{ default "root" .Values.db.user }} | |
| - name: DATABASE_NAME | |
| value: {{ default "applogic_production" .Values.db.name | quote }} | |
| - name: REDIS_URL | |
| value: redis://:{{ .Values.redis.password }}@{{ .Values.redis.host }}:{{ default "6379" .Values.redis.port }} | |
| - name: EVENT_API_RABBITMQ_HOST | |
| value: {{ .Values.rabbitmq.host }} | |
| - name: EVENT_API_RABBITMQ_PORT | |
| value: {{ default "5672" .Values.rabbitmq.port | quote }} | |
| - name: EVENT_API_RABBITMQ_USERNAME | |
| value: {{ default "user" .Values.rabbitmq.user }} | |
| - name: BARONG_EVENT_API_JWT_PUBLIC_KEY | |
| value: {{ .Values.barongJwtPublicKey }} | |
| - name: BARONG_EVENT_API_JWT_ALGORITHM | |
| value: "RS256" | |
| - name: JWT_PUBLIC_KEY | |
| valueFrom: | |
| secretKeyRef: | |
| name: {{ template "applogic.fullname" . }} | |
| key: jwtPublicKey | |
| - name: EVENT_API_JWT_PRIVATE_KEY | |
| valueFrom: | |
| secretKeyRef: | |
| name: {{ template "applogic.fullname" . }} | |
| key: eventApiJwtPrivateKey | |
| {{- if .Values.db.password }} | |
| - name: DATABASE_PASS | |
| valueFrom: | |
| secretKeyRef: | |
| name: {{ template "applogic.fullname" . }} | |
| key: dbPassword | |
| {{- end }} | |
| {{- if .Values.rabbitmq.password }} | |
| - name: RABBITMQ_PASSWORD | |
| valueFrom: | |
| secretKeyRef: | |
| name: {{ template "applogic.fullname" . }} | |
| key: rabbitmqPassword | |
| - name: EVENT_API_RABBITMQ_PASSWORD | |
| valueFrom: | |
| secretKeyRef: | |
| name: {{ template "applogic.fullname" . }} | |
| key: rabbitmqPassword | |
| {{- end }} | |
| {{- range $key, $value := .Values.app.vars }} | |
| - name: {{ $key }} | |
| value: {{ $value | quote }} | |
| {{- end }} | |
| {{- end }} | |
| {{/* | |
| labels.standard prints the standard Helm labels. | |
| The standard labels are frequently used in metadata. | |
| */}} | |
| {{- define "applogic.labels.standard" -}} | |
| app: {{ template "applogic.name" . }} | |
| heritage: {{ .Release.Service | quote }} | |
| release: {{ .Release.Name | quote }} | |
| chart: {{ template "applogic.chartref" . }} | |
| {{ if $.Values.keel.enabled -}} | |
| keel.sh/policy: {{ $.Values.keel.policy }} | |
| keel.sh/trigger: poll | |
| {{ end }} | |
| {{- end -}} | |
| {{/* | |
| chartref prints a chart name and version. | |
| It does minimal escaping for use in Kubernetes labels. | |
| */}} | |
| {{- define "applogic.chartref" -}} | |
| {{- replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name -}} | |
| {{- end -}} | |
| {{/* | |
| Templates in applogic.utils namespace are help functions. | |
| */}} | |
| {{/* | |
| applogic.utils.tls functions makes host-tls from host name | |
| usage: {{ "www.example.com" | applogic.utils.tls }} | |
| output: www-example-com-tls | |
| */}} | |
| {{- define "applogic.utils.tls" -}} | |
| {{- $host := index . | replace "." "-" -}} | |
| {{- printf "%s-tls" $host -}} | |
| {{- end -}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment