This is an automated email from the ASF dual-hosted git repository.

dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-deploy-kube.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b334f7  Fix to check if affinity is enabled (#606)
7b334f7 is described below

commit 7b334f778792013ebce47822e8c5c36467c57c5c
Author: Seonghyun Oh <[email protected]>
AuthorDate: Mon Jun 22 22:06:30 2020 +0900

    Fix to check if affinity is enabled (#606)
---
 README.md                                     | 13 +++++++++++++
 helm/openwhisk/templates/invoker-pod.yaml     |  2 ++
 helm/openwhisk/templates/user-events-pod.yaml |  2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index e42c93d..6372420 100644
--- a/README.md
+++ b/README.md
@@ -200,6 +200,19 @@ If you have dedicated Ingress nodes, label them with
 Event Providers on specific nodes, label those nodes with
 `openwhisk-role=provider`.
 
+### Disabling affinity (not recommended)
+If the Kubernetes cluster does not allow you to assign a label to a node, or 
you cannot use the affinity attribute, you can disable it.
+Please note that it is suitable for testing purposes only and may interfere 
with the OpenWhisk control plane.
+
+You can disable affinity by editing the `mycluster.yaml` file:
+
+```yaml
+affinity:
+  enabled: false
+invoker:
+  options: "-Dwhisk.kubernetes.user-pod-node-affinity.enabled=false"
+```
+
 ## Customize the Deployment
 
 You must create a `mycluster.yaml` file to record key aspects of your
diff --git a/helm/openwhisk/templates/invoker-pod.yaml 
b/helm/openwhisk/templates/invoker-pod.yaml
index 6747ff0..e1431de 100644
--- a/helm/openwhisk/templates/invoker-pod.yaml
+++ b/helm/openwhisk/templates/invoker-pod.yaml
@@ -56,11 +56,13 @@ spec:
 {{- end }}
       restartPolicy: {{ .Values.invoker.restartPolicy }}
 
+{{- if .Values.affinity.enabled }}
       affinity:
 {{ include "openwhisk.affinity.invoker" . | indent 8 }}
 {{- if eq .Values.invoker.containerFactory.impl "kubernetes" }}
 {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-invoker" 
.Release.Name ) | indent 8 }}
 {{- end }}
+{{- end }}
 
 {{- if .Values.toleration.enabled }}
       tolerations:
diff --git a/helm/openwhisk/templates/user-events-pod.yaml 
b/helm/openwhisk/templates/user-events-pod.yaml
index aaf6ce7..47c551d 100644
--- a/helm/openwhisk/templates/user-events-pod.yaml
+++ b/helm/openwhisk/templates/user-events-pod.yaml
@@ -39,7 +39,7 @@ spec:
     spec:
       restartPolicy: {{ .Values.user_events.restartPolicy }}
 
-      {{- if .Values.metrics.userMetricsEnabled }}
+      {{- if and .Values.affinity.enabled .Values.metrics.userMetricsEnabled }}
       affinity:
 {{ include "openwhisk.affinity.core" . | indent 8 }}
 {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-user-events" 
.Release.Name ) | indent 8 }}

Reply via email to