Repository navigation
Render
Alberto Femenías Hermida edited this page Feb 16, 2021
·
6 revisions
Renders are chart helpers that receive an object and produce the appropriate standard k8s artifact.
Here is an example of a minimal deploy using Prefapp-helm render:
{{- define "my.deploy.data" -}}
name: mydeploy
selector:
app: nginx-app
containers:
- name: nginx
image: nginx:1.19.6
{{- end -}}
{{ include "ph.deployment.render" (include "my.deploy.data" . | fromYaml ) }}Whose rendered information would be:
kind: Deployment
apiVersion: apps/v1
metadata:
name: mydeploy
labels:
annotations:
spec:
replicas: 1
selector:
matchLabels:
app: nginx-app
template:
metadata:
labels:
app: nginx-app
annotations:
spec:
containers:
- name: nginx
image: "nginx:1.19.6"
imagePullPolicy: IfNotPresent
env:
envFrom:
ports:
volumeMounts:
resources:
requests:
{}
limits:
{}
imagePullSecrets:
volumes:There is a different render for each of the kubernetes artifact: ph.deployment.render, ph.service.render, ph.configmap.render...
The prefapp-helm-render expects an object with the following structure:
{{- define "foo.deploy.data" -}}
name: <name_of_the_deployment>
selector: <selectors>
annotations: <anotations>
replicas: <n_replicas>
containers:
- name: <name_of_the_container>
image: ...
command: ...
...
ports: ...
{{- end -}}
{{ include "ph.deployment.render" (include "foo.deploy.data" . | fromYaml ) }}Prefapp-helm-render uses the same nomenclature as the standard k8s artifact, with the following exceptions:
Instead of:
ports:
- containerPort: 80
The render expects:
ports:
- pod: 80
This decision will be explained in detail in the Service structure documentation.
The render expects the environment values to be added in 4 different ways: