Skip to content

Commit

Permalink
fix filter "ansible.netcommon.next_nth_usable" has been deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
buxiaomo committed Nov 13, 2024
1 parent 5031c67 commit 9df0a75
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions roles/add-on/templates/coredns.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -177,25 +177,25 @@ spec:
k8s-app: kube-dns
{% if (networking.podSubnet.split(',') | length == 2) and (networking.serviceSubnet.split(',') | length == 2) %}
ipFamilyPolicy: PreferDualStack
{% if networking.serviceSubnet.split(',')[0] | default('10.96.0.0/12') | ansible.netcommon.next_nth_usable(2) | ip == 4 %}
{% if networking.serviceSubnet.split(',')[0] | default('10.96.0.0/12') | ansible.utils.next_nth_usable(2) | ip == 4 %}
ipFamilies:
- IPv4
- IPv6
clusterIP: {{ networking.serviceSubnet.split(',')[0] | ansible.netcommon.next_nth_usable(2) }}
clusterIP: {{ networking.serviceSubnet.split(',')[0] | ansible.utils.next_nth_usable(2) }}
clusterIPs:
- {{ networking.serviceSubnet.split(',')[0] | ansible.netcommon.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[1] | ansible.netcommon.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[0] | ansible.utils.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[1] | ansible.utils.next_nth_usable(2) }}
{% else %}
ipFamilies:
- IPv6
- IPv4
clusterIP: {{ networking.serviceSubnet.split(',')[1] | ansible.netcommon.next_nth_usable(2) }}
clusterIP: {{ networking.serviceSubnet.split(',')[1] | ansible.utils.next_nth_usable(2) }}
clusterIPs:
- {{ networking.serviceSubnet.split(',')[1] | ansible.netcommon.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[0] | ansible.netcommon.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[1] | ansible.utils.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[0] | ansible.utils.next_nth_usable(2) }}
{% endif %}
{% else %}
clusterIP: {{ networking.serviceSubnet | default('10.96.0.0/12') | ansible.netcommon.next_nth_usable(2) }}
clusterIP: {{ networking.serviceSubnet | default('10.96.0.0/12') | ansible.utils.next_nth_usable(2) }}
{% endif %}
ports:
- name: dns
Expand Down
4 changes: 2 additions & 2 deletions roles/kube-apiserver/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
- "IP:127.0.0.1"
- "IP:0:0:0:0:0:0:0:1"
- "IP:::1"
- "IP:{{ networking.serviceSubnet.split(',')[0] | default('10.96.0.0/12') | ansible.netcommon.next_nth_usable(1) }}"
- "IP:{{ networking.serviceSubnet.split(',')[1] | default('fd74:ca9b:0172:0019::/110') | ansible.netcommon.next_nth_usable(1) }}"
- "IP:{{ networking.serviceSubnet.split(',')[0] | default('10.96.0.0/12') | ansible.utils.next_nth_usable(1) }}"
- "IP:{{ networking.serviceSubnet.split(',')[1] | default('fd74:ca9b:0172:0019::/110') | ansible.utils.next_nth_usable(1) }}"
- "IP:{{ inventory_hostname }}"
- "{% if ansible_default_ipv6.address is defined %}IP:{{ ansible_default_ipv6.address }}{% else %}IP:::1{% endif %}"
- "{% if ipv6 is defined %}IP:{{ ipv6 }}{% else %}IP:::1{% endif %}"
Expand Down
6 changes: 3 additions & 3 deletions roles/kubelet/templates/kubelet.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ cgroupDriver: systemd
cgroupsPerQOS: true
clusterDNS:
{% if networking.serviceSubnet.split(',') | length == 2 %}
- {{ networking.serviceSubnet.split(',')[0] | default('10.96.0.0/12') | ansible.netcommon.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[1] | default('fd74:ca9b:0172:0019::/110') | ansible.netcommon.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[0] | default('10.96.0.0/12') | ansible.utils.next_nth_usable(2) }}
- {{ networking.serviceSubnet.split(',')[1] | default('fd74:ca9b:0172:0019::/110') | ansible.utils.next_nth_usable(2) }}
{% else %}
- {{ networking.serviceSubnet | default('10.96.0.0/12') | ansible.netcommon.next_nth_usable(2) }}
- {{ networking.serviceSubnet | default('10.96.0.0/12') | ansible.utils.next_nth_usable(2) }}
{% endif %}
clusterDomain: {{ networking.dnsDomain | default('cluster.local') }}
configMapAndSecretChangeDetectionStrategy: Watch
Expand Down

0 comments on commit 9df0a75

Please sign in to comment.