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/10/11 02:35:52 UTC

[apisix-helm-chart] branch master updated: fix: incluster name resolve issue (#333)

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 d6c0c34  fix: incluster name resolve issue (#333)
d6c0c34 is described below

commit d6c0c34d6efc5100a4ffe7f69dfc495860710c92
Author: fengxsong <fe...@outlook.com>
AuthorDate: Tue Oct 11 10:35:48 2022 +0800

    fix: incluster name resolve issue (#333)
    
    Signed-off-by: fengxsong <fe...@outlook.com>
---
 charts/apisix/README.md              |  1 +
 charts/apisix/templates/_helpers.tpl | 14 --------------
 charts/apisix/templates/_pod.tpl     |  8 +++++++-
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index fac8d4d..7840429 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -50,6 +50,7 @@ The following tables lists the configurable parameters of the apisix chart and t
 |---------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
 | `apisix.enabled`                                  | Enable or disable Apache APISIX itself                                                                                                                                                                                                                                                                                       | `true`                                                 |
 | `apisix.enableIPv6`                               | Enable nginx IPv6 resolver                                                                                                                                                                                                                                                                                                   | `true`                                                 |
+| `apisix.hostNetwork`                              | Use the host's network namespace                                                                                                                                                                                                                                                                                                  | `false`                                                 |
 | `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`                                        |
diff --git a/charts/apisix/templates/_helpers.tpl b/charts/apisix/templates/_helpers.tpl
index 70f34e8..181e5ee 100644
--- a/charts/apisix/templates/_helpers.tpl
+++ b/charts/apisix/templates/_helpers.tpl
@@ -96,17 +96,3 @@ prometheus:
 {{- define "apisix.pluginAttrs" -}}
 {{- merge .Values.pluginAttrs (include "apisix.basePluginAttrs" . | fromYaml) | toYaml -}}
 {{- end -}}
-
-{{- define "apisix.podAntiAffinity" -}}
-{{- if and .Values.apisix.hostNetwork (eq .Values.apisix.kind "Deployment") }}
-podAntiAffinity:
-  requiredDuringSchedulingIgnoredDuringExecution:
-    - labelSelector:
-        matchExpressions:
-          - key: app.kubernetes.io/instance
-            operator: In
-            values:
-              - {{ .Release.Name }}
-      topologyKey: "kubernetes.io/hostname"
-{{- end }}
-{{- end -}}
diff --git a/charts/apisix/templates/_pod.tpl b/charts/apisix/templates/_pod.tpl
index 890f48c..6d5afea 100644
--- a/charts/apisix/templates/_pod.tpl
+++ b/charts/apisix/templates/_pod.tpl
@@ -118,6 +118,10 @@ spec:
       {{- end }}
       resources:
       {{- toYaml .Values.apisix.resources | nindent 8 }}
+  {{- if .Values.apisix.hostNetwork }}
+  hostNetwork: true
+  dnsPolicy: ClusterFirstWithHostNet
+  {{- end }}
   hostNetwork: {{ .Values.apisix.hostNetwork }}
   {{- if .Values.etcd.enabled }}
   initContainers:
@@ -170,8 +174,10 @@ spec:
   nodeSelector:
     {{- toYaml . | nindent 4 }}
   {{- end }}
+  {{- with .Values.apisix.affinity }}
   affinity:
-  {{- merge .Values.apisix.affinity (include "apisix.podAntiAffinity" . | fromYaml) | toYaml | nindent 4 }}
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
   {{- with .Values.apisix.tolerations }}
   tolerations:
     {{- toYaml . | nindent 4 }}