From 8c0a2741ae1076521d4dc994943f08dbaa75fd54 Mon Sep 17 00:00:00 2001
From: Cristian Calin <6627509+cristicalin@users.noreply.github.com>
Date: Tue, 11 May 2021 17:05:36 +0300
Subject: [PATCH] allow overriding calico peers names and avoid ipv6 naming
 issues (#7591)

---
 roles/network_plugin/calico/tasks/install.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/roles/network_plugin/calico/tasks/install.yml b/roles/network_plugin/calico/tasks/install.yml
index fb202611f..9237cb587 100644
--- a/roles/network_plugin/calico/tasks/install.yml
+++ b/roles/network_plugin/calico/tasks/install.yml
@@ -227,7 +227,7 @@
       {"apiVersion": "projectcalico.org/v3",
       "kind": "BGPPeer",
       "metadata": {
-        "name": "global-{{ item.router_id }}"
+        "name": "global-{{ item.name | default(item.router_id|replace(':','-')) }}"
       },
       "spec": {
         "asNumber": "{{ item.as }}",
@@ -381,7 +381,7 @@
       {"apiVersion": "projectcalico.org/v3",
       "kind": "BGPPeer",
       "metadata": {
-        "name": "{{ inventory_hostname }}-{{ item.router_id }}"
+        "name": "{{ inventory_hostname }}-{{ item.name | default(item.router_id|replace(':','-')) }}"
       },
       "spec": {
         "asNumber": "{{ item.as }}",
-- 
GitLab