Integrating Helm
When working with Helm you can keep your Velocity Blueprint configuration in a separate Helm Values file. Then, before importing to Velocity, you need to generate K8s YAML files that include Velocity Annotations and Templates.

- 1.A Helm chart that specifies the basic application configurations. The chart must include an added section that enables overriding Annotations from a separate Values file, as seen in the example below.
- 2.A Values file with all the production configurations that is used when deploying to production
- 3.A Values file for Velocity, which overrides your production configurations with dev/test configurations. This file will include the added Velocity Annotations and Templates.
With the above setup, running the following command will create a template from the Helm Chart, inject the production configuration, and add the required values for Velocity, resulting in a K8s resource file that can be read by Velocity.
helm template <chart name> -f values/prod.yaml -f values/velocity.yaml
Pay attention to lines 5-8 which enable overriding annotations from a separate Values file.
1
apiVersion: apps/v1
2
kind: Deployment
3
metadata:
4
name: {{ include "chart.fullname" . }}
5
{{- with .Values.annotations }}
6
annotations:
7
{{- toYaml . | nindent 4 }}
8
{{- end }}
9
spec:
10
selector:
11
matchLabels:
12
{{- include "chart.selectorLabels" . | nindent 6 }}
13
template:
14
metadata:
15
{{- with .Values.podAnnotations }}
16
annotations:
17
{{- toYaml . | nindent 8 }}
18
{{- end }}
19
spec:
20
containers:
21
- name: {{ .Chart.Name }}
22
securityContext:
23
{{- toYaml .Values.securityContext | nindent 12 }}
24
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
25
imagePullPolicy: {{ .Values.image.pullPolicy }}
26
envFrom:
27
- secretRef:
28
name: db-credentials
29
optional: false
30
env:
31
- name: SECRET_KEY_BASE
32
value: {{ .Values.secretKeyBase | quote}}
33
- name: RESULT_CREATE_TOKEN
34
value: {{ .Values.authToken | quote}}
35
- name: CALLBACK_URL
36
value: {{ .Values.callbackUrl | quote}}
37
- name: MYSQL_DATABASE_URL
38
value: {{ .Values.mysqlDbUrl | quote}}
39
- name: POSTGRES_DATABASE_URL
40
value: {{ .Values.postgresDbUrl | quote}}
41
- name: ANALYTICS_URL
42
value: {{ .Values.analyticsUrl | quote}}
43
- name: REDIS_URL
44
value: {{ .Values.redisUrl | quote}}
45
ports:
46
- name: http
47
containerPort: 3000
48
protocol: TCP
49
---
50
apiVersion: v1
51
kind: Secret
52
metadata:
53
name: db-credentials
54
annotations:
55
velocity.tech.v1/dependsOn: postgres # Velocity dependencies declaration
56
type: Opaque
57
data:
58
DB_USER: {{ .Values.postgres_user | b64enc }}
59
DB_PASSWORD: {{ .Values.postgres_pass | b64enc }}
annotations:
velocity.tech.v1/id: backend
velocity.tech.v1/dependsOn: mysql-database, postgres
env:
SECRET_KEY_BASE: "{velocity.v1.generate:random}"
RESULT_CREATE_TOKEN: "{velocity.v1.generate:random}"
CALLBACK_URL: "{velocity.v1:backend.exposures(port=http).public.uri}"
MYSQL_DATABASE_URL: "{velocity.v1:mysql-database.exposures(port=mysqlport).uri}/{velocity.v1:mysql-database.exports.dbname}"
ANALYTICS_URL: "{velocity.v1:analytics.exposures(port=analyticsport).uri}"
REDIS_URL: "{velocity.v1:backend-cache.exposures(port=redisport).uri}"
POSTGRES_DATABASE_URL: "{velocity.v1:postgres.exposures(port=postgresport).uri}"
postgres_user: "{velocity.v1:postgres.exposures(port=postgresport).user}"
postgres_pass: "{velocity.v1:postgres.exposures(port=postgresport).password}"
Last modified 3mo ago