Skip to content

Commit 8f65ae4

Browse files
committed
Merge infrahub-git agent and task runner into task-worker for helm
1 parent d9c8955 commit 8f65ae4

File tree

7 files changed

+47
-228
lines changed

7 files changed

+47
-228
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ python_sdk/dist/*
3333
# Generated files
3434
generated/
3535
query_performance_results/
36-
sync/dist/
36+
sync/dist/
37+
helm/charts/
38+
helm/Chart.lock

helm/Chart.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
apiVersion: v2
33
name: infrahub
44
description: A Helm chart to deploy Infrahub on Kubernetes
5+
icon: https://github.com/opsmill/infrahub/raw/develop/frontend/app/public/favicons/logo512.png
56
# A chart can be either an 'application' or a 'library' chart.
67
#
78
# Application charts are a collection of templates that can be packaged into versioned archives

helm/templates/_env.tpl

Lines changed: 12 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -87,88 +87,45 @@ Define default env variables if required.
8787
{{- end }}
8888
{{- end }}
8989

90-
{{- define "infrahub-helm.infrahubGit.defaultEnv" -}}
91-
{{- if not .Values.infrahubGit.infrahubGit.env.KUBERNETES_CLUSTER_DOMAIN }}
90+
{{- define "infrahub-helm.infrahubTaskWorker.defaultEnv" -}}
91+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.KUBERNETES_CLUSTER_DOMAIN }}
9292
- name: KUBERNETES_CLUSTER_DOMAIN
9393
value: {{ quote .Values.global.kubernetesClusterDomain }}
9494
{{- end }}
95-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_ADDRESS }}
96-
- name: INFRAHUB_ADDRESS
97-
value: http://{{ include "infrahub-helm.fullname" . }}-infrahub-server:8000
98-
{{- end }}
99-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_INTERNAL_ADDRESS }}
100-
- name: INFRAHUB_INTERNAL_ADDRESS
101-
value: "http://{{ include "infrahub-helm.fullname" . }}-infrahub-server:8000"
102-
{{- end }}
103-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_DB_ADDRESS }}
104-
- name: INFRAHUB_DB_ADDRESS
105-
value: "{{ include "infrahub-helm.fullname" . }}-database"
106-
{{- end }}
107-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_DB_PORT }}
108-
- name: INFRAHUB_DB_PORT
109-
value: "{{ .Values.neo4j.services.neo4j.ports.bolt.port }}"
110-
{{- end }}
111-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_BROKER_ADDRESS }}
112-
- name: INFRAHUB_BROKER_ADDRESS
113-
value: "{{ include "infrahub-helm.fullname" . }}-message-queue"
114-
{{- end }}
115-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_BROKER_USERNAME }}
116-
- name: INFRAHUB_BROKER_USERNAME
117-
value: {{ .Values.rabbitmq.auth.username | quote }}
118-
{{- end }}
119-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_BROKER_PASSWORD }}
120-
- name: INFRAHUB_BROKER_PASSWORD
121-
value: {{ .Values.rabbitmq.auth.password | quote }}
122-
{{- end }}
123-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_CACHE_ADDRESS }}
124-
- name: INFRAHUB_CACHE_ADDRESS
125-
value: "{{ include "infrahub-helm.fullname" . }}-cache-master"
126-
{{- end }}
127-
{{- if not .Values.infrahubGit.infrahubGit.env.INFRAHUB_CACHE_PORT }}
128-
- name: INFRAHUB_CACHE_PORT
129-
value: "{{ .Values.redis.master.service.ports.redis }}"
130-
{{- end }}
131-
{{- end }}
132-
133-
{{- define "infrahub-helm.infrahubTaskRunner.defaultEnv" -}}
134-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.KUBERNETES_CLUSTER_DOMAIN }}
135-
- name: KUBERNETES_CLUSTER_DOMAIN
136-
value: {{ quote .Values.global.kubernetesClusterDomain }}
137-
{{- end }}
138-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_ADDRESS }}
95+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_ADDRESS }}
13996
- name: INFRAHUB_ADDRESS
14097
value: http://{{ include "infrahub-helm.fullname" . }}-infrahub-server.{{ .Release.Namespace }}.svc.{{ .Values.global.kubernetesClusterDomain }}:8000
14198
{{- end }}
142-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_INTERNAL_ADDRESS }}
99+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_INTERNAL_ADDRESS }}
143100
- name: INFRAHUB_INTERNAL_ADDRESS
144101
value: "http://{{ include "infrahub-helm.fullname" . }}-infrahub-server.{{ .Release.Namespace }}.svc.{{ .Values.global.kubernetesClusterDomain }}:8000"
145102
{{- end }}
146-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_DB_ADDRESS }}
103+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_DB_ADDRESS }}
147104
- name: INFRAHUB_DB_ADDRESS
148105
value: "{{ include "infrahub-helm.fullname" . }}-database.{{ .Release.Namespace }}.svc.{{ .Values.global.kubernetesClusterDomain }}"
149106
{{- end }}
150-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_DB_PORT }}
107+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_DB_PORT }}
151108
- name: INFRAHUB_DB_PORT
152109
value: "{{ .Values.neo4j.services.neo4j.ports.bolt.port }}"
153110
{{- end }}
154-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_BROKER_ADDRESS }}
111+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_BROKER_ADDRESS }}
155112
- name: INFRAHUB_BROKER_ADDRESS
156113
value: "{{ include "infrahub-helm.fullname" . }}-message-queue.{{ .Release.Namespace }}.svc.{{ .Values.global.kubernetesClusterDomain }}"
157114
{{- end }}
158-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_BROKER_USERNAME }}
115+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_BROKER_USERNAME }}
159116
- name: INFRAHUB_BROKER_USERNAME
160117
value: {{ .Values.rabbitmq.auth.username | quote }}
161118
{{- end }}
162-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_BROKER_PASSWORD }}
119+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_BROKER_PASSWORD }}
163120
- name: INFRAHUB_BROKER_PASSWORD
164121
value: {{ .Values.rabbitmq.auth.password | quote }}
165122
{{- end }}
166-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_CACHE_ADDRESS }}
123+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_CACHE_ADDRESS }}
167124
- name: INFRAHUB_CACHE_ADDRESS
168125
value: "{{ include "infrahub-helm.fullname" . }}-cache-master.{{ .Release.Namespace }}.svc.{{ .Values.global.kubernetesClusterDomain }}"
169126
{{- end }}
170-
{{- if not .Values.infrahubTaskRunner.infrahubTaskRunner.env.INFRAHUB_CACHE_PORT }}
127+
{{- if not .Values.infrahubTaskWorker.infrahubTaskWorker.env.INFRAHUB_CACHE_PORT }}
171128
- name: INFRAHUB_CACHE_PORT
172129
value: "{{ .Values.redis.master.service.ports.redis }}"
173130
{{- end }}
174-
{{- end }}
131+
{{- end }}

helm/templates/infrahub-server.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ spec:
8484
volumeMounts:
8585
- mountPath: /opt/infrahub/storage
8686
name: infrahub-server-storage-data
87-
- name: workflow-data
88-
mountPath: /opt/infrahub/workflow
8987
restartPolicy: Always
9088
volumes:
9189
{{- if and .Values.infrahubServer.persistence.enabled }}
@@ -96,14 +94,6 @@ spec:
9694
- name: infrahub-server-storage-data
9795
emptyDir: {}
9896
{{- end }}
99-
{{- if and .Values.infrahubTaskRunner.persistence.enabled }}
100-
- name: workflow-data
101-
persistentVolumeClaim:
102-
claimName: {{ tpl (.Values.infrahubTaskRunner.persistence.existingClaim | default (printf "%s-%s" (include "infrahub-helm.fullname" .) "workflow-data")) . }}
103-
{{- else }}
104-
- name: workflow-data
105-
emptyDir: {}
106-
{{- end }}
10797

10898
---
10999
apiVersion: v1
@@ -145,4 +135,4 @@ spec:
145135
{{- with .Values.infrahubServer.persistence.storageClassName }}
146136
storageClassName: {{ . }}
147137
{{- end }}
148-
{{- end }}
138+
{{- end }}

helm/templates/infrahub-task-runner.yaml

Lines changed: 0 additions & 97 deletions
This file was deleted.

helm/templates/infrahub-git.yaml renamed to helm/templates/infrahub-task-worker.yaml

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,64 @@
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:
5-
name: {{ include "infrahub-helm.fullname" . }}-infrahub-git
5+
name: {{ include "infrahub-helm.fullname" . }}-infrahub-task-worker
66
namespace: "{{ .Release.Namespace }}"
77
labels:
8-
service: infrahub-git
8+
service: infrahub-task-worker
99
{{- include "infrahub-helm.labels" . | nindent 4 }}
1010
annotations:
1111
{{- include "infrahub-helm.annotations" . | nindent 4 }}
1212
spec:
13-
replicas: {{ .Values.infrahubGit.replicas | default 1 }}
13+
replicas: {{ .Values.infrahubTaskWorker.replicas | default 2 }}
1414
selector:
1515
matchLabels:
16-
service: infrahub-git
16+
service: infrahub-task-worker
1717
{{- include "infrahub-helm.selectorLabels" . | nindent 6 }}
1818
template:
1919
metadata:
2020
labels:
21-
service: infrahub-git
22-
{{- with .Values.infrahubGit.podLabels }}
21+
service: infrahub-task-worker
22+
{{- with .Values.infrahubTaskWorker.podLabels }}
2323
{{- toYaml . | nindent 8 }}
2424
{{- end }}
2525
{{- include "infrahub-helm.selectorLabels" . | nindent 8 }}
26-
{{- with .Values.infrahubGit.podAnnotations }}
26+
{{- with .Values.infrahubTaskWorker.podAnnotations }}
2727
annotations:
2828
{{- toYaml . | nindent 8 }}
2929
{{- end }}
3030
spec:
31-
{{- with .Values.infrahubGit.affinity }}
31+
{{- with .Values.infrahubTaskWorker.affinity }}
3232
affinity: {{- toYaml . | nindent 8 }}
3333
{{- end }}
34-
{{- with .Values.infrahubGit.tolerations }}
34+
{{- with .Values.infrahubTaskWorker.tolerations }}
3535
tolerations: {{- toYaml . | nindent 8 }}
3636
{{- end }}
37-
{{- with .Values.infrahubGit.runtimeClassName }}
37+
{{- with .Values.infrahubTaskWorker.runtimeClassName }}
3838
runtimeClassName: {{ . }}
3939
{{- end }}
40-
{{- with .Values.infrahubGit.podSecurityContext }}
40+
{{- with .Values.infrahubTaskWorker.podSecurityContext }}
4141
securityContext: {{- toYaml . | nindent 8 }}
4242
{{- end }}
4343
containers:
44-
- args: {{- toYaml .Values.infrahubGit.infrahubGit.args | nindent 12 }}
44+
- name: infrahub-task-worker
45+
args: {{- toYaml .Values.infrahubTaskWorker.infrahubTaskWorker.args | nindent 12 }}
4546
env:
46-
{{- include "infrahub-helm.infrahubGit.defaultEnv" . | nindent 12 }}
47-
{{- range $key, $value := .Values.infrahubGit.infrahubGit.env }}
47+
{{- include "infrahub-helm.infrahubTaskWorker.defaultEnv" . | nindent 12 }}
48+
{{- range $key, $value := .Values.infrahubTaskWorker.infrahubTaskWorker.env }}
4849
- name: {{ $key }}
4950
value: {{ $value | quote }}
5051
{{- end }}
51-
{{- with .Values.infrahubGit.infrahubGit.envFromExistingSecret }}
52+
{{- with .Values.infrahubTaskWorker.infrahubTaskWorker.envFromExistingSecret }}
5253
envFrom:
5354
- secretRef:
5455
name: {{ . }}
5556
{{- end }}
56-
image: {{ default .Values.global.imageRegistry .Values.infrahubGit.infrahubGit.imageRegistry }}/{{ .Values.global.infrahubRepository }}:{{ .Values.global.infrahubTag | default .Chart.AppVersion }}
57-
imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.infrahubGit.infrahubGit.imagePullPolicy }}
58-
name: infrahub-git
59-
{{- with .Values.infrahubGit.resources }}
57+
image: {{ default .Values.global.imageRegistry .Values.infrahubTaskWorker.infrahubTaskWorker.imageRegistry }}/{{ .Values.global.infrahubRepository }}:{{ .Values.global.infrahubTag | default .Chart.AppVersion }}
58+
imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.infrahubTaskWorker.infrahubTaskWorker.imagePullPolicy }}
59+
{{- with .Values.infrahubTaskWorker.resources }}
6060
resources: {{- toYaml . | nindent 12 }}
6161
{{- end }}
62-
{{- with .Values.infrahubGit.infrahubGit.securityContext }}
62+
{{- with .Values.infrahubTaskWorker.infrahubTaskWorker.securityContext }}
6363
securityContext: {{- toYaml . | nindent 12 }}
6464
{{- end }}
6565
tty: true
@@ -68,16 +68,16 @@ spec:
6868
mountPath: /opt/infrahub/git
6969
restartPolicy: Always
7070
volumes:
71-
{{- if and .Values.infrahubGit.persistence.enabled }}
71+
{{- if and .Values.infrahubTaskWorker.persistence.enabled }}
7272
- name: git-data
7373
persistentVolumeClaim:
74-
claimName: {{ tpl (.Values.infrahubGit.persistence.existingClaim | default (printf "%s-%s" (include "infrahub-helm.fullname" .) "git-data")) . }}
74+
claimName: {{ tpl (.Values.infrahubTaskWorker.persistence.existingClaim | default (printf "%s-%s" (include "infrahub-helm.fullname" .) "git-data")) . }}
7575
{{- else }}
7676
- name: git-data
7777
emptyDir: {}
7878
{{- end }}
7979

80-
{{- if and .Values.infrahubGit.persistence.enabled (not .Values.infrahubGit.persistence.existingClaim) }}
80+
{{- if and .Values.infrahubTaskWorker.persistence.enabled (not .Values.infrahubTaskWorker.persistence.existingClaim) }}
8181
---
8282
apiVersion: v1
8383
kind: PersistentVolumeClaim
@@ -87,15 +87,13 @@ metadata:
8787
labels:
8888
service: git-data
8989
{{- include "infrahub-helm.labels" . | nindent 4 }}
90-
annotations:
91-
{{- include "infrahub-helm.annotations" . | nindent 4 }}
9290
spec:
9391
accessModes:
94-
- {{ .Values.infrahubGit.persistence.accessMode }}
92+
- {{ .Values.infrahubTaskWorker.persistence.accessMode }}
9593
resources:
9694
requests:
97-
storage: {{ .Values.infrahubGit.persistence.size | quote }}
98-
{{- with .Values.infrahubGit.persistence.storageClassName }}
95+
storage: {{ .Values.infrahubTaskWorker.persistence.size | quote }}
96+
{{- with .Values.infrahubTaskWorker.persistence.storageClassName }}
9997
storageClassName: {{ . }}
10098
{{- end }}
101-
{{- end }}
99+
{{- end }}

0 commit comments

Comments
 (0)