From e4651358d29f8b711cc87df5837b0882e2d7b86a Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 25 Dec 2024 23:39:06 +0000 Subject: [PATCH] feat(HomeAssistant): Dual NAD VLANs --- .../homeassistant/base/statefulset.yaml | 10 ++- .../network/networkAttachmentDefinition.yaml | 18 ++++ .../nodeNetworkConfigurationPolicy.yaml | 88 +++++++++++++++++++ 3 files changed, 114 insertions(+), 2 deletions(-) diff --git a/kubernetes/homeassistant/base/statefulset.yaml b/kubernetes/homeassistant/base/statefulset.yaml index e790be06..61f150ab 100644 --- a/kubernetes/homeassistant/base/statefulset.yaml +++ b/kubernetes/homeassistant/base/statefulset.yaml @@ -25,11 +25,17 @@ spec: enable.version-checker.io/homeassistant: "true" k8s.v1.cni.cncf.io/networks: | [{ + "name": "br1-vlan2", + "namespace": "default", + "mac": "10:01:01:00:30:02", + "ips": ["10.101.3.2/24"], + "default-route": ["10.101.3.1"] + }, + { "name": "br1", "namespace": "default", "mac": "10:00:00:00:01:35", - "ips": ["10.0.0.135/24"], - "default-route": ["10.0.0.1"] + "ips": ["10.0.0.135/24"] }] spec: securityContext: diff --git a/kubernetes/nmstate/overlays/okd/network/networkAttachmentDefinition.yaml b/kubernetes/nmstate/overlays/okd/network/networkAttachmentDefinition.yaml index aa00bdd5..1ab127d2 100644 --- a/kubernetes/nmstate/overlays/okd/network/networkAttachmentDefinition.yaml +++ b/kubernetes/nmstate/overlays/okd/network/networkAttachmentDefinition.yaml @@ -15,3 +15,21 @@ spec: "topology":"localnet", "netAttachDefName": "default/br1" }' +--- +apiVersion: "k8s.cni.cncf.io/v1" +kind: NetworkAttachmentDefinition +metadata: + name: br1-vlan2 + namespace: default + annotations: + k8s.v1.cni.cncf.io/resourceName: bridge.network.kubevirt.io/br1-vlan2 + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true + argocd.argoproj.io/sync-wave: "4" +spec: + config: '{ + "cniVersion": "0.3.1", + "name": "br1.2", + "type": "ovn-k8s-cni-overlay", + "topology":"localnet", + "netAttachDefName": "default/br1-vlan2" + }' diff --git a/kubernetes/nmstate/overlays/okd/network/nodeNetworkConfigurationPolicy.yaml b/kubernetes/nmstate/overlays/okd/network/nodeNetworkConfigurationPolicy.yaml index 4881750f..7c84461f 100644 --- a/kubernetes/nmstate/overlays/okd/network/nodeNetworkConfigurationPolicy.yaml +++ b/kubernetes/nmstate/overlays/okd/network/nodeNetworkConfigurationPolicy.yaml @@ -18,6 +18,7 @@ spec: dhcp: true enabled: true bridge: + allow-extra-patch-ports: true options: stp: enabled: false @@ -50,6 +51,7 @@ spec: dhcp: true enabled: true bridge: + allow-extra-patch-ports: true options: stp: enabled: false @@ -103,3 +105,89 @@ spec: dhcp: false enabled: false mtu: 9000 +--- +apiVersion: nmstate.io/v1 +kind: NodeNetworkConfigurationPolicy +metadata: + name: vlan2-enp5s0 + annotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true +spec: + nodeSelector: + nic: enp5s0 + desiredState: + interfaces: + - name: enp5s0.2 + description: VLAN using enp5s0 + type: vlan + state: up + ipv4: + dhcp: false + enabled: false + vlan: + base-iface: enp5s0 + id: 2 + mtu: 9000 + - name: br1.2 + description: OVS bridge with enp5s0.2 as a port + type: ovs-bridge + state: up + ipv4: + dhcp: true + enabled: true + bridge: + allow-extra-patch-ports: true + options: + stp: + enabled: false + port: + - name: enp5s0.2 + mtu: 9000 + ovn: + bridge-mappings: + - localnet: br1.2 + bridge: br1.2 + state: present +--- +apiVersion: nmstate.io/v1 +kind: NodeNetworkConfigurationPolicy +metadata: + name: vlan2-enp7s0 + annotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true +spec: + nodeSelector: + nic: enp7s0 + desiredState: + interfaces: + - name: enp7s0.2 + description: VLAN using enp7s0 + type: vlan + state: up + ipv4: + dhcp: false + enabled: false + vlan: + base-iface: enp7s0 + id: 2 + mtu: 9000 + - name: br1.2 + description: OVS bridge with enp7s0.2 as a port + type: ovs-bridge + state: up + ipv4: + dhcp: true + enabled: true + bridge: + allow-extra-patch-ports: true + options: + stp: + enabled: false + port: + - name: enp7s0.2 + mtu: 9000 + ovn: + bridge-mappings: + - localnet: br1.2 + bridge: br1.2 + state: present