Voltha stacks on same node
Change-Id: Ide97ca9ed76c206e51d424dcb427854e119efa24
diff --git a/voltha/Chart.yaml b/voltha/Chart.yaml
index 60088be..394da55 100644
--- a/voltha/Chart.yaml
+++ b/voltha/Chart.yaml
@@ -14,7 +14,7 @@
---
apiVersion: "v1"
name: "voltha"
-version: "2.10.3"
+version: "2.10.4"
description: "A Helm chart for Voltha based on K8S resources in Voltha project"
keywords:
- "onf"
diff --git a/voltha/templates/core-deploy.yaml b/voltha/templates/core-deploy.yaml
index 7134aca..84f13e4 100644
--- a/voltha/templates/core-deploy.yaml
+++ b/voltha/templates/core-deploy.yaml
@@ -137,3 +137,30 @@
{{- if .Values.resources.rw_core.limits.cpu }}
cpu: {{ .Values.resources.rw_core.limits.cpu }}
{{- end }}
+ affinity:
+ podAffinity:
+ preferredDuringSchedulingIgnoredDuringExecution:
+ {{- if .Values.scheduleRules.preferStackPodsOnSameNode }}
+ - podAffinityTerm:
+ topologyKey: kubernetes.io/hostname
+ labelSelector:
+ matchExpressions:
+ - key: app.kubernetes.io/stack
+ operator: In
+ values:
+ - {{ .Values.global.stack_name }}
+ weight: 100
+ {{- end }}
+ podAntiAffinity:
+ preferredDuringSchedulingIgnoredDuringExecution:
+ {{- if .Values.scheduleRules.preferStacksOnDifferentNodes }}
+ - podAffinityTerm:
+ topologyKey: kubernetes.io/hostname
+ labelSelector:
+ matchExpressions:
+ - key: app.kubernetes.io/name
+ operator: In
+ values:
+ - read-write-core
+ weight: 100
+ {{- end }}
diff --git a/voltha/templates/ofagent-deploy.yaml b/voltha/templates/ofagent-deploy.yaml
index 112b348..2aac00c 100644
--- a/voltha/templates/ofagent-deploy.yaml
+++ b/voltha/templates/ofagent-deploy.yaml
@@ -137,3 +137,30 @@
{{- if .Values.resources.ofagent.limits.cpu }}
cpu: {{ .Values.resources.ofagent.limits.cpu }}
{{- end }}
+ affinity:
+ podAffinity:
+ preferredDuringSchedulingIgnoredDuringExecution:
+ {{- if .Values.scheduleRules.preferStackPodsOnSameNode }}
+ - podAffinityTerm:
+ topologyKey: kubernetes.io/hostname
+ labelSelector:
+ matchExpressions:
+ - key: app.kubernetes.io/stack
+ operator: In
+ values:
+ - {{ .Values.global.stack_name }}
+ weight: 100
+ {{- end }}
+ podAntiAffinity:
+ preferredDuringSchedulingIgnoredDuringExecution:
+ {{- if .Values.scheduleRules.preferStacksOnDifferentNodes }}
+ - podAffinityTerm:
+ topologyKey: kubernetes.io/hostname
+ labelSelector:
+ matchExpressions:
+ - key: app.kubernetes.io/name
+ operator: In
+ values:
+ - open-flow-agent
+ weight: 100
+ {{- end }}
diff --git a/voltha/values.yaml b/voltha/values.yaml
index 2bc6ea6..b25670b 100644
--- a/voltha/values.yaml
+++ b/voltha/values.yaml
@@ -141,3 +141,8 @@
limits:
cpu: ~
memory: ~
+
+# Define scheduling rules for stack pods
+scheduleRules:
+ preferStackPodsOnSameNode: false
+ preferStacksOnDifferentNodes: false