ipaddr (deprecated alias) => ansible.utils.ipaddr (#10650)

pull/10661/head
Max Gautier 2023-11-28 09:56:55 +01:00 committed by GitHub
parent cf3ac625da
commit 94d3f65f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 17 deletions

View File

@ -116,8 +116,8 @@ resolvconf_mode: host_resolvconf
# Deploy netchecker app to verify DNS resolve as an HTTP service # Deploy netchecker app to verify DNS resolve as an HTTP service
deploy_netchecker: false deploy_netchecker: false
# Ip address of the kubernetes DNS service (called skydns for historical reasons) # Ip address of the kubernetes DNS service (called skydns for historical reasons)
skydns_server: "{{ kube_service_addresses | ipaddr('net') | ipaddr(3) | ipaddr('address') }}" skydns_server: "{{ kube_service_addresses | ansible.utils.ipaddr('net') | ansible.utils.ipaddr(3) | ansible.utils.ipaddr('address') }}"
skydns_server_secondary: "{{ kube_service_addresses | ipaddr('net') | ipaddr(4) | ipaddr('address') }}" skydns_server_secondary: "{{ kube_service_addresses | ansible.utils.ipaddr('net') | ansible.utils.ipaddr(4) | ansible.utils.ipaddr('address') }}"
dns_domain: "{{ cluster_name }}" dns_domain: "{{ cluster_name }}"
docker_dns_search_domains: docker_dns_search_domains:
- 'default.svc.{{ dns_domain }}' - 'default.svc.{{ dns_domain }}'
@ -232,7 +232,7 @@ kube_network_node_prefix_ipv6: 120
# listening on. # listening on.
# NOTE: loadbalancer_apiserver_localhost somewhat alters the final API enpdoint # NOTE: loadbalancer_apiserver_localhost somewhat alters the final API enpdoint
# access IP value (automatically evaluated below) # access IP value (automatically evaluated below)
kube_apiserver_ip: "{{ kube_service_addresses | ipaddr('net') | ipaddr(1) | ipaddr('address') }}" kube_apiserver_ip: "{{ kube_service_addresses | ansible.utils.ipaddr('net') | ansible.utils.ipaddr(1) | ansible.utils.ipaddr('address') }}"
# NOTE: If you specific address/interface and use loadbalancer_apiserver_localhost # NOTE: If you specific address/interface and use loadbalancer_apiserver_localhost
# loadbalancer_apiserver_localhost (nginx/haproxy) will deploy on masters on 127.0.0.1:{{ loadbalancer_apiserver_port | default(kube_apiserver_port) }} too. # loadbalancer_apiserver_localhost (nginx/haproxy) will deploy on masters on 127.0.0.1:{{ loadbalancer_apiserver_port | default(kube_apiserver_port) }} too.

View File

@ -10,6 +10,6 @@
"routes": [ "routes": [
{ "dst": "0.0.0.0/0" } { "dst": "0.0.0.0/0" }
], ],
"gateway": "{{ node_pod_cidr|ipaddr('net')|ipaddr(1)|ipaddr('address') }}" "gateway": "{{ node_pod_cidr|ansible.utils.ipaddr('net')|ansible.utils.ipaddr(1)|ansible.utils.ipaddr('address') }}"
} }
} }

View File

@ -8,6 +8,6 @@ NM_CONTROLLED=no
MACVLAN_PARENT={{ macvlan_interface }} MACVLAN_PARENT={{ macvlan_interface }}
MACVLAN_MODE=bridge MACVLAN_MODE=bridge
IPADDR={{ node_pod_cidr|ipaddr('net')|ipaddr(1)|ipaddr('address') }} IPADDR={{ node_pod_cidr|ansible.utils.ipaddr('net')|ansible.utils.ipaddr(1)|ansible.utils.ipaddr('address') }}
NETMASK={{ node_pod_cidr|ipaddr('netmask') }} NETMASK={{ node_pod_cidr|ansible.utils.ipaddr('netmask') }}
NETWORK={{ node_pod_cidr|ipaddr('network') }} NETWORK={{ node_pod_cidr|ansible.utils.ipaddr('network') }}

View File

@ -1,3 +1,3 @@
{% if enable_nat_default_gateway %} {% if enable_nat_default_gateway %}
iptables -t nat -D POSTROUTING -s {{ node_pod_cidr|ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE iptables -t nat -D POSTROUTING -s {{ node_pod_cidr|ansible.utils.ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE
{% endif %} {% endif %}

View File

@ -1,3 +1,3 @@
{% if enable_nat_default_gateway %} {% if enable_nat_default_gateway %}
iptables -t nat -I POSTROUTING -s {{ node_pod_cidr|ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE iptables -t nat -I POSTROUTING -s {{ node_pod_cidr|ansible.utils.ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE
{% endif %} {% endif %}

View File

@ -2,7 +2,7 @@
Name=mac0 Name=mac0
[Network] [Network]
Address={{ node_pod_cidr|ipaddr('net')|ipaddr(1)|ipaddr('address') }}/{{ node_pod_cidr|ipaddr('prefix') }} Address={{ node_pod_cidr|ansible.utils.ipaddr('net')|ansible.utils.ipaddr(1)|ansible.utils.ipaddr('address') }}/{{ node_pod_cidr|ansible.utils.ipaddr('prefix') }}
{% for host in groups['kube_node'] %} {% for host in groups['kube_node'] %}
{% if hostvars[host]['access_ip'] is defined %} {% if hostvars[host]['access_ip'] is defined %}

View File

@ -1,6 +1,6 @@
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/bin/bash -c "iptables -t nat -I POSTROUTING -s {{ node_pod_cidr|ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE" ExecStart=/bin/bash -c "iptables -t nat -I POSTROUTING -s {{ node_pod_cidr|ansible.utils.ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE"
[Install] [Install]
WantedBy=sys-subsystem-net-devices-mac0.device WantedBy=sys-subsystem-net-devices-mac0.device

View File

@ -1,9 +1,9 @@
auto mac0 auto mac0
iface mac0 inet static iface mac0 inet static
address {{ node_pod_cidr|ipaddr('net')|ipaddr(1)|ipaddr('address') }} address {{ node_pod_cidr|ansible.utils.ipaddr('net')|ansible.utils.ipaddr(1)|ansible.utils.ipaddr('address') }}
network {{ node_pod_cidr|ipaddr('network') }} network {{ node_pod_cidr|ansible.utils.ipaddr('network') }}
netmask {{ node_pod_cidr|ipaddr('netmask') }} netmask {{ node_pod_cidr|ansible.utils.ipaddr('netmask') }}
broadcast {{ node_pod_cidr|ipaddr('broadcast') }} broadcast {{ node_pod_cidr|ansible.utils.ipaddr('broadcast') }}
pre-up ip link add link {{ macvlan_interface }} mac0 type macvlan mode bridge pre-up ip link add link {{ macvlan_interface }} mac0 type macvlan mode bridge
{% for host in groups['kube_node'] %} {% for host in groups['kube_node'] %}
{% if hostvars[host]['access_ip'] is defined %} {% if hostvars[host]['access_ip'] is defined %}
@ -13,7 +13,7 @@ iface mac0 inet static
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if enable_nat_default_gateway %} {% if enable_nat_default_gateway %}
post-up iptables -t nat -I POSTROUTING -s {{ node_pod_cidr|ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE post-up iptables -t nat -I POSTROUTING -s {{ node_pod_cidr|ansible.utils.ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE
{% endif %} {% endif %}
{% for host in groups['kube_node'] %} {% for host in groups['kube_node'] %}
{% if hostvars[host]['access_ip'] is defined %} {% if hostvars[host]['access_ip'] is defined %}
@ -22,5 +22,5 @@ iface mac0 inet static
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
post-down iptables -t nat -D POSTROUTING -s {{ node_pod_cidr|ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE post-down iptables -t nat -D POSTROUTING -s {{ node_pod_cidr|ansible.utils.ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE
post-down ip link delete mac0 post-down ip link delete mac0