Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add wait-etcd initContainer and support extraInitContainers #709

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/apisix-dashboard/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.8.1
version: 0.8.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
5 changes: 5 additions & 0 deletions charts/apisix-dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documen
| config.conf.log.errorLog.filePath | string | `"/dev/stderr"` | Access log path |
| config.conf.plugins | list | `[]` | Overrides plugins in the APISIX Dashboard conf |
| config.schema.configMap | object | `{}` | Overrides APISIX Dashboard schema.json by mounting configMap containing schema.json |
| extraInitContainers | list | `[]` | Additional `initContainers`, See [Kubernetes initContainers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) for the detail. |
| fullnameOverride | string | `""` | String to fully override apisix-dashboard.fullname template |
| image.pullPolicy | string | `"IfNotPresent"` | Apache APISIX Dashboard image pull policy |
| image.repository | string | `"apache/apisix-dashboard"` | Apache APISIX Dashboard image repository |
Expand All @@ -85,6 +86,10 @@ _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documen
| ingress.enabled | bool | `false` | Set to true to enable ingress record generation |
| ingress.hosts | list | `[{"host":"apisix-dashboard.local","paths":[]}]` | The list of hostnams to be covered with this ingress record |
| ingress.tls | list | `[]` | Create TLS Secret |
| initContainer | object | `{"image":"busybox","securityContext":{},"tag":1.28}` | Set initContainer for Apache APISIX Dashboard pods |
| initContainer.image | string | `"busybox"` | Init container image |
| initContainer.securityContext | object | `{}` | Set the securityContext for the init container |
| initContainer.tag | float | `1.28` | Init container tag |
| labelsOverride | object | `{}` | Override default labels assigned to Apache APISIX dashboard resource |
| nameOverride | string | `""` | String to partially override apisix-dashboard.fullname template (will maintain the release name) |
| nodeSelector | object | `{}` | Node labels for pod assignment |
Expand Down
11 changes: 11 additions & 0 deletions charts/apisix-dashboard/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ spec:
serviceAccountName: {{ include "apisix-dashboard.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: wait-etcd
image: {{ .Values.initContainer.image }}:{{ .Values.initContainer.tag }}
command: ['sh', '-c', 'IFS=","; for endpoint in {{ .Values.config.conf.etcd.endpoints }}; do endpoint=$(echo "$endpoint" | tr -d "[]"); until nc -z "$endpoint" && echo "SUCCESS"; do echo "waiting for etcd at $endpoint `date`"; sleep 2; done; done; unset IFS;']
{{- with .Values.initContainer.securityContext }}
securityContext:
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.extraInitContainers }}
{{- toYaml .Values.extraInitContainers | nindent 4 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down
24 changes: 24 additions & 0 deletions charts/apisix-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,27 @@ affinity: {}
# -- Topology Spread Constraints for pod assignment spread across your cluster among failure-domains
# ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/#spread-constraints-for-pods
topologySpreadConstraints: []

# -- Set initContainer for Apache APISIX Dashboard pods
initContainer:
# -- Init container image
image: busybox
# -- Init container tag
tag: 1.28
# -- Set the securityContext for the init container
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

# -- Additional `initContainers`, See [Kubernetes initContainers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) for the detail.
extraInitContainers: []
# - name: your-image-name
# image: your-image
# imagePullPolicy: Always
# ports:
# - name: portname
# containerPort: 1234