Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kubespray
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Kubespray
Commits
569a319f
Commit
569a319f
authored
2 years ago
by
Calin Cristian Andrei
Browse files
Options
Downloads
Patches
Plain Diff
[calico] don't clobber user set bgp configuration options that are not managed by kubespray
parent
47812ec0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
roles/network_plugin/calico/tasks/install.yml
+39
-21
39 additions, 21 deletions
roles/network_plugin/calico/tasks/install.yml
with
39 additions
and
21 deletions
roles/network_plugin/calico/tasks/install.yml
+
39
−
21
View file @
569a319f
...
@@ -297,27 +297,45 @@
...
@@ -297,27 +297,45 @@
-
inventory_hostname in groups['k8s_cluster']
-
inventory_hostname in groups['k8s_cluster']
run_once
:
yes
run_once
:
yes
-
name
:
Calico | Set up BGP Configuration
-
block
:
command
:
-
name
:
Calico | Get existing BGP Configuration
cmd
:
"
{{
bin_dir
}}/calicoctl.sh
apply
-f
-"
command
:
"
{{
bin_dir
}}/calicoctl.sh
get
bgpconfig
default
-o
json"
stdin
:
"
{{
stdin
is
string
|
ternary(stdin,
stdin|to_json)
}}"
register
:
_bgp_config_cmd
vars
:
ignore_errors
:
True
stdin
:
>
changed_when
:
False
{ "kind": "BGPConfiguration",
"apiVersion": "projectcalico.org/v3",
-
name
:
Calico | Set kubespray BGP Configuration
"metadata": {
set_fact
:
"name": "default",
_bgp_config
:
>
},
{
"spec": {
"kind": "BGPConfiguration",
"listenPort": {{ calico_bgp_listen_port }},
"apiVersion": "projectcalico.org/v3",
"logSeverityScreen": "Info",
"metadata": {
{% if not calico_no_global_as_num|default(false) %}"asNumber": {{ global_as_num }},{% endif %}
"name": "default",
"nodeToNodeMeshEnabled": {{ nodeToNodeMeshEnabled|default('true') }} ,
},
{% if calico_advertise_cluster_ips|default(false) %}
"spec": {
"serviceClusterIPs": [{"cidr": "{{ kube_service_addresses }}" } {{ ',{"cidr":"' + kube_service_addresses_ipv6 + '"}' if enable_dual_stack_networks else '' }}],{% endif %}
"listenPort": {{ calico_bgp_listen_port }},
{% if calico_advertise_service_loadbalancer_ips|length > 0 %}"serviceLoadBalancerIPs": {{ _service_loadbalancer_ips }},{% endif %}
"logSeverityScreen": "Info",
"serviceExternalIPs": {{ _service_external_ips|default([]) }} }}
{% if not calico_no_global_as_num|default(false) %}"asNumber": {{ global_as_num }},{% endif %}
changed_when
:
false
"nodeToNodeMeshEnabled": {{ nodeToNodeMeshEnabled|default('true') }} ,
{% if calico_advertise_cluster_ips|default(false) %}
"serviceClusterIPs": [{"cidr": "{{ kube_service_addresses }}" } {{ ',{"cidr":"' + kube_service_addresses_ipv6 + '"}' if enable_dual_stack_networks else '' }}],{% endif %}
{% if calico_advertise_service_loadbalancer_ips|length > 0 %}"serviceLoadBalancerIPs": {{ _service_loadbalancer_ips }},{% endif %}
"serviceExternalIPs": {{ _service_external_ips|default([]) }}
}
}
-
name
:
Calico | Process BGP Configuration
set_fact
:
_bgp_config
:
"
{{
_bgp_config_cmd.stdout
|
from_json
|
combine(_bgp_config,
recursive=True)
}}"
when
:
-
_bgp_config_cmd is success
-
name
:
Calico | Set up BGP Configuration
command
:
cmd
:
"
{{
bin_dir
}}/calicoctl.sh
apply
-f
-"
stdin
:
"
{{
_bgp_config
is
string
|
ternary(_bgp_config,
_bgp_config|to_json)
}}"
changed_when
:
False
when
:
when
:
-
inventory_hostname == groups['kube_control_plane'][0]
-
inventory_hostname == groups['kube_control_plane'][0]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment