| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| name: {{ include "apisix.fullname" . }} |
| namespace: {{ .Release.Namespace }} |
| labels: |
| {{- include "apisix.labels" . | nindent 4 }} |
| spec: |
| {{- if not .Values.autoscaling.enabled }} |
| replicas: {{ .Values.replicaCount }} |
| {{- end }} |
| selector: |
| matchLabels: |
| {{- include "apisix.selectorLabels" . | nindent 6 }} |
| template: |
| metadata: |
| {{- with .Values.podAnnotations }} |
| annotations: |
| {{- toYaml . | nindent 8 }} |
| checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| {{- end }} |
| labels: |
| {{- include "apisix.selectorLabels" . | nindent 8 }} |
| spec: |
| {{- with .Values.imagePullSecrets }} |
| imagePullSecrets: |
| {{- toYaml . | nindent 8 }} |
| {{- end }} |
| securityContext: |
| {{- toYaml .Values.podSecurityContext | nindent 8 }} |
| containers: |
| - name: {{ .Chart.Name }} |
| securityContext: |
| {{- toYaml .Values.securityContext | nindent 12 }} |
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| imagePullPolicy: {{ .Values.image.pullPolicy }} |
| ports: |
| - name: http |
| containerPort: {{ .Values.gateway.http.containerPort }} |
| protocol: TCP |
| - name: tls |
| containerPort: {{ .Values.gateway.tls.containerPort }} |
| protocol: TCP |
| {{- if .Values.admin.enabled }} |
| - name: admin |
| containerPort: {{ .Values.admin.port }} |
| protocol: TCP |
| {{- end }} |
| readinessProbe: |
| failureThreshold: 6 |
| initialDelaySeconds: 10 |
| periodSeconds: 10 |
| successThreshold: 1 |
| tcpSocket: |
| port: {{ .Values.gateway.http.containerPort }} |
| timeoutSeconds: 1 |
| lifecycle: |
| preStop: |
| exec: |
| command: |
| - /bin/sh |
| - -c |
| - "sleep 30" |
| volumeMounts: |
| - mountPath: /usr/local/apisix/conf/config.yaml |
| name: apisix-config |
| subPath: config.yaml |
| resources: |
| {{- toYaml .Values.resources | nindent 12 }} |
| {{- if .Values.etcd.enabled }} |
| initContainers: |
| - name: wait-etcd |
| image: busybox:1.28 |
| command: ['sh', '-c', "until nc -z {{ .Release.Name }}-etcd.{{ .Release.Namespace }}.svc.{{ .Values.gateway.k8s_domain }} {{ .Values.etcd.defaultPort }}; do echo waiting for etcd `date`; sleep 2; done;"] |
| {{- end }} |
| volumes: |
| - configMap: |
| name: {{ include "apisix.fullname" . }} |
| name: apisix-config |
| {{- with .Values.nodeSelector }} |
| nodeSelector: |
| {{- toYaml . | nindent 8 }} |
| {{- end }} |
| {{- if .Values.affinity.enable }} |
| affinity: |
| podAntiAffinity: |
| preferredDuringSchedulingIgnoredDuringExecution: |
| - podAffinityTerm: |
| labelSelector: |
| matchExpressions: |
| - key: app.kubernetes.io/name |
| operator: In |
| values: |
| - {{ include "apisix.name" . }} |
| topologyKey: kubernetes.io/hostname |
| weight: 100' |
| {{- end }} |
| {{- with .Values.tolerations }} |
| tolerations: |
| {{- toYaml . | nindent 8 }} |
| {{- end }} |