Skip to content

Commit

Permalink
Decouple uni01alpha network stage from control plane stage
Browse files Browse the repository at this point in the history
This removes the networking components...

    MetalLB
    NetConfig
    Net-attach-def

...from the control plane stage of dt/uni01alpha and gives them their
own separate stage in between the NNCP stage and the control plane
stage.

This is needed for the uni01alpha adoption job, which relies upon
this DT. For adoption we want to create the NNCPs, MetalLB CRs,
NetConfig CR and Net-attach-defs, but do NOT want to create the
OpenStackControlPlane.

Following this can this can be done by creating an automation file
with only two stages, one for NNCPs and the other for the other
networking components.

This change was created using the following PR as inspiration:
  openstack-k8s-operators#489

Jira: OSPRH-13801
  • Loading branch information
hjensas committed Feb 7, 2025
1 parent b773b51 commit f1917c1
Show file tree
Hide file tree
Showing 16 changed files with 159 additions and 109 deletions.
33 changes: 15 additions & 18 deletions automation/vars/uni01alpha-adoption.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
vas:
uni01alpha-adoption:
stages:
- path: examples/dt/uni01alpha/control-plane/nncp
- pre_stage_run:
- name: Apply cinder-lvm label on master-0
type: cr
definition:
metadata:
labels:
openstack.org/cinder-lvm: ""
kind: Node
resource_name: master-0
state: patched
path: examples/dt/uni01alpha/control-plane/networking/nncp
wait_conditions:
- >-
oc -n openstack wait nncp
Expand All @@ -14,26 +24,13 @@ vas:
src_file: values.yaml
build_output: nncp.yaml

- pre_stage_run:
- name: Apply cinder-lvm label on master-0
type: cr
definition:
metadata:
labels:
openstack.org/cinder-lvm: ""
kind: Node
resource_name: master-0
state: patched
path: examples/dt/uni01alpha/control-plane
- path: examples/dt/uni01alpha/control-plane/networking
wait_conditions:
- >-
oc -n openstack wait openstackcontrolplane
controlplane
oc -n metallb-system wait pod
-l app=metallb -l component=speaker
--for condition=Ready
--timeout=60m
values:
- name: network-values
src_file: nncp/values.yaml
- name: service-values
src_file: service-values.yaml
build_output: control-plane.yaml
build_output: networking.yaml
37 changes: 24 additions & 13 deletions automation/vars/uni01alpha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
vas:
uni01alpha:
stages:
- path: examples/dt/uni01alpha/control-plane/nncp
- pre_stage_run:
- name: Apply cinder-lvm label on master-0
type: cr
definition:
metadata:
labels:
openstack.org/cinder-lvm: ""
kind: Node
resource_name: master-0
state: patched
path: examples/dt/uni01alpha/control-plane/networking/nncp
wait_conditions:
- >-
oc -n openstack wait nncp
Expand All @@ -14,17 +24,18 @@ vas:
src_file: values.yaml
build_output: nncp.yaml

- pre_stage_run:
- name: Apply cinder-lvm label on master-0
type: cr
definition:
metadata:
labels:
openstack.org/cinder-lvm: ""
kind: Node
resource_name: master-0
state: patched
path: examples/dt/uni01alpha/control-plane
- path: examples/dt/uni01alpha/control-plane/networking
wait_conditions:
- >-
oc -n metallb-system wait pod
-l app=metallb -l component=speaker
--for condition=Ready
values:
- name: network-values
src_file: nncp/values.yaml
build_output: networking.yaml

- path: examples/dt/uni01alpha/control-plane
wait_conditions:
- >-
oc -n openstack wait openstackcontrolplane
Expand All @@ -33,7 +44,7 @@ vas:
--timeout=60m
values:
- name: network-values
src_file: nncp/values.yaml
src_file: networking/nncp/values.yaml
- name: service-values
src_file: service-values.yaml
build_output: control-plane.yaml
Expand Down
27 changes: 0 additions & 27 deletions dt/uni01alpha/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ transformers:
create: true
components:
- ../../lib/networking/metallb
- netconfig
- ../../lib/networking/nad
- ../../lib/control-plane

resources:
- nad.yaml

replacements:
- source:
Expand Down Expand Up @@ -457,25 +452,3 @@ replacements:
- spec.nova.template.cellTemplates
options:
create: true

- source:
kind: ConfigMap
name: network-values
fieldPath: data.octavia.net-attach-def
targets:
- select:
kind: NetworkAttachmentDefinition
name: octavia
fieldPaths:
- spec.config

- source:
kind: ConfigMap
name: network-values
fieldPath: data.ironic.net-attach-def
targets:
- select:
kind: NetworkAttachmentDefinition
name: ironic
fieldPaths:
- spec.config
48 changes: 48 additions & 0 deletions dt/uni01alpha/networking/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

transformers:
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: _ignored_
namespace: openstack
setRoleBindingSubjects: none
unsetOnly: true
fieldSpecs:
- path: metadata/name
kind: Namespace
create: true
components:
- ../../../lib/networking/metallb
- netconfig
- ../../../lib/networking/nad

resources:
- nad.yaml

replacements:
- source:
kind: ConfigMap
name: network-values
fieldPath: data.octavia.net-attach-def
targets:
- select:
kind: NetworkAttachmentDefinition
name: octavia
fieldPaths:
- spec.config

- source:
kind: ConfigMap
name: network-values
fieldPath: data.ironic.net-attach-def
targets:
- select:
kind: NetworkAttachmentDefinition
name: ironic
fieldPaths:
- spec.config
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ transformers:
create: true
components:
- ../../../lib/nncp
- ../../../../lib/nncp

patches:
- target:
Expand Down
35 changes: 24 additions & 11 deletions examples/dt/uni01alpha/control-plane.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,46 @@ cd architecture/examples/dt/uni01alpha
```

Edit [service-values.yaml](control-plane/service-values.yaml) and
[control-plane/nncp/values.yaml](control-plane/nncp/values.yaml).
[control-plane/networking/nncp/values.yaml](control-plane/networking/nncp/values.yaml).

Apply node network configuration
## Apply node network configuration

Generate the node network configuration
```bash
pushd control-plane/nncp
kustomize build > nncp.yaml
kustomize build control-plane/networking/nncp > nncp.yaml
```
Apply the NNCP CRs
```
oc apply -f nncp.yaml
```
Wait for NNCPs to be available
```
oc wait nncp \
-l osp/nncm-config-type=standard \
--for jsonpath='{.status.conditions[0].reason}'=SuccessfullyConfigured \
--timeout=300s
popd
```

Generate the control-plane and networking CRs.
## Apply remaining networking configuration

```bash
pushd control-plane
kustomize build > control-plane.yaml
Generate the reminaing networking configuration
```
kustomize build control-plane/networking > networking.yaml
```
Apply the networking CRs
```
oc apply -f networking.yaml
```

## Create CRs
## Apply the control-plane configurastion.

Generate the control-plane CRs.
```bash
kustomize build control-plane/ > control-plane.yaml
```
Apply the CRs
```bash
oc apply -f control-plane.yaml
popd
```

Wait for control plane to be available
Expand Down
2 changes: 1 addition & 1 deletion examples/dt/uni01alpha/control-plane/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ components:
- ../../../../dt/uni01alpha

resources:
- nncp/values.yaml
- networking/nncp/values.yaml
- service-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

components:
- ../../../../../dt/uni01alpha/networking

resources:
- nncp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

components:
- ../../../../../dt/uni01alpha/nncp
- ../../../../../../dt/uni01alpha/networking/nncp

resources:
- values.yaml
Loading

0 comments on commit f1917c1

Please sign in to comment.