github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/charts/chainlink/templates/chainlink-deployment.yaml (about)

     1  {{- range $cfg := .Values.nodes }}
     2  apiVersion: apps/v1
     3  {{- if $.Values.db.stateful }}
     4  kind: StatefulSet
     5  {{- else }}
     6  kind: Deployment
     7  {{- end }}
     8  metadata:
     9    name: {{ $.Release.Name }}-{{ $cfg.name }}
    10  spec:
    11  {{ if $.Values.db.stateful }}
    12    serviceName: {{ $.Release.Name }}-{{ $cfg.name }}
    13  {{- end }}
    14    selector:
    15      matchLabels:
    16        app: {{ $.Release.Name }}
    17        instance: {{ $cfg.name }}
    18        release: {{ $.Release.Name }}
    19    template:
    20      metadata:
    21        labels:
    22          app: {{ $.Release.Name }}
    23          instance: {{ $cfg.name }}
    24          release: {{ $.Release.Name }}
    25          {{- range $key, $value := $.Values.labels }}
    26          {{ $key }}: {{ $value | quote }}
    27          {{- end }}
    28        annotations:
    29          prometheus.io/scrape: 'true'
    30      spec:
    31        volumes:
    32          - name: {{ $.Release.Name }}-{{ $cfg.name }}-config-map
    33            configMap:
    34              name: {{ $.Release.Name }}-{{ $cfg.name }}-cm
    35        containers:
    36          - name: node
    37            {{- $image := $.Values.chainlink.image.image }}
    38            {{- $tag := $.Values.chainlink.image.version }}
    39            {{- if $cfg.chainlink }}
    40              {{- if $cfg.chainlink.image }}
    41                  {{- if $cfg.chainlink.image.image }}
    42                      {{ $image = $cfg.chainlink.image.image }}
    43                  {{- end }}
    44                  {{- if $cfg.chainlink.image.version }}
    45                      {{ $tag = $cfg.chainlink.image.version }}
    46                  {{- end }}
    47              {{- end }}
    48            {{- end }}
    49            image: {{ $image }}:{{ $tag }}
    50            imagePullPolicy: IfNotPresent
    51            command: [ "/bin/bash" ]
    52            args:
    53              - "-c"
    54              - |-
    55                while ! pg_isready -d $POSTGRES_DB -h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER; do sleep 1; done && chainlink -c /etc/node-secrets-volume/default.toml -c /etc/node-secrets-volume/overrides.toml -secrets /etc/node-secrets-volume/secrets.toml node start -d -p /etc/node-secrets-volume/node-password -a /etc/node-secrets-volume/apicredentials --vrfpassword=/etc/node-secrets-volume/apicredentials;
    56            ports:
    57              - name: access
    58                containerPort: {{ $.Values.chainlink.web_port }}
    59              - name: p2p
    60                containerPort: {{ $.Values.chainlink.p2p_port }}
    61            env:
    62              - name: POSTGRES_HOST
    63                value: {{ $.Release.Name }}-postgres-{{ $cfg.name }}.{{ $.Release.Namespace }}.svc.cluster.local
    64              - name: POSTGRES_PORT
    65                value: "5432"
    66              - name: POSTGRES_USER
    67                value: {{ $.Values.db.postgresUser }}
    68              - name: POSTGRES_DB
    69                value: {{ $.Values.db.postgresDatabase }}
    70              - name: CL_DATABASE_URL
    71                value: postgresql://{{ $.Values.db.postgresUser }}:{{ $.Values.db.postgresPassword }}@{{ $.Release.Name }}-postgres-{{ $cfg.name }}.{{ $.Release.Namespace }}.svc.cluster.local:5432/{{ $.Values.db.postgresDatabase }}?sslmode=disable
    72            {{- range $key, $value := $.Values.env }}
    73              {{- if $value }}
    74              - name: {{ $key | upper}}
    75                {{- if kindIs "string" $value}}
    76                value: {{ $value | quote}}
    77                {{- else }}
    78                value: {{ $value }}
    79                {{- end }}
    80              {{- end }}
    81            {{- end }}
    82            volumeMounts:
    83              - name: {{ $.Release.Name }}-{{ $cfg.name }}-config-map
    84                mountPath: /etc/node-secrets-volume/
    85            livenessProbe:
    86              httpGet:
    87                path: /health
    88                port: {{ $.Values.chainlink.web_port }}
    89              initialDelaySeconds: 1
    90              periodSeconds: 5
    91              timeoutSeconds: 10
    92            readinessProbe:
    93              httpGet:
    94                path: /health
    95                port: {{ $.Values.chainlink.web_port }}
    96              initialDelaySeconds: 1
    97              periodSeconds: 5
    98              timeoutSeconds: 10
    99            startupProbe:
   100              httpGet:
   101                path: /
   102                port: {{ $.Values.chainlink.web_port }}
   103              initialDelaySeconds: 15
   104              periodSeconds: 5
   105              failureThreshold: 20
   106            resources:
   107              requests:
   108                memory: {{ $.Values.chainlink.resources.requests.memory }}
   109                cpu: {{ $.Values.chainlink.resources.requests.cpu }}
   110              limits:
   111                memory: {{ $.Values.chainlink.resources.limits.memory }}
   112                cpu: {{ $.Values.chainlink.resources.limits.cpu }}
   113                {{- with $.Values.nodeSelector }}
   114        nodeSelector:
   115  {{ toYaml . | indent 8 }}
   116  {{- end }}
   117  {{- with $.Values.affinity }}
   118        affinity:
   119  {{ toYaml . | indent 8 }}
   120  {{- end }}
   121  {{- with $.Values.tolerations }}
   122        tolerations:
   123  {{ toYaml . | indent 8 }}
   124  {{- end }}
   125  ---
   126  {{- end }}