From 0d0cc8cf9cbc3e1a2a16f182dfca72dda6c78117 Mon Sep 17 00:00:00 2001
From: Victor Morales <v.morales@samsung.com>
Date: Tue, 22 Sep 2020 00:44:47 -0700
Subject: [PATCH] Add multi architeture support to flannel (#6166)

Signed-off-by: Victor Morales <v.morales@samsung.com>
---
 .../flannel/templates/cni-flannel.yml.j2             | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/roles/network_plugin/flannel/templates/cni-flannel.yml.j2 b/roles/network_plugin/flannel/templates/cni-flannel.yml.j2
index efcebaf4c..485afe293 100644
--- a/roles/network_plugin/flannel/templates/cni-flannel.yml.j2
+++ b/roles/network_plugin/flannel/templates/cni-flannel.yml.j2
@@ -38,11 +38,16 @@ data:
 {% endif %}
       }
     }
+{% for arch in ['amd64', 'arm64', 'arm', 'ppc64le', 's390x'] %}
 ---
 apiVersion: apps/v1
 kind: DaemonSet
 metadata:
+{% if arch == 'amd64' %}
   name: kube-flannel
+{% else %}
+  name: kube-flannel-ds-{{ arch }}
+{% endif %}
   namespace: kube-system
   labels:
     tier: node
@@ -61,7 +66,7 @@ spec:
       serviceAccountName: flannel
       containers:
       - name: kube-flannel
-        image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
+        image: {{ flannel_image_repo }}:{{ flannel_image_tag }}-{{ arch }}
         imagePullPolicy: {{ k8s_image_pull_policy }}
         resources:
           limits:
@@ -101,10 +106,10 @@ spec:
                   - key: kubernetes.io/arch
                     operator: In
                     values:
-                      - amd64
+                      - {{ arch }}
       initContainers:
       - name: install-cni
-        image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
+        image: {{ flannel_image_repo }}:{{ flannel_image_tag }}-{{ arch }}
         command:
         - cp
         args:
@@ -137,3 +142,4 @@ spec:
     rollingUpdate:
       maxUnavailable: {{ serial | default('20%') }}
     type: RollingUpdate
+{% endfor %}
-- 
GitLab