Automator: update common-files@master in istio/istio.io@master (#11569)

This commit is contained in:
Istio Automation 2022-07-12 14:52:54 -07:00 committed by GitHub
parent 3605f728d6
commit fd7f905b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -1 +1 @@
f4eb0b919f940a9e2071b77cc45c1193351ae4a4
09fa47866350d4e93a5b8e82fb892a916da32798

View File

@ -414,9 +414,17 @@ function cidr_to_ips() {
# cidr_to_ips returns a list of single IPs from a CIDR. We skip 1000 (since they are likely to be allocated
# already to other services), then pick the next 100.
python3 - <<EOF
from ipaddress import ip_network;
from ipaddress import ip_network, IPv6Network;
from itertools import islice;
[print(str(ip) + "/" + str(ip.max_prefixlen)) for ip in islice(ip_network('$CIDR').hosts(), 1000, 1100)]
net = ip_network('$CIDR')
net_bits = 128 if type(net) == IPv6Network else 32;
net_len = pow(2, net_bits - net.prefixlen)
start, end = int(net_len / 4 * 3), net_len
if net_len > 2000:
start, end = 1000, 2000
[print(str(ip) + "/" + str(ip.max_prefixlen)) for ip in islice(ip_network('$CIDR').hosts(), start, end)]
EOF
}