From 95e74e3976788525d4e5d7febb7222a0d03e4cc1 Mon Sep 17 00:00:00 2001 From: rblundon Date: Thu, 15 May 2025 22:07:53 -0500 Subject: [PATCH] deploy nmstate operator --- cluster/nmstate.yaml | 30 ++++++++++++++ cluster/nmstate/base/kustomization.yaml | 11 ++++++ cluster/nmstate/base/multinetwork-enable.yaml | 6 +++ cluster/nmstate/base/namespace.yaml | 12 ++++++ cluster/nmstate/base/nmstate.yaml | 5 +++ cluster/nmstate/base/operatorgroup.yaml | 11 ++++++ cluster/nmstate/base/subscription.yaml | 14 +++++++ .../nmstate/overlays/hub/kustomization.yaml | 9 +++++ .../overlays/hub/ocp-storage-vlan.yaml | 39 +++++++++++++++++++ 9 files changed, 137 insertions(+) create mode 100644 cluster/nmstate.yaml create mode 100644 cluster/nmstate/base/kustomization.yaml create mode 100644 cluster/nmstate/base/multinetwork-enable.yaml create mode 100644 cluster/nmstate/base/namespace.yaml create mode 100644 cluster/nmstate/base/nmstate.yaml create mode 100644 cluster/nmstate/base/operatorgroup.yaml create mode 100644 cluster/nmstate/base/subscription.yaml create mode 100644 cluster/nmstate/overlays/hub/kustomization.yaml create mode 100644 cluster/nmstate/overlays/hub/ocp-storage-vlan.yaml diff --git a/cluster/nmstate.yaml b/cluster/nmstate.yaml new file mode 100644 index 0000000..a00eaf7 --- /dev/null +++ b/cluster/nmstate.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: external-secrets + namespace: openshift-gitops + finalizers: + - resources-finalizer.argocd.argoproj.io + annotations: + argocd.argoproj.io/sync-wave: "1" +spec: + destination: + name: in-cluster + namespace: openshift-operators + project: default + source: + path: cluster/nmstate/overlays/hub + repoURL: https://github.com/rblundon/homelab.git + targetRevision: HEAD + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - RespectIgnoreDifferences=true + - CreateNamespace=true + managedNamespaceMetadata: + labels: + argocd.argoproj.io/managed-by: openshift-gitops + \ No newline at end of file diff --git a/cluster/nmstate/base/kustomization.yaml b/cluster/nmstate/base/kustomization.yaml new file mode 100644 index 0000000..3a65a01 --- /dev/null +++ b/cluster/nmstate/base/kustomization.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- namespace.yaml +- operatorgroup.yaml +- subscription.yaml +- nmstate.yaml +- multinetwork-enable.yaml + diff --git a/cluster/nmstate/base/multinetwork-enable.yaml b/cluster/nmstate/base/multinetwork-enable.yaml new file mode 100644 index 0000000..6b13ab4 --- /dev/null +++ b/cluster/nmstate/base/multinetwork-enable.yaml @@ -0,0 +1,6 @@ +apiVersion: operator.openshift.io/v1 +kind: Network +metadata: + name: cluster +spec: + useMultiNetworkPolicy: true diff --git a/cluster/nmstate/base/namespace.yaml b/cluster/nmstate/base/namespace.yaml new file mode 100644 index 0000000..09926bf --- /dev/null +++ b/cluster/nmstate/base/namespace.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + labels: + kubernetes.io/metadata.name: openshift-nmstate + name: openshift-nmstate + argocd.argoproj.io/managed-by: openshift-gitops-operator + name: openshift-nmstate +spec: + finalizers: + - kubernetes diff --git a/cluster/nmstate/base/nmstate.yaml b/cluster/nmstate/base/nmstate.yaml new file mode 100644 index 0000000..132b901 --- /dev/null +++ b/cluster/nmstate/base/nmstate.yaml @@ -0,0 +1,5 @@ +apiVersion: nmstate.io/v1 +kind: NMState +metadata: + name: nmstate +spec: {} diff --git a/cluster/nmstate/base/operatorgroup.yaml b/cluster/nmstate/base/operatorgroup.yaml new file mode 100644 index 0000000..ae59787 --- /dev/null +++ b/cluster/nmstate/base/operatorgroup.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: operators.coreos.com/v1 +kind: OperatorGroup +metadata: + annotations: {} +# olm.providedAPIs: NMState.v1.nmstate.io + name: openshift-nmstate + namespace: openshift-nmstate +spec: + targetNamespaces: + - openshift-nmstate \ No newline at end of file diff --git a/cluster/nmstate/base/subscription.yaml b/cluster/nmstate/base/subscription.yaml new file mode 100644 index 0000000..949a9a1 --- /dev/null +++ b/cluster/nmstate/base/subscription.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: operators.coreos.com/v1alpha1 +kind: Subscription +metadata: + labels: + operators.coreos.com/kubernetes-nmstate-operator.openshift-nmstate: "" + name: kubernetes-nmstate-operator + namespace: openshift-nmstate +spec: + channel: stable + installPlanApproval: Automatic + name: kubernetes-nmstate-operator + source: redhat-operators + sourceNamespace: openshift-marketplace \ No newline at end of file diff --git a/cluster/nmstate/overlays/hub/kustomization.yaml b/cluster/nmstate/overlays/hub/kustomization.yaml new file mode 100644 index 0000000..c1685d6 --- /dev/null +++ b/cluster/nmstate/overlays/hub/kustomization.yaml @@ -0,0 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +commonAnnotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true + +resources: +- ../../base +#- ocp-storage-vlan.yaml diff --git a/cluster/nmstate/overlays/hub/ocp-storage-vlan.yaml b/cluster/nmstate/overlays/hub/ocp-storage-vlan.yaml new file mode 100644 index 0000000..2e1d341 --- /dev/null +++ b/cluster/nmstate/overlays/hub/ocp-storage-vlan.yaml @@ -0,0 +1,39 @@ +--- +apiVersion: nmstate.io/v1 +kind: NodeNetworkConfigurationPolicy +metadata: + name: vlan121-localnet +spec: + nodeSelector: + kubernetes.io/hostname: ocp-hub + + desiredState: + ovn: + bridge-mappings: + - localnet: vlan121-net + bridge: br-ex + vlan-id: 121 + ip-address: + - ip: 10.10.121.10 + prefix-length: 24 + state: present + + # interfaces: + # - name: enp1s0.121 + # state: up + # type: vlan + # vlan: + # base-iface: enp1s0 + # id: 121 + # - bridge: + # port: + # - name: enp1s0.121 + # ipv4: + # address: + # - ip: 10.10.121.10 + # prefix-length: 24 + # enabled: true + # name: storage-network + # state: up + # type: linux-bridge + # description: Linux bridge with enp1s0 as a port on VLAN 121