diff --git a/docs/wa/missing_nncp.md b/docs/faq/cr_by_components.md similarity index 53% rename from docs/wa/missing_nncp.md rename to docs/faq/cr_by_components.md index 86b8f14d9..7b5399ad5 100644 --- a/docs/wa/missing_nncp.md +++ b/docs/faq/cr_by_components.md @@ -1,61 +1,50 @@ -# Missing NNCPs +# Creating Smaller CRs + +## Question The kustomize command builds and results in the OpenStack control plane definitions and its dependent Custom Resources (CR). ```bash kustomize build architecture/examples/va/hci > control-plane.yaml ``` -The `control-plane.yaml` file contains CRs for both `NMState` and -`NodeNetworkConfigurationPolicy` (NNCP). When `oc apply -f -control-plane.yaml` is read, OpenShift will try to create the NNCPs -while `NMState` Custom Resource Definitions (CRD) are still installing -and produce a message noting that the resource mappings are not found: -``` -nmstate.nmstate.io/nmstate created -[resource mapping not found for name: -"ostest-master-0" namespace: "openstack" from "control-plane.yaml": -no matches for kind "NodeNetworkConfigurationPolicy" in version "nmstate.io/v1" -ensure CRDs are installed first, -resource mapping not found for name: "ostest-master-1" namespace: "openstack" -from "control-plane.yaml": no matches for kind "NodeNetworkConfigurationPolicy" -in version "nmstate.io/v1" -``` -Retrying `oc apply -f contol-plane.yaml` a few seconds later is likely to -resolve the problem. +The `control-plane.yaml` file contains CRs for the +`NodeNetworkConfigurationPolicy` (NNCP), the +`NetworkAttachmentDefinition`, MetalLB resources and +OpenStack resources. Is it possible to create a CR file with less +custom resources? -## Alternative Approach +## Answer -It's also possible to create CR files with less components and wait +Yes, it's possible to create CR files with less components and wait before applying each CR file. E.g. the file `nncp.yaml` would contain -only `NodeNetworkConfigurationPolicy` CRs and `NMState` and other -deployment related CRs could exist in another file like -`deploy.yaml`. The following process may be used to do generate these -files using kustomize. +only `NodeNetworkConfigurationPolicy` CRs and +`NetworkAttachmentDefinition` and other CRs could exist in another +file like `networking.yaml`. The following process may be used to +generate these files using kustomize. - Modify the [va/hci/kustomization.yaml](https://github.com/openstack-k8s-operators/architecture/blob/main/va/hci/kustomization.yaml) -file so that the last two lines contain only the deploy component -configuration: +file so that the components list only has the nncp component: ```yaml components: -- ../../lib/deploy +- ../../lib/nncp ``` -- Generate a file with only `MetalLB` and `NMState` CRs: +- Generate a file with only NNCP CRs: ```bash -kustomize build architecture/examples/va/hci > deploy.yaml +kustomize build architecture/examples/va/hci > nncp.yaml ``` - Modify the [va/hci/kustomization.yaml](https://github.com/openstack-k8s-operators/architecture/blob/main/va/hci/kustomization.yaml) -file so that the last two lines contain only the nncp component -configuration: +file so that the components list only has the networking component: ```yaml components: -- ../../lib/nncp +- ../../lib/networking ``` -- Generate a file with only `NNCP` CRs: +- Generate a file with only Networking CRs: ```bash -kustomize build architecture/examples/va/hci > nncp.yaml +kustomize build architecture/examples/va/hci > networking.yaml ``` + The above process may be continued for each component. Note that [va/hci/kustomization.yaml](https://github.com/openstack-k8s-operators/architecture/blob/main/va/hci/kustomization.yaml) diff --git a/examples/common/README.md b/examples/common/README.md index 73d13abfc..8c999f312 100644 --- a/examples/common/README.md +++ b/examples/common/README.md @@ -40,3 +40,39 @@ oc wait pod -n metallb-system --for condition=Ready -l component=webhook-server timeout 300 bash -c "while ! (oc get deployments/nmstate-operator -n openshift-nmstate); do sleep 10; done" oc wait deployments/nmstate-operator -n openshift-nmstate --for condition=Available --timeout=300s ``` + +# MetalLB + +Observe CRs which will be generated. +``` +kustomize build examples/common/metallb/ +``` +Create the CRs. +``` +oc apply -k examples/common/metallb/ +``` +The following commands can be used to confirm that each step of this +procedure is complete. +``` +timeout 300 bash -c "while ! (oc get pod --no-headers=true -l component=speaker -n metallb-system | grep speaker); do sleep 10; done" +oc wait pod -n metallb-system -l component=speaker --for condition=Ready --timeout=300s +``` + +# NMState + +Observe CRs which will be generated. +``` +kustomize build examples/common/nmstate/ +``` +Create the CRs. +``` +oc apply -k examples/common/nmstate/ +``` +The following commands can be used to confirm that each step of this +procedure is complete. +``` +timeout 300 bash -c "while ! (oc get pod --no-headers=true -l component=kubernetes-nmstate-handler -n openshift-nmstate| grep nmstate-handler); do sleep 10; done" +oc wait pod -n openshift-nmstate -l component=kubernetes-nmstate-handler --for condition=Ready --timeout=300s +timeout 300 bash -c "while ! (oc get deployments/nmstate-webhook -n openshift-nmstate); do sleep 10; done" +oc wait deployments/nmstate-webhook -n openshift-nmstate --for condition=Available --timeout=300s +``` diff --git a/examples/common/metallb/kustomization.yaml b/examples/common/metallb/kustomization.yaml new file mode 100644 index 000000000..3309b53f8 --- /dev/null +++ b/examples/common/metallb/kustomization.yaml @@ -0,0 +1,2 @@ +components: + - ../../../lib/metallb diff --git a/examples/common/nmstate/kustomization.yaml b/examples/common/nmstate/kustomization.yaml new file mode 100644 index 000000000..12530cc0c --- /dev/null +++ b/examples/common/nmstate/kustomization.yaml @@ -0,0 +1,2 @@ +components: + - ../../../lib/nmstate diff --git a/examples/va/hci/control-plane.md b/examples/va/hci/control-plane.md index aa2dc5184..ee2de6511 100644 --- a/examples/va/hci/control-plane.md +++ b/examples/va/hci/control-plane.md @@ -34,9 +34,6 @@ kustomize build > control-plane.yaml ``` oc apply -f control-plane.yaml ``` -If the `oc apply` command produces a `no matches for kind -NodeNetworkConfigurationPolicy` error, then see -[Missing NNCPs Workaround](../../../docs/wa/missing_nncp.md). Wait for NNCPs to be available ``` diff --git a/examples/va/nfv/sriov/control-plane.md b/examples/va/nfv/sriov/control-plane.md index cd56d639c..2eb6d5a87 100644 --- a/examples/va/nfv/sriov/control-plane.md +++ b/examples/va/nfv/sriov/control-plane.md @@ -38,9 +38,6 @@ kustomize build > control-plane.yaml ``` oc apply -f control-plane.yaml ``` -If the `oc apply` command produces a `no matches for kind -NodeNetworkConfigurationPolicy` error, then see -[Missing NNCPs Workaround](../../../../docs/wa/missing_nncp.md). Wait for NNCPs to be available ``` diff --git a/lib/deploy/kustomization.yaml b/lib/metallb/kustomization.yaml similarity index 81% rename from lib/deploy/kustomization.yaml rename to lib/metallb/kustomization.yaml index c69890008..3cde4b6ba 100644 --- a/lib/deploy/kustomization.yaml +++ b/lib/metallb/kustomization.yaml @@ -3,4 +3,3 @@ kind: Component resources: - metallb_deploy.yaml -- nmstate_deploy.yaml diff --git a/lib/deploy/metallb_deploy.yaml b/lib/metallb/metallb_deploy.yaml similarity index 100% rename from lib/deploy/metallb_deploy.yaml rename to lib/metallb/metallb_deploy.yaml diff --git a/lib/nmstate/kustomization.yaml b/lib/nmstate/kustomization.yaml new file mode 100644 index 000000000..e85b97d16 --- /dev/null +++ b/lib/nmstate/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +resources: +- nmstate_deploy.yaml diff --git a/lib/deploy/nmstate_deploy.yaml b/lib/nmstate/nmstate_deploy.yaml similarity index 100% rename from lib/deploy/nmstate_deploy.yaml rename to lib/nmstate/nmstate_deploy.yaml diff --git a/mkdocs.yml b/mkdocs.yml index de5cb23a5..6f12c2c25 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -31,8 +31,8 @@ nav: - NFV SRIOV: https://github.com/openstack-k8s-operators/architecture/blob/main/examples/va/nfv/sriov/README.md - Deployed Topologies: - None - - Workarounds: - - Missing NNCPs: wa/missing_nncp.md + - FAQ: + - Creating Smaller CRs: faq/cr_by_components.md - Contributing: - contributing/documentation.md markdown_extensions: diff --git a/va/hci/kustomization.yaml b/va/hci/kustomization.yaml index 2613dee75..54ffbdb63 100644 --- a/va/hci/kustomization.yaml +++ b/va/hci/kustomization.yaml @@ -17,7 +17,6 @@ transformers: create: true components: -- ../../lib/deploy - ../../lib/nncp - ../../lib/networking - ../../lib/control-plane diff --git a/va/nfv/sriov/kustomization.yaml b/va/nfv/sriov/kustomization.yaml index a1afd2e3f..ff525b177 100644 --- a/va/nfv/sriov/kustomization.yaml +++ b/va/nfv/sriov/kustomization.yaml @@ -17,7 +17,6 @@ transformers: create: true components: -- ../../../lib/deploy - ../../../lib/nncp - ../../../lib/networking - ../../../lib/control-plane