Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@
"sslPaths": {
"ca": "KAFKA_CA_PATH",
"key": "KAFKA_KEY_PATH",
"cert": "KAFKA_CERT_PATH"
"cert": "KAFKA_CERT_PATkafH"
},
"sasl": {
"mechanism": "KAFKA_SASL_MECHANISM",
"username": "KAFKA_SASL_USERNAME",
"password": "KAFKA_SASL_PASSWORD"
}
},
"kafkaConsumer": {
Expand Down
8 changes: 2 additions & 6 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ apiVersion: v2
name: geocoding-enrichment
description: A Helm chart for geocoding-enrichment service
type: application
version: 1.4.0
appVersion: 1.4.0
dependencies:
- name: common
repository: oci://acrarolibotnonprod.azurecr.io/helm
version: 1.0.1
version: 0.1.0
appVersion: 0.1.0
121 changes: 61 additions & 60 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "geocoding-enrichment.name" -}}
{{- default .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Returns the tag of the chart.
*/}}
{{- define "geocoding-enrichment.tag" -}}
{{- default (printf "v%s" .Chart.AppVersion) .Values.image.tag }}
{{- 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 "geocoding-enrichment.fullname" -}}
{{- $name := default .Chart.Name }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "geocoding-enrichment.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
Expand All @@ -10,13 +45,6 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Returns the tag of the chart.
*/}}
{{- define "geocoding-enrichment.tag" -}}
{{- default (printf "v%s" .Chart.AppVersion) .Values.image.tag }}
{{- end }}

{{/*
Selector labels
*/}}
Expand All @@ -37,74 +65,47 @@ Returns the environment from global if exists or from the chart's values, defaul
{{- end -}}

{{/*
Returns the tracing url from global if exists or from the chart's values
Returns the cloud provider name from global if exists or from the chart's values, defaults to minikube
*/}}
{{- define "geocoding-enrichment.tracingUrl" -}}
{{- if .Values.global.tracing.url }}
{{- .Values.global.tracing.url -}}
{{- else if .Values.env.tracing.url -}}
{{- .Values.env.tracing.url -}}
{{- end -}}
{{- end -}}

{{/*
Returns the tracing url from global if exists or from the chart's values
*/}}
{{- define "geocoding-enrichment.metricsUrl" -}}
{{- if .Values.global.metrics.url }}
{{- .Values.global.metrics.url -}}
{{- define "geocoding-enrichment.cloudProviderFlavor" -}}
{{- if .Values.global.cloudProvider.flavor }}
{{- .Values.global.cloudProvider.flavor -}}
{{- else if .Values.cloudProvider -}}
{{- .Values.cloudProvider.flavor | default "minikube" -}}
{{- else -}}
{{- .Values.env.metrics.url -}}
{{ "minikube" }}
{{- end -}}
{{- end -}}

{{/*
Return the proper image name
Returns the cloud provider docker registry url from global if exists or from the chart's values
*/}}
{{- define "geocoding-enrichment.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- define "geocoding-enrichment.cloudProviderDockerRegistryUrl" -}}
{{- if .Values.global.cloudProvider.dockerRegistryUrl }}
{{- .Values.global.cloudProvider.dockerRegistryUrl -}}
{{- else if .Values.cloudProvider -}}
{{- .Values.cloudProvider.dockerRegistryUrl -}}
{{- end -}}


{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "geocoding-enrichment.imagePullSecrets" -}}
{{ include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) }}
{{- end -}}

{{/*
Return the proper image pullPolicy
*/}}
{{- define "geocoding-enrichment.pullPolicy" -}}
{{ include "common.images.pullPolicy" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}

{{/*
Return the proper image deploymentFlavor
*/}}
{{- define "geocoding-enrichment.deploymentFlavor" -}}
{{ include "common.images.deploymentFlavor" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}


{{/*
Return the proper fully qualified app name
Returns the tracing url from global if exists or from the chart's values
*/}}
{{- define "geocoding-enrichment.fullname" -}}
{{ include "common.names.fullname" . }}
{{- define "geocoding-enrichment.tracingUrl" -}}
{{- if .Values.global.tracing.url }}
{{- .Values.global.tracing.url -}}
{{- else if .Values.cloudProvider -}}
{{- .Values.env.tracing.url -}}
{{- end -}}

{{/*
Return the proper chart name
*/}}
{{- define "geocoding-enrichment.name" -}}
{{ include "common.names.name" . }}
{{- end -}}

{{/*
Return the proper chart name
Returns the tracing url from global if exists or from the chart's values
*/}}
{{- define "geocoding-enrichment.chart" -}}
{{ include "common.names.chart" . }}
{{- define "geocoding-enrichment.metricsUrl" -}}
{{- if .Values.global.metrics.url }}
{{- .Values.global.metrics.url -}}
{{- else -}}
{{- .Values.env.metrics.url -}}
{{- end -}}
{{- end -}}
39 changes: 32 additions & 7 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
{{- $chartName := include "geocoding-enrichment.name" . -}}
{{- $tracingUrl := include "geocoding-enrichment.tracingUrl" . -}}
{{- $metricsUrl := include "geocoding-enrichment.metricsUrl" . -}}
{{- if .Values.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-configmap" (include "geocoding-enrichment.fullname" .) }}
name: {{ .Release.Name }}-{{ $chartName }}-configmap
data:
NODE_TLS_REJECT_UNAUTHORIZED: "0"
KAFKAJS_NO_PARTITIONER_WARNING: "1"
REQUEST_PAYLOAD_LIMIT: {{ .Values.env.requestPayloadLimit | quote }}
RESPONSE_COMPRESSION_ENABLED: {{ .Values.env.responseCompressionEnabled | quote }}
LOG_LEVEL: {{ .Values.env.logLevel | quote }}
LOG_PRETTY_PRINT_ENABLED: {{ .Values.env.logPrettyPrintEnabled | quote }}
{{ if .Values.env.tracing.enabled }}
KAFKA_INPUT_TOPIC: {{ .Values.kafkaTopics.input | quote }}
KAFKA_CONSUMER_GROUP_ID: {{ .Values.kafkaConsumers.groupId | quote }}
{{- with .Values.kafka }}
KAFKA_BROKERS: {{ .brokers | quote }}
{{- if .sslAuth.enabled }}
KAFKA_ENABLE_SSL_AUTH: "true"
KAFKA_CA_PATH: {{ .sslAuth.certDir }}/{{ .sslAuth.caFileName }}
KAFKA_KEY_PATH: {{ .sslAuth.certDir }}/{{ .sslAuth.keyFileName }}
KAFKA_CERT_PATH: {{ .sslAuth.certDir }}/{{ .sslAuth.certFileName }}
{{- else }}
KAFKA_ENABLE_SSL_AUTH: "false"
{{- end }}
{{- if .sasl }}
KAFKA_SASL_MECHANISM: {{ .sasl.mechanism }}
{{- end }}
{{- end }}
USER_DATA_SERVICE_ENDPOINT: {{ .Values.application.userDataService.endpoint | quote }}
HEADER_PARAMS: {{ .Values.application.userDataService.headers | quote }}
{{- with .Values.elastic }}
ELASTIC_URL: {{ .node | quote }}
ELASTIC_INDEX: {{ .properties.index | quote }}
{{- end }}
{{- if .Values.env.tracing.enabled }}
TELEMETRY_TRACING_ENABLED: 'true'
TELEMETRY_TRACING_URL: {{ $tracingUrl }}
{{ end }}
{{ if .Values.env.metrics.enabled }}
TELEMETRY_TRACING_RATIO: {{ .Values.env.tracing.ratio | quote }}
{{- end }}
{{- if .Values.env.metrics.enabled }}
TELEMETRY_METRICS_ENABLED: 'true'
TELEMETRY_METRICS_URL: {{ $metricsUrl }}
{{ end }}
npm_config_cache: /tmp/
{{- end }}
{{- end }}
{{- end }}
100 changes: 36 additions & 64 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
{{- $releaseName := .Release.Name -}}
{{- $chartName := include "geocoding-enrichment.name" . -}}
{{- $cloudProviderFlavor := include "geocoding-enrichment.cloudProviderFlavor" . -}}
{{- $cloudProviderDockerRegistryUrl := include "geocoding-enrichment.cloudProviderDockerRegistryUrl" . -}}
{{- $tag := include "geocoding-enrichment.tag" . -}}
{{- if .Values.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ printf "%s-deployment" (include "geocoding-enrichment.fullname" .) }}
name: {{ $releaseName }}-{{ $chartName }}
labels:
app: {{ $chartName }}
component: {{ $chartName }}
environment: {{ include "geocoding-enrichment.environment" . }}
release: {{ $releaseName }}
{{- include "geocoding-enrichment.labels" . | nindent 4 }}
{{- with .Values.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
selector:
matchLabels:
app: {{ $chartName }}
Expand All @@ -27,89 +33,55 @@ spec:
release: {{ $releaseName }}
run: {{ $releaseName }}-{{ $chartName }}
{{- include "geocoding-enrichment.selectorLabels" . | nindent 8 }}
{{- with .Values.podAnnotations }}
annotations:
{{- if .Values.resetOnConfigChange }}
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations | nindent 8 }}
{{- end }}
{{ toYaml . | indent 8 }}
{{- end }}
spec:
{{- include "geocoding-enrichment.imagePullSecrets" . | nindent 6 }}
{{- if .Values.pullSecret }}
imagePullSecrets:
- name: {{ .Values.pullSecret }}
{{ end }}
containers:
- name: {{ $releaseName }}-{{ $chartName }}-deployment
image: {{ include "geocoding-enrichment.image" . }}
{{- if .Values.command }}
command:
{{- toYaml .Values.command | nindent 12 }}
{{- if .Values.args }}
args:
{{- toYaml .Values.args | nindent 12 }}
{{- with .Values.image }}
{{- if ne $cloudProviderFlavor "minikube" }}
image: {{ $cloudProviderDockerRegistryUrl }}/{{ .repository }}:{{ $tag }}
{{- else }}
image: {{ .repository }}:{{ $tag }}
{{- end }}
{{- end }}
volumeMounts:
{{- if .Values.caSecretName }}
- mountPath: {{ printf "%s/%s" .Values.caPath .Values.caKey | quote }}
name: root-ca
subPath: {{ quote .Values.caKey }}
{{- end }}
{{- if .Values.extraVolumeMounts -}}
{{ toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- if .Values.kafka.sslAuth.enabled }}
- name: cert-conf-kafka
mountPath: {{ .Values.kafka.sslAuth.certDir }}
readOnly: true
{{- end }}
env:
- name: SERVER_PORT
value: {{ .Values.env.targetPort | quote }}
{{- if .Values.caSecretName }}
- name: REQUESTS_CA_BUNDLE
value: {{ printf "%s/%s" .Values.caPath .Values.caKey | quote }}
- name: NODE_EXTRA_CA_CERTS
value: {{ printf "[%s/%s]" .Values.caPath .Values.caKey | quote }}
{{- end }}
{{- if .Values.extraEnvVars }}
{{- toYaml .Values.extraEnvVars | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ printf "%s-configmap" (include "geocoding-enrichment.fullname" .) }}
name: {{ $releaseName }}-{{ $chartName }}-configmap
- secretRef:
name: {{ $releaseName }}-{{ $chartName }}-secret
ports:
- name: http
containerPort: {{ .Values.env.targetPort }}
protocol: {{ .Values.env.protocol }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
initialDelaySeconds: {{ .Values.initialDelaySeconds }}
httpGet:
path: {{ .Values.livenessProbe.path }}
port: {{ .Values.env.targetPort }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
httpGet:
path: {{ .Values.readinessProbe.path }}
port: {{ .Values.env.targetPort }}
{{- end }}
path: /liveness
port: http
{{- if .Values.resources.enabled }}
resources:
{{- toYaml .Values.resources.value | nindent 12 }}
{{- end }}
{{- if .Values.sidecars }}
{{ tpl (toYaml .Values.sidecars) . | nindent 8 }}
{{- end }}
volumes:
- name: nginx-config
configMap:
name: 'nginx-extra-configmap'
{{- if .Values.caSecretName }}
- name: root-ca
secret:
secretName: {{ .Values.caSecretName }}
{{- end }}
{{- if .Values.extraVolumes -}}
{{ tpl (toYaml .Values.extraVolumes) . | nindent 8 }}
{{- end }}
{{- end -}}
{{- if .Values.kafka.sslAuth.enabled }}
- name: cert-conf-kafka
secret:
secretName: {{ .Values.kafka.sslAuth.secretName }}
{{- end }}
{{- end -}}
Loading
Loading