Created
January 11, 2025 07:12
-
-
Save rbbratta/f4ffbfc2cd5f1af84badcd91b128da93 to your computer and use it in GitHub Desktop.
make-br-ex-ovs-bond-extra-mcs.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function make_mc () { | |
yq << EOF | |
interfaces: | |
- name: bond0 | |
type: bond | |
state: absent | |
- name: br-ex | |
type: ovs-bridge | |
state: up | |
ipv4: | |
enabled: false | |
dhcp: false | |
ipv6: | |
enabled: false | |
dhcp: false | |
bridge: | |
allow-extra-patch-ports: true | |
port: | |
- name: br-ex | |
- name: patch-ex-to-phy | |
ovs-db: | |
external_ids: | |
bridge-uplink: "patch-ex-to-phy" | |
- name: br-ex | |
type: ovs-interface | |
state: up | |
copy-mac-from: eno2 | |
ipv4: | |
enabled: true | |
address: | |
- ip: "192.168.111.$1" | |
prefix-length: 24 | |
ipv6: | |
enabled: false | |
dhcp: false | |
- name: br-phy | |
type: ovs-bridge | |
state: up | |
ipv4: | |
enabled: false | |
dhcp: false | |
ipv6: | |
enabled: false | |
dhcp: false | |
bridge: | |
allow-extra-patch-ports: true | |
port: | |
- name: patch-phy-to-ex | |
- name: ovs-bond | |
link-aggregation: | |
mode: balance-slb | |
port: | |
- name: eno2 | |
- name: eno3 | |
- name: patch-ex-to-phy | |
type: ovs-interface | |
state: up | |
patch: | |
peer: patch-phy-to-ex | |
- name: patch-phy-to-ex | |
type: ovs-interface | |
state: up | |
patch: | |
peer: patch-ex-to-phy | |
- name: eno1 | |
type: ethernet | |
state: up | |
ipv4: | |
enabled: false | |
ipv6: | |
enabled: false | |
dns-resolver: | |
config: | |
server: | |
- 192.168.111.1 | |
routes: | |
config: | |
- destination: 0.0.0.0/0 | |
next-hop-address: 192.168.111.1 | |
next-hop-interface: br-ex | |
EOF | |
} | |
MASTERS=() | |
for f in {0..2} ; do | |
MASTERS[f]=$(make_mc 11${f} | yq | tee master-$f.yml | base64 -w0) | |
done | |
cat <<EOF | tee br-ex-master.yaml | |
apiVersion: machineconfiguration.openshift.io/v1 | |
kind: MachineConfig | |
metadata: | |
labels: | |
machineconfiguration.openshift.io/role: master | |
name: 10-br-ex-master | |
spec: | |
config: | |
ignition: | |
version: 3.2.0 | |
storage: | |
files: | |
- contents: | |
source: data:text/plain;charset=utf-8;base64,${MASTERS[0]} | |
mode: 0644 | |
overwrite: true | |
path: /etc/nmstate/openshift/master-0.yml | |
- contents: | |
source: data:text/plain;charset=utf-8;base64,${MASTERS[1]} | |
mode: 0644 | |
overwrite: true | |
path: /etc/nmstate/openshift/master-1.yml | |
- contents: | |
source: data:text/plain;charset=utf-8;base64,${MASTERS[2]} | |
mode: 0644 | |
overwrite: true | |
path: /etc/nmstate/openshift/master-2.yml | |
EOF | |
#oc get mc -o yaml rendered-master-353c | yq '.spec.config.storage.files[] | select(.path == "/etc/nmstate/openshift/master-0.yml") | .contents.source' | python3 -c 'import sys ; from urllib.request import urlopen ; sys.stdout.buffer.write(urlopen(sys.stdin.read()).read())' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment