Skip to content

Commit

Permalink
feat(config): update config settings and add persister deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
laurigates committed May 30, 2024
1 parent a895d89 commit 224b365
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 11 deletions.
15 changes: 9 additions & 6 deletions deploy/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ metadata:
name: {{ include "mittaridatapumppu.fullname" . }}-configmap
data:
ALLOWED_IP_ADDRESSES: "{{ .Values.endpoint.allowedIpAddresses }}"
AUTH_TOKEN: "{{ .Values.endpoint.authToken }}"
DATA_SOURCE_NAME: "{{ .Values.endpoint.dataSourceName }}"
ENDPOINT_PATH: "{{ .Values.endpoint.endpointPath }}"
HTTP_REQUESTHANDLER: "{{ .Values.endpoint.httpRequestHandler }}"
KAFKA_HOST: "{{ .Values.kafka.kafkaHost }}"
KAFKA_PORT: "{{ .Values.kafka.kafkaPort }}"
ENDPOINT_CONFIG_URL: "{{ .Values.endpoint.endpointConfigUrl }}"
KAFKA_BOOTSTRAP_SERVERS: "{{ .Values.kafka.kafkaBootstrapServers }}"
KAFKA_GROUP_ID: "{{ .Values.kafka.kafkaGroupId }}"
KAFKA_PARSED_DATA_TOPIC_NAME: "{{ .Values.kafka.kafkaParsedDataTopicName }}"
KAFKA_RAW_DATA_TOPIC_NAME: "{{ .Values.kafka.kafkaRawDataTopicName }}"
DEVICE_REGISTRY_URL: "{{ .Values.parser.deviceRegistryUrl }}"
DEVICE_REGISTRY_TOKEN: "{{ .Values.parser.deviceRegistryToken }}"
DJANGO_SETTINGS_MODULE: "{{ .Values.deviceregistry.djangoSettingsModule }}"
DJANGO_DB_HOST: "{{ .Release.Name }}-{{ .Values.deviceregistry.databaseHost }}"
DJANGO_DB_USER: "{{ .Values.deviceregistry.databaseUser }}"
DJANGO_DB_PASSWORD: "{{ .Values.deviceregistry.databasePassword }}"
DJANGO_DB_PORT: "{{ .Values.deviceregistry.databasePort }}"
DJANGO_DB_NAME: "{{ .Values.deviceregistry.databaseName }}"
ALLOWED_HOSTS: "{{ .Values.deviceregistry.allowedHosts | toStrings }}"
SECRET_KEY: "{{ .Values.deviceregistry.secretKey }}"
INFLUX_BUCKET: "{{ .Values.persister.influxBucket }}"
INFLUX_HOST: "{{ .Values.persister.influxHost }}"
INFLUX_ORG: "{{ .Values.persister.influxOrg }}"
INFLUX_TOKEN: "{{ .Values.persister.influxToken }}"
DEBUG: 1
UVICORN_LOG_LEVEL: "debug"
2 changes: 1 addition & 1 deletion deploy/templates/endpoint-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
imagePullPolicy: {{ .Values.endpoint.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.parser.service.port }}
containerPort: {{ .Values.endpoint.service.port }}
protocol: TCP
# livenessProbe:
# httpGet:
Expand Down
64 changes: 64 additions & 0 deletions deploy/templates/persister-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mittaridatapumppu.fullname" . }}-persister
labels:
{{- include "mittaridatapumppu.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "mittaridatapumppu.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "mittaridatapumppu.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "mittaridatapumppu.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.persister.image.repository }}:{{ .Values.persister.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.persister.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.persister.service.port }}
protocol: TCP
# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ include "mittaridatapumppu.fullname" . }}-configmap
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
15 changes: 15 additions & 0 deletions deploy/templates/persister-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "mittaridatapumppu.fullname" . }}-persister
labels:
{{- include "mittaridatapumppu.labels" . | nindent 4 }}
spec:
type: {{ .Values.persister.service.type }}
ports:
- port: {{ .Values.persister.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "mittaridatapumppu.selectorLabels" . | nindent 4 }}
24 changes: 20 additions & 4 deletions deploy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endpoint:
type: ClusterIP
port: 80
allowedIpAddresses: 127.0.0.1
authToken: abcd1234
dataSourceName: "digita.thingpark.http"
endpointPath: "/digita/v2"
httpRequestHandler: "endpoints.digita.aiothingpark"
endpointConfigUrl: http://deviceregistry:8000/api/v1/hosts/localhost/

deviceregistry:
replicaCount: 1
Expand All @@ -31,6 +28,7 @@ deviceregistry:
service:
type: ClusterIP
port: 80
djangoSettingsModule: "deviceregistry.settings"
databaseHost: "postgresql"
databaseUser: "postgres"
databasePassword: "postgres"
Expand All @@ -53,6 +51,24 @@ parser:
deviceRegistryUrl: "http://deviceregistry/api/v1"
deviceRegistryToken: "1e172012b4404fc4b3d051710f8232a422fa8eaa"

persister:
replicaCount: 1
image:
repository: ghcr.io/city-of-helsinki/mittaridatapumppu-persister
# pullPolicy: IfNotPresent
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.1.1"
service:
type: ClusterIP
port: 80
deviceRegistryUrl: "http://deviceregistry/api/v1"
deviceRegistryToken: "1e172012b4404fc4b3d051710f8232a422fa8eaa"
influxBucket: "devbucket"
influxHost: "http://influxdb2:8086"
influxOrg: "Development"
influxToken: "insercure-token-for-development-and-testing-purposes-only-KxU4jAU23H3vTk"

kafka:
kafkaHost: "kafka-kafka-bootstrap"
kafkaPort: "9092"
Expand Down

0 comments on commit 224b365

Please sign in to comment.