Skip to content

Commit

Permalink
Fix ipv6 address (#44537)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhanss authored Oct 20, 2023
1 parent b1a99b9 commit 8879337
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,31 @@ echo "removing networking config if already exists"

echo "applying dual-stack networking config"

/tmp/yq e --inplace '.platform.vsphere.apiVIPs += [strenv(API_VIP), "fd65:a1a8:60ad:271c::200"]' ${SHARED_DIR}/install-config.yaml
/tmp/yq e --inplace '.platform.vsphere.ingressVIPs += [strenv(INGRESS_VIP), "fd65:a1a8:60ad:271c::201"]' ${SHARED_DIR}/install-config.yaml
SUBNETS_CONFIG=/var/run/vault/vsphere-config/subnets.json
source "${SHARED_DIR}/vsphere_context.sh"
declare vlanid
declare primaryrouterhostname

cat >> "${SHARED_DIR}/install-config.yaml" << EOF
if ! jq -e --arg PRH "$primaryrouterhostname" --arg VLANID "$vlanid" '.[$PRH] | has($VLANID)' "${SUBNETS_CONFIG}"; then
echo "VLAN ID: ${vlanid} does not exist on ${primaryrouterhostname} in subnets.json file. This exists in vault - selfservice/vsphere-vmc/config"
exit 1
fi
machine_cidr_ipv6=$(jq -r --arg PRH "$primaryrouterhostname" --arg VLANID "$vlanid" '.[$PRH][$VLANID].ipv6prefix' "${SUBNETS_CONFIG}")

IPV6_API_VIP="${machine_cidr_ipv6%%::*}::4"
IPV6_INGRESS_VIP="${machine_cidr_ipv6%%::*}::5"
export IPV6_API_VIP
export IPV6_INGRESS_VIP

/tmp/yq e --inplace '.platform.vsphere.apiVIPs += [strenv(API_VIP), strenv(IPV6_API_VIP)]' ${SHARED_DIR}/install-config.yaml
/tmp/yq e --inplace '.platform.vsphere.ingressVIPs += [strenv(INGRESS_VIP), strenv(IPV6_INGRESS_VIP)]' ${SHARED_DIR}/install-config.yaml

cat >>"${SHARED_DIR}/install-config.yaml" <<EOF
networking:
networkType: OVNKubernetes
machineNetwork:
- cidr: 192.168.0.0/16
- cidr: fd65:a1a8:60ad:271c::/64
- cidr: ${machine_cidr_ipv6}
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ ref:
namespace: ocp
tag: latest
commands: ovn-conf-vsphere-dualstack-commands.sh
credentials:
- namespace: test-credentials
name: vsphere-config
mount_path: /var/run/vault/vsphere-config
resources:
requests:
cpu: 10m
Expand Down
1 change: 1 addition & 0 deletions clusters/app.ci/supplemental-ci-images/cli-yq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ items:
dockerfile: |
FROM ocp/4.12:cli
RUN curl -L https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /tmp/yq && chmod +x /tmp/yq
RUN yum install -y jq
type: Dockerfile
strategy:
dockerStrategy:
Expand Down

0 comments on commit 8879337

Please sign in to comment.