Skip to content

Commit

Permalink
fix: CLUSTER_DNS_SVC_IP & CLUSTER_KUBERNETES_SVC_IP ip concat error
Browse files Browse the repository at this point in the history
  • Loading branch information
yunpiao authored and Your Name committed Nov 14, 2024
1 parent 8d17c08 commit edf6513
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion roles/cluster-addon/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# default values

# coredns 服务地址,根据SERVICE_CIDR 设置,默认选择网段第二个地址
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|int + 2 }}"
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|regex_replace('/.*', '')|int + 2 }}"
2 changes: 1 addition & 1 deletion roles/kube-master/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ TMP_ENDPOINTS: "{% for h in groups['etcd'] %}https://{{ h }}:2379,{% endfor %}"
ETCD_ENDPOINTS: "{{ TMP_ENDPOINTS.rstrip(',') }}"

# kubernetes.default.svc 地址根据SERVICE_CIDR 设置为网段的第一个地址
CLUSTER_KUBERNETES_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|int + 1 }}"
CLUSTER_KUBERNETES_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|regex_replace('/.*', '')|int + 1 }}"
2 changes: 1 addition & 1 deletion roles/kube-node/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ KUBE_APISERVER: "https://127.0.0.1:{{ SECURE_PORT }}"
CGROUP_DRIVER: "systemd"

# coredns 服务地址,根据SERVICE_CIDR 设置,默认选择网段第二个地址
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|int + 2 }}"
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|regex_replace('/.*', '')|int + 2 }}"

# pod-max-pids
POD_MAX_PIDS: -1
Expand Down
4 changes: 2 additions & 2 deletions roles/kube-ovn/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CLUSTER_CIDR_GW 作为 POD_GATEWAY,选取CLUSTER_CIDR 网段中的第一个地址
CLUSTER_CIDR_GW: "{{ CLUSTER_CIDR.split('.')[0] }}.{{ CLUSTER_CIDR.split('.')[1] }}.{{ CLUSTER_CIDR.split('.')[2] }}.{{ CLUSTER_CIDR.split('.')[3]|int + 1 }}"
CLUSTER_CIDR_GW: "{{ CLUSTER_CIDR.split('.')[0] }}.{{ CLUSTER_CIDR.split('.')[1] }}.{{ CLUSTER_CIDR.split('.')[2] }}.{{ CLUSTER_CIDR.split('.')[3]|regex_replace('/.*', '')|int + 1 }}"

# coredns 服务地址,根据SERVICE_CIDR 设置,默认选择网段第二个地址
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|int + 2 }}"
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|regex_replace('/.*', '')|int + 2 }}"

0 comments on commit edf6513

Please sign in to comment.