Skip to content

Render deployment

Alberto Femenías Hermida edited this page Feb 16, 2021 · 7 revisions

Basic structure

name: <name_of_the_deployment>
selector:  <selectors>
annotations: <anotations>
replicas: <n_replicas>

containers:
  - name: <name_of_the_container>
    image: ...
    command:  ...
    ...
    ports: ...

Prefapp-helm-render uses the same nomenclature as the standard k8s artifact, with the following exceptions:

ports

Instead of:

ports:
  - containerPort: 80

The render expects:

ports:
  - pod: 80

This decision will be explained in detail in the Render-service documentation.

env

The render expects the environment values to be added in 4 different ways (all of them can be combined):

env_literal

env_literal:
  VAR_NAME1: "value1"
  VAR_NAME2: "value2"

envFrom

envFrom:
  configmaps:
    - <configmap_artifact_name1>
    - <configmap_artifact_name2>

  secrets:
    - <secret_artifact_name1>
    - <secret_artifact_name2>

env_values_secret

env_values_secret:
  - secret: <secret_artifact_name>
    values:
      VAR_NAME1: SECRET_NAME1
      VAR_NAME2: SECRET_NAME2

env_values_configmap

env_values_configmap:
  - configmap: <configmap_artifact_name>
      values:
        VAR_NAME1: CONFIG_NAME1
        VAR_NAME2: CONFIG_NAME2

Deployment example

# deploy.yaml
{{ define "frontend.deploy.data"  }}
name: despregue-{{ .Release.Name }}-php
selector: {{ .Values.selector_meiga | toYaml | nindent 2}}
replicas: 1

containers:
- name: app-php
  image: {{ .Values.imagenes.frontend }}
  env_values_secret:
  - secret: {{ .Release.Name }}-secrets
    values:
      MYSQL_PASSWORD: root-password
  envFrom:
    configmaps:
    - {{ .Release.Name }}-config
  command: ["php", "-S", "0.0.0.0:80"]
  ports: {{ .Values.ports | toYaml | nindent 6 }}

{{- end }}
{{ include "ph.deployment.render" (include "frontend.deploy.data" . | fromYaml )  }}

Clone this wiki locally