Skip to content

Commit 7354503

Browse files
authored
Merge pull request #79 from fultonj/OSPRH-3743
Create MetalLB and NMState CRs in common (before NNCP CRs)
2 parents e292af3 + fec27bd commit 7354503

13 files changed

+70
-45
lines changed

docs/wa/missing_nncp.md renamed to docs/faq/cr_by_components.md

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,50 @@
1-
# Missing NNCPs
1+
# Creating Smaller CRs
2+
3+
## Question
24

35
The kustomize command builds and results in the OpenStack control
46
plane definitions and its dependent Custom Resources (CR).
57
```bash
68
kustomize build architecture/examples/va/hci > control-plane.yaml
79
```
8-
The `control-plane.yaml` file contains CRs for both `NMState` and
9-
`NodeNetworkConfigurationPolicy` (NNCP). When `oc apply -f
10-
control-plane.yaml` is read, OpenShift will try to create the NNCPs
11-
while `NMState` Custom Resource Definitions (CRD) are still installing
12-
and produce a message noting that the resource mappings are not found:
13-
```
14-
nmstate.nmstate.io/nmstate created
15-
[resource mapping not found for name:
16-
"ostest-master-0" namespace: "openstack" from "control-plane.yaml":
17-
no matches for kind "NodeNetworkConfigurationPolicy" in version "nmstate.io/v1"
18-
ensure CRDs are installed first,
19-
resource mapping not found for name: "ostest-master-1" namespace: "openstack"
20-
from "control-plane.yaml": no matches for kind "NodeNetworkConfigurationPolicy"
21-
in version "nmstate.io/v1"
22-
```
23-
Retrying `oc apply -f contol-plane.yaml` a few seconds later is likely to
24-
resolve the problem.
10+
The `control-plane.yaml` file contains CRs for the
11+
`NodeNetworkConfigurationPolicy` (NNCP), the
12+
`NetworkAttachmentDefinition`, MetalLB resources and
13+
OpenStack resources. Is it possible to create a CR file with less
14+
custom resources?
2515

26-
## Alternative Approach
16+
## Answer
2717

28-
It's also possible to create CR files with less components and wait
18+
Yes, it's possible to create CR files with less components and wait
2919
before applying each CR file. E.g. the file `nncp.yaml` would contain
30-
only `NodeNetworkConfigurationPolicy` CRs and `NMState` and other
31-
deployment related CRs could exist in another file like
32-
`deploy.yaml`. The following process may be used to do generate these
33-
files using kustomize.
20+
only `NodeNetworkConfigurationPolicy` CRs and
21+
`NetworkAttachmentDefinition` and other CRs could exist in another
22+
file like `networking.yaml`. The following process may be used to
23+
generate these files using kustomize.
3424

3525
- Modify the
3626
[va/hci/kustomization.yaml](https://github.com/openstack-k8s-operators/architecture/blob/main/va/hci/kustomization.yaml)
37-
file so that the last two lines contain only the deploy component
38-
configuration:
27+
file so that the components list only has the nncp component:
3928
```yaml
4029
components:
41-
- ../../lib/deploy
30+
- ../../lib/nncp
4231
```
43-
- Generate a file with only `MetalLB` and `NMState` CRs:
32+
- Generate a file with only NNCP CRs:
4433
```bash
45-
kustomize build architecture/examples/va/hci > deploy.yaml
34+
kustomize build architecture/examples/va/hci > nncp.yaml
4635
```
4736
- Modify the
4837
[va/hci/kustomization.yaml](https://github.com/openstack-k8s-operators/architecture/blob/main/va/hci/kustomization.yaml)
49-
file so that the last two lines contain only the nncp component
50-
configuration:
38+
file so that the components list only has the networking component:
5139
```yaml
5240
components:
53-
- ../../lib/nncp
41+
- ../../lib/networking
5442
```
55-
- Generate a file with only `NNCP` CRs:
43+
- Generate a file with only Networking CRs:
5644
```bash
57-
kustomize build architecture/examples/va/hci > nncp.yaml
45+
kustomize build architecture/examples/va/hci > networking.yaml
5846
```
47+
5948
The above process may be continued for each component.
6049

6150
Note that [va/hci/kustomization.yaml](https://github.com/openstack-k8s-operators/architecture/blob/main/va/hci/kustomization.yaml)

examples/common/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,39 @@ oc wait pod -n metallb-system --for condition=Ready -l component=webhook-server
4040
timeout 300 bash -c "while ! (oc get deployments/nmstate-operator -n openshift-nmstate); do sleep 10; done"
4141
oc wait deployments/nmstate-operator -n openshift-nmstate --for condition=Available --timeout=300s
4242
```
43+
44+
# MetalLB
45+
46+
Observe CRs which will be generated.
47+
```
48+
kustomize build examples/common/metallb/
49+
```
50+
Create the CRs.
51+
```
52+
oc apply -k examples/common/metallb/
53+
```
54+
The following commands can be used to confirm that each step of this
55+
procedure is complete.
56+
```
57+
timeout 300 bash -c "while ! (oc get pod --no-headers=true -l component=speaker -n metallb-system | grep speaker); do sleep 10; done"
58+
oc wait pod -n metallb-system -l component=speaker --for condition=Ready --timeout=300s
59+
```
60+
61+
# NMState
62+
63+
Observe CRs which will be generated.
64+
```
65+
kustomize build examples/common/nmstate/
66+
```
67+
Create the CRs.
68+
```
69+
oc apply -k examples/common/nmstate/
70+
```
71+
The following commands can be used to confirm that each step of this
72+
procedure is complete.
73+
```
74+
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"
75+
oc wait pod -n openshift-nmstate -l component=kubernetes-nmstate-handler --for condition=Ready --timeout=300s
76+
timeout 300 bash -c "while ! (oc get deployments/nmstate-webhook -n openshift-nmstate); do sleep 10; done"
77+
oc wait deployments/nmstate-webhook -n openshift-nmstate --for condition=Available --timeout=300s
78+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
components:
2+
- ../../../lib/metallb
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
components:
2+
- ../../../lib/nmstate

examples/va/hci/control-plane.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ kustomize build > control-plane.yaml
3434
```
3535
oc apply -f control-plane.yaml
3636
```
37-
If the `oc apply` command produces a `no matches for kind
38-
NodeNetworkConfigurationPolicy` error, then see
39-
[Missing NNCPs Workaround](../../../docs/wa/missing_nncp.md).
4037

4138
Wait for NNCPs to be available
4239
```

examples/va/nfv/sriov/control-plane.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ kustomize build > control-plane.yaml
3838
```
3939
oc apply -f control-plane.yaml
4040
```
41-
If the `oc apply` command produces a `no matches for kind
42-
NodeNetworkConfigurationPolicy` error, then see
43-
[Missing NNCPs Workaround](../../../../docs/wa/missing_nncp.md).
4441

4542
Wait for NNCPs to be available
4643
```

lib/deploy/kustomization.yaml renamed to lib/metallb/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ kind: Component
33

44
resources:
55
- metallb_deploy.yaml
6-
- nmstate_deploy.yaml
File renamed without changes.

lib/nmstate/kustomization.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
4+
resources:
5+
- nmstate_deploy.yaml
File renamed without changes.

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ nav:
3131
- NFV SRIOV: https://github.com/openstack-k8s-operators/architecture/blob/main/examples/va/nfv/sriov/README.md
3232
- Deployed Topologies:
3333
- None
34-
- Workarounds:
35-
- Missing NNCPs: wa/missing_nncp.md
34+
- FAQ:
35+
- Creating Smaller CRs: faq/cr_by_components.md
3636
- Contributing:
3737
- contributing/documentation.md
3838
markdown_extensions:

va/hci/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ transformers:
1717
create: true
1818
1919
components:
20-
- ../../lib/deploy
2120
- ../../lib/nncp
2221
- ../../lib/networking
2322
- ../../lib/control-plane

va/nfv/sriov/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ transformers:
1717
create: true
1818
1919
components:
20-
- ../../../lib/deploy
2120
- ../../../lib/nncp
2221
- ../../../lib/networking
2322
- ../../../lib/control-plane

0 commit comments

Comments
 (0)