You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by zh...@apache.org on 2022/04/15 09:37:23 UTC
[apisix-helm-chart] branch master updated: feat: support deploying apisix in daemonset way (#257)
This is an automated email from the ASF dual-hosted git repository.
zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git
The following commit(s) were added to refs/heads/master by this push:
new 13250df feat: support deploying apisix in daemonset way (#257)
13250df is described below
commit 13250df4dd320f99c7f51192fa7b0b92f18c4c34
Author: 笨兔儿 <ze...@126.com>
AuthorDate: Fri Apr 15 17:37:18 2022 +0800
feat: support deploying apisix in daemonset way (#257)
---
.gitignore | 1 +
charts/apisix/README.md | 69 +++++++++++-----------
.../templates/{deployment.yaml => daemonset.yaml} | 32 ++--------
charts/apisix/templates/deployment.yaml | 6 +-
charts/apisix/values.yaml | 6 ++
5 files changed, 50 insertions(+), 64 deletions(-)
diff --git a/.gitignore b/.gitignore
index bef1900..dcee972 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+.idea/
.DS_Store
test_**.yaml
diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index 331b14f..196031c 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -46,40 +46,39 @@ The following tables lists the configurable parameters of the apisix chart and t
### apisix parameters
-| Parameter | Description | Default |
-|------------------------------------------|-----------------------------------------------------|---------------------------------------------------------|
-| `apisix.enabled` | Enable or disable Apache APISIX itself | `true` |
-| `apisix.enableIPv6` | Enable nginx IPv6 resolver | `true` |
-| `apisix.enableCustomizedConfig` | Enable full customized `config.yaml` | `false` |
-| `apisix.customizedConfig` | If `apisix.enableCustomizedConfig` is true, full customized `config.yaml`. Please note that other settings about APISIX config will be ignored | `{}` |
-| `apisix.image.repository` | Apache APISIX image repository | `apache/apisix` |
-| `apisix.image.tag` | Apache APISIX image tag | `{TAG_NAME}` (the latest Apache APISIX image tag) |
-| `apisix.image.pullPolicy` | Apache APISIX image pull policy | `IfNotPresent` |
-| `apisix.replicaCount` | Apache APISIX deploy replica count | `1` |
-| `apisix.podAnnotations` | Annotations to add to each pod | `{}` |
-| `apisix.podSecurityContext` | Set the securityContext for Apache APISIX pods | `{}` |
-| `apisix.securityContext` | Set the securityContext for Apache APISIX container | `{}` |
-| `apisix.podDisruptionBudget.enabled` | Enable or disable podDisruptionBudget | `false` |
-| `apisix.podDisruptionBudget.minAvailable`| Set the `minAvailable` of podDisruptionBudget. You can specify only one of `maxUnavailable` and `minAvailable` in a single PodDisruptionBudget. See [Specifying a Disruption Budget for your Application](https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget) for more details | `Not set` |
-| `apisix.podDisruptionBudget.maxUnavailable`| Set the maxUnavailable of podDisruptionBudget | `1` |
-| `apisix.resources` | Set pod resource requests & limits | `{}` |
-| `apisix.nodeSelector` | Node labels for Apache APISIX pod assignment | `{}` |
-| `apisix.tolerations` | List of node taints to tolerate | `{}` |
-| `apisix.affinity` | Set affinity for Apache APISIX deploy | `{}` |
-| `apisix.podAntiAffinity.enabled` | Enable or disable podAntiAffinity | `false` |
-| `apisix.setIDFromPodUID` | Whether to use the Pod UID as the APISIX instance id, see [apache/apisix#5417](https://github.com/apache/apisix/issues/5417) to decide whether you should enable this setting) | `false` |
-| `apisix.customLuaSharedDicts` | Add custom [lua_shared_dict](https://github.com/openresty/lua-nginx-module#toc88) settings, click [here](https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L27-L30) to learn the format of a shared dict | `[]` |
-| `apisix.pluginAttrs` | Set APISIX plugin attributes, see [config-default.yaml](https://github.com/apache/apisix/blob/master/conf/config-default.yaml#L376) for more details | `{}` |
-| `apisix.luaModuleHook.enabled` | Whether to add a custom lua module | `false` |
-| `apisix.luaModuleHook.luaPath` | Configure `LUA_PATH` so that your own lua module codes can be located | `""` |
-| `apisix.luaModuleHook.hookPoint` | The entrypoint of your lua module, use Lua require syntax, like `"module.say_hello"` | `""` |
-| `apisix.luaModuleHook.configMapRef.name` | Name of the ConfigMap where the lua module codes store | "" |
-| `apisix.luaModuleHook.configMapRef.mounts[].key` | Name of the ConfigMap key, for setting the mapping relationship between ConfigMap key and the lua module code path. | `""` |
-| `apisix.luaModuleHook.configMapRef.mounts[].path` | Filepath of the plugin code, for setting the mapping relationship between ConfigMap key and the lua module code path. | `""` |
-| `apisix.timezone` | The timezone where APISIX container uses. For example: UTC, Asia/Shanghai. This value will be set on apisix container's environment variable TZ. Sometimes may need to set the timezone to be consistent with local time zone, otherwise the apisix's logs may used to retrieve event maybe in wrong timezone. | `""` |
-| `apisix.extraEnvVars` | APISIX container extra environment variables , See [define-environment-variable-container](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the detail. | `[]`
-| `extraVolumes` | Additional `volume`, See [Kubernetes Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the detail. | `[]` |
-| `extraVolumeMounts` | Additional `volumeMounts`, See [Kubernetes Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the detail. | `[]` |
+| Parameter | Description | Default |
+|---------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
+| `apisix.enabled` | Enable or disable Apache APISIX itself | `true` |
+| `apisix.enableIPv6` | Enable nginx IPv6 resolver | `true` |
+| `apisix.enableCustomizedConfig` | Enable full customized `config.yaml` | `false` |
+| `apisix.customizedConfig` | If `apisix.enableCustomizedConfig` is true, full customized `config.yaml`. Please note that other settings about APISIX config will be ignored | `{}` |
+| `apisix.image.repository` | Apache APISIX image repository | `apache/apisix` |
+| `apisix.image.tag` | Apache APISIX image tag | `{TAG_NAME}` (the latest Apache APISIX image tag) |
+| `apisix.image.pullPolicy` | Apache APISIX image pull policy | `IfNotPresent` |
+| `apisix.kind` | Apache APISIX kind use a `DaemonSet` or `Deployment` | `Deployment` |
+| `apisix.replicaCount` | Apache APISIX deploy replica count,kind is DaemonSet,replicaCount not become effective | `1` |
+| `apisix.podAnnotations` | Annotations to add to each pod | `{}` |
+| `apisix.podSecurityContext` | Set the securityContext for Apache APISIX pods | `{}` |
+| `apisix.securityContext` | Set the securityContext for Apache APISIX container | `{}` |
+| `apisix.podDisruptionBudget.enabled` | Enable or disable podDisruptionBudget | `false` |
+| `apisix.podDisruptionBudget.minAvailable` | Set the `minAvailable` of podDisruptionBudget. You can specify only one of `maxUnavailable` and `minAvailable` in a single PodDisruptionBudget. See [Specifying a Disruption Budget for your Application](https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget) for more details | `Not set` |
+| `apisix.podDisruptionBudget.maxUnavailable` | Set the maxUnavailable of podDisruptionBudget | `1` |
+| `apisix.resources` | Set pod resource requests & limits | `{}` |
+| `apisix.nodeSelector` | Node labels for Apache APISIX pod assignment | `{}` |
+| `apisix.tolerations` | List of node taints to tolerate | `{}` |
+| `apisix.affinity` | Set affinity for Apache APISIX deploy | `{}` |
+| `apisix.podAntiAffinity.enabled` | Enable or disable podAntiAffinity | `false` |
+| `apisix.setIDFromPodUID` | Whether to use the Pod UID as the APISIX instance id, see [apache/apisix#5417](https://github.com/apache/apisix/issues/5417) to decide whether you should enable this setting) | `false` |
+| `apisix.customLuaSharedDicts` | Add custom [lua_shared_dict](https://github.com/openresty/lua-nginx-module#toc88) settings, click [here](https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L27-L30) to learn the format of a shared dict | `[]` |
+| `apisix.pluginAttrs` | Set APISIX plugin attributes, see [config-default.yaml](https://github.com/apache/apisix/blob/master/conf/config-default.yaml#L376) for more details | `{}` |
+| `apisix.luaModuleHook.enabled` | Whether to add a custom lua module | `false` |
+| `apisix.luaModuleHook.luaPath` | Configure `LUA_PATH` so that your own lua module codes can be located | `""` |
+| `apisix.luaModuleHook.hookPoint` | The entrypoint of your lua module, use Lua require syntax, like `"module.say_hello"` | `""` |
+| `apisix.luaModuleHook.configMapRef.name` | Name of the ConfigMap where the lua module codes store | "" |
+| `apisix.luaModuleHook.configMapRef.mounts[].key` | Name of the ConfigMap key, for setting the mapping relationship between ConfigMap key and the lua module code path. | `""` |
+| `apisix.luaModuleHook.configMapRef.mounts[].path` | Filepath of the plugin code, for setting the mapping relationship between ConfigMap key and the lua module code path. | `""` |
+| `extraVolumes` | Additional `volume`, See [Kubernetes Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the detail. | `[]` |
+| `extraVolumeMounts` | Additional `volumeMounts`, See [Kubernetes Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the detail. | `[]` |
### gateway parameters
@@ -220,4 +219,4 @@ Configurations for Apache APISIX ingress-controller sub chart.
| `serviceMonitor.path` | Path of the Prometheus metrics endpoint | `/apisix/prometheus/metrics` |
| `serviceMonitor.containerPort` | Container port which Prometheus metrics are exposed | `9091` |
| `serviceMonitor.labels` | ServiceMonitor extra labels | `{}` |
-| `serviceMonitor.annotations` | ServiceMonitor annotations | `{}` |
+| `serviceMonitor.annotations` | ServiceMonitor annotations | `{}` |
\ No newline at end of file
diff --git a/charts/apisix/templates/deployment.yaml b/charts/apisix/templates/daemonset.yaml
similarity index 88%
copy from charts/apisix/templates/deployment.yaml
copy to charts/apisix/templates/daemonset.yaml
index cc967c3..0eb0146 100644
--- a/charts/apisix/templates/deployment.yaml
+++ b/charts/apisix/templates/daemonset.yaml
@@ -13,22 +13,21 @@
# 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.
-
-{{- if .Values.apisix.enabled }}
+{{- if and (.Values.apisix.enabled) (eq .Values.apisix.kind "DaemonSet") }}
apiVersion: apps/v1
-kind: Deployment
+kind: DaemonSet
metadata:
name: {{ include "apisix.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "apisix.labels" . | nindent 4 }}
spec:
-{{- if not .Values.autoscaling.enabled }}
- replicas: {{ .Values.apisix.replicaCount }}
-{{- end }}
selector:
matchLabels:
{{- include "apisix.selectorLabels" . | nindent 6 }}
+ {{- if .Values.updateStrategy }}
+ updateStrategy: {{ toYaml .Values.updateStrategy | nindent 4 }}
+ {{- end }}
template:
metadata:
annotations:
@@ -51,14 +50,6 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.apisix.image.repository }}:{{ .Values.apisix.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.apisix.image.pullPolicy }}
- env:
- {{- if .Values.apisix.timezone }}
- - name: TZ
- value: {{ .Values.apisix.timezone }}
- {{- end }}
- {{- if .Values.apisix.extraEnvVars }}
- {{- include "apisix.tplvalues.render" (dict "value" .Values.apisix.extraEnvVars "context" $) | nindent 12 }}
- {{- end }}
ports:
- name: http
containerPort: {{ .Values.gateway.http.containerPort }}
@@ -199,19 +190,6 @@ spec:
{{- with .Values.apisix.affinity }}
{{- toYaml . | nindent 8 }}
{{- end }}
- {{- if .Values.apisix.podAntiAffinity.enabled }}
- 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.apisix.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
diff --git a/charts/apisix/templates/deployment.yaml b/charts/apisix/templates/deployment.yaml
index cc967c3..8ad9716 100644
--- a/charts/apisix/templates/deployment.yaml
+++ b/charts/apisix/templates/deployment.yaml
@@ -13,8 +13,7 @@
# 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.
-
-{{- if .Values.apisix.enabled }}
+{{- if and (.Values.apisix.enabled) (eq .Values.apisix.kind "Deployment") }}
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -29,6 +28,9 @@ spec:
selector:
matchLabels:
{{- include "apisix.selectorLabels" . | nindent 6 }}
+ {{- if .Values.updateStrategy }}
+ strategy: {{ toYaml .Values.updateStrategy | nindent 4 }}
+ {{- end }}
template:
metadata:
annotations:
diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml
index 3cd4a61..1057ce4 100644
--- a/charts/apisix/values.yaml
+++ b/charts/apisix/values.yaml
@@ -58,6 +58,9 @@ apisix:
# Overrides the image tag whose default is the chart appVersion.
tag: 2.13.0-alpine
+ # Use a `DaemonSet` or `Deployment`
+ kind: Deployment
+ # kind is DaemonSet,replicaCount not become effective
replicaCount: 1
podAnnotations: {}
@@ -265,6 +268,9 @@ customPlugins:
- key: ""
path: ""
+updateStrategy: {}
+ # type: RollingUpdate
+
extraVolumes: []
# - name: extras
# emptyDir: {}