Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Test samples from inline docs #769

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
repos:
- repo: local
hooks:
- id: doc-sample
name: doc-sample
language: system
entry: docs/docs_to_sample.sh
- id: gotidy
name: gotidy
language: system
Expand Down
5 changes: 2 additions & 3 deletions docs/assemblies/creating-the-data-plane.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ To create and deploy a data plane, you must perform the following tasks:
** CBO is installed and configured for provisioning.
** `BareMetalHosts` registered, inspected, and have the label `app:openstack`.
* You are logged on to a workstation that has access to the RHOCP cluster as a user with `cluster-admin` privileges.
* https://kustomize.io/[kustomize] version 5.0.1 or higher

include::proc_creating-the-SSH-key-secrets.adoc[leveloffset=+1]

Expand All @@ -36,8 +35,8 @@ include::proc_creating-a-custom-service.adoc[leveloffset=+2]
include::proc_configuring-a-node-set-for-a-Compute-feature-or-workload.adoc[leveloffset=+2]
include::proc_building-a-custom-ansible-runner-image.adoc[leveloffset=+2]

include::ref_example-OpenStackDataPlaneNodeSet-CR-for-preprovisioned-nodes.adoc[leveloffset=+1]
include::ref_example-OpenStackDataPlaneNodeSet-CR-for-bare-metal-nodes.adoc[leveloffset=+1]
include::samples/ref_example-OpenStackDataPlaneNodeSet-CR-for-preprovisioned-nodes.adoc[leveloffset=+1]
include::samples/ref_example-OpenStackDataPlaneNodeSet-CR-for-bare-metal-nodes.adoc[leveloffset=+1]

include::ref_data-plane-conditions-and-states.adoc[leveloffset=+1]

Expand Down
36 changes: 12 additions & 24 deletions docs/assemblies/proc_creating-a-set-of-data-plane-nodes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,19 @@ Create an `OpenStackDataPlaneNodeSet` CR for each logical grouping of nodes in y

.Procedure

. Copy the https://kustomize.io/[kustomize] examples on your workstation:

git clone -n --depth=1 --filter=tree:0 \
https://github.com/openstack-k8s-operators/dataplane-operator
cd dataplane-operator
git sparse-checkout set --no-cone examples
git checkout
cd examples

. Use kustomize to create the `OpenStackDataPlaneDeployment` and `OpenStackDataPlaneNodeSet` CRs:

* Pre-provisioned nodes:

kustomize build preprovisioned > openstack-edpm.yaml

* Bare metal nodes:

kustomize build baremetal > openstack-edpm.yaml

. Create an `OpenStackDataPlaneNodeSet` CR and save it to a file named `openstack-edpm.yaml` on your workstation:
+
[NOTE]
====
If desired, update the `values.yaml` file with values from your environment and add other kustomizations as needed before generating the CRs. Alternatively, the generated CRS can be directly edited before being applied.
====
----
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneNodeSet
metadata:
name: openstack-edpm-ipam
spec:
...
----
+
* xref:ref_example-OpenStackDataPlaneNodeSet-CR-for-preprovisioned-nodes_dataplane[Example `OpenStackDataPlaneNodeSet` CR for pre-provisioned nodes]
* xref:ref_example-OpenStackDataPlaneNodeSet-CR-for-bare-metal-nodes_dataplane[Example `OpenStackDataPlaneNodeSet` CR for bare metal nodes]

. The sample `OpenStackDataPlaneNodeSet` CR is connected to `cell1` by default. If you added additional Compute cells to the control plane and you want to connect the node set to one of the other cells, then you must create a custom service for the node set that includes the `Secret` CR for the cell:

Expand Down Expand Up @@ -310,7 +298,7 @@ endif::[]

. Save the `openstack-edpm.yaml` definition file.

. Create and <<proc_deploying-the-data-plane_dataplane,deploy>> the data plane resources:
. Create the data plane resources:
+
----
$ oc create -f openstack-edpm.yaml
Expand Down
8 changes: 4 additions & 4 deletions docs/assemblies/proc_deploying-the-data-plane.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ You use the `OpenStackDataPlaneDeployment` CRD to configure the services on the

.Procedure

. Complete the steps from <<proc_creating-a-set-of-data-plane-nodes_dataplane,Creating a DataPlane>> procedure, ensuring that you have a file named `openstack-edpm.yaml` on your workstation.

. Optional: Update `nodeSets` to include all the `OpenStackDataPlaneNodeSet` CRs that you want to deploy:
. Create an `OpenStackDataPlaneDeployment` CR and save it to a file named `openstack-edpm-deploy.yaml` on your workstation.
+
----
apiVersion: dataplane.openstack.org/v1beta1
Expand All @@ -25,10 +23,12 @@ spec:
+
* Replace `<nodeSet_name>` with the names of the `OpenStackDataPlaneNodeSet` CRs that you want to include in your data plane deployment.

. Save the `openstack-edpm-deploy.yaml` deployment file.

. Deploy the data plane:
+
----
$ oc create -f openstack-edpm.yaml
$ oc create -f openstack-edpm-deploy.yaml
----
+
You can view the Ansible logs while the deployment executes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,53 +10,59 @@ kind: OpenStackDataPlaneNodeSet
metadata:
name: openstack-edpm-ipam
spec:
env: <1>
env: #<1>
- name: ANSIBLE_FORCE_COLOR
value: "True"
services: <2>
services: #<2>
- bootstrap
- download-cache
- configure-network
- validate-network
- install-os
- configure-os
- ssh-known-hosts
- run-os
- reboot-os
- install-certs
- ovn
- neutron-metadata
- libvirt
- nova
- telemetry
baremetalSetTemplate: <3>
baremetalSetTemplate: #<3>
bmhLabelSelector:
app: openstack
ctlplaneInterface: enp1s0
cloudUserName: cloud-admin
nodes:
edpm-compute-0: <4>
edpm-compute-0: #<4>
hostName: edpm-compute-0
networkAttachments: <5>
networkAttachments: #<5>
- ctlplane
nodeTemplate: <6>
ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret <7>
networks: <8>
- name: CtlPlane
nodeTemplate: #<6>
ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret #<7>
networks: #<8>
- name: ctlplane
subnetName: subnet1
defaultRoute: true
- name: InternalApi
fixedIP: 192.168.122.100
- name: internalapi
subnetName: subnet1
- name: Storage
- name: storage
subnetName: subnet1
- name: Tenant
- name: tenant
subnetName: subnet1
managementNetwork: ctlplane
ansible:
ansibleUser: cloud-admin <9>
ansibleUser: cloud-admin #<9>
ansiblePort: 22
ansibleVars: <10>
ansibleVars: #<10>
service_net_map:
nova_api_network: internal_api
nova_libvirt_network: internal_api
edpm_chrony_ntp_servers:
- pool.ntp.org
edpm_network_config_hide_sensitive_logs: false
edpm_network_config_template: | <11>
nova_api_network: internalapi
nova_libvirt_network: internalapi
timesync_ntp_servers:
- hostname: pool.ntp.org
edpm_network_config_template: | #<11>
---
{% set mtu_list = [ctlplane_mtu] %}
{% for network in role_networks %}
Expand Down Expand Up @@ -93,23 +99,15 @@ spec:
# considered EDPM network defaults.
neutron_physical_bridge_name: br-ex
neutron_public_interface_name: eth0
role_networks:
- InternalApi
- Storage
- Tenant
networks_lower:
External: external
InternalApi: internal_api
Storage: storage
Tenant: tenant
# edpm_nodes_validation
edpm_nodes_validation_validate_controllers_icmp: false
edpm_nodes_validation_validate_gateway_icmp: false
gather_facts: false
enable_debug: false
# edpm firewall, change the allowed CIDR if needed
edpm_sshd_configure_firewall: true
edpm_sshd_allowed_ranges: ['192.168.122.0/24']
edpm_sshd_allowed_ranges:
- 192.168.111.0/24
# SELinux module
edpm_selinux_mode: enforcing
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,56 @@ kind: OpenStackDataPlaneNodeSet
metadata:
name: openstack-edpm-ipam
spec:
env: <1>
env: #<1>
- name: ANSIBLE_FORCE_COLOR
value: "True"
preProvisioned: true <2>
services: <3>
preProvisioned: true #<2>
services: #<3>
- bootstrap
- download-cache
- configure-network
- validate-network
- install-os
- configure-os
- ssh-known-hosts
- run-os
- reboot-os
- install-certs
- ovn
- neutron-metadata
- libvirt
- nova
- telemetry
nodes:
edpm-compute-0: <4>
edpm-compute-0: #<4>
hostName: edpm-compute-0
ansible:
ansibleHost: 192.168.122.100
networks:
- name: CtlPlane
subnetName: subnet1
defaultRoute: true
fixedIP: 192.168.122.100
- name: InternalApi
subnetName: subnet1
- name: Storage
subnetName: subnet1
- name: Tenant
subnetName: subnet1
edpm-compute-1:
hostName: edpm-compute-1
ansible:
ansibleHost: 192.168.122.101
networks:
- name: CtlPlane
subnetName: subnet1
defaultRoute: true
fixedIP: 192.168.122.101
- name: InternalApi
subnetName: subnet1
- name: Storage
subnetName: subnet1
- name: Tenant
subnetName: subnet1
networkAttachments: <5>
networkAttachments: #<5>
- ctlplane
nodeTemplate: <6>
ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret <7>
nodeTemplate: #<6>
ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret #<7>
networks:
- defaultRoute: true
name: ctlplane
subnetName: subnet1
- name: internalapi
subnetName: subnet1
- name: storage
subnetName: subnet1
- name: tenant
subnetName: subnet1
managementNetwork: ctlplane
ansible:
ansibleUser: cloud-admin <8>
ansibleUser: cloud-admin #<8>
ansiblePort: 22
ansibleVars: <9>
ansibleVars: #<9>
service_net_map:
nova_api_network: internal_api
nova_libvirt_network: internal_api
edpm_chrony_ntp_servers:
- pool.ntp.org
edpm_network_config_template: | <10>
nova_api_network: internalapi
nova_libvirt_network: internalapi
timesync_ntp_servers:
- hostname: pool.ntp.org
edpm_network_config_template: | #<10>
---
{% set mtu_list = [ctlplane_mtu] %}
{% for network in role_networks %}
Expand Down Expand Up @@ -106,15 +96,6 @@ spec:
# considered EDPM network defaults.
neutron_physical_bridge_name: br-ex
neutron_public_interface_name: eth0
role_networks:
- InternalApi
- Storage
- Tenant
networks_lower:
External: external
InternalApi: internal_api
Storage: storage
Tenant: tenant
# edpm_nodes_validation
edpm_nodes_validation_validate_controllers_icmp: false
edpm_nodes_validation_validate_gateway_icmp: false
Expand Down
14 changes: 14 additions & 0 deletions docs/docs_to_sample.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -ex

# Update docs from kustomize examples
docs/kustomize_to_docs.sh

# Sample to kuttl tests
COUNT=0
for sample in */assemblies/samples/* ; do
FILENAME=$(basename $sample)
mkdir -p tests/kuttl/tests/docs-test-0${COUNT}
sed "0,/----/d" $sample | sed -e '/----/,$d' > tests/kuttl/tests/docs-test-0${COUNT}/01-${FILENAME/adoc/yaml}
COUNT=$((COUNT + 1))
done
54 changes: 54 additions & 0 deletions docs/kustomize_to_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -ex

BAREMETAL=docs/assemblies/samples/ref_example-OpenStackDataPlaneNodeSet-CR-for-bare-metal-nodes.adoc
FOOTER=$(sed '0,/----/d' $BAREMETAL | sed -e '0,/----/d')
sed -i '/----/q' $BAREMETAL
NODESET=$(oc kustomize --load-restrictor LoadRestrictionsNone examples/baremetal | yq ' select(.kind == "OpenStackDataPlaneNodeSet")')
COUNT=1
CALLOUTS=(
"env"
"services"
"baremetalSetTemplate"
"edpm-compute-0"
"networkAttachments"
"nodeTemplate"
"ansibleSSHPrivateKeySecret"
"networks"
"ansibleUser"
"ansibleVars"
"edpm_network_config_template"
)
for callout in "${CALLOUTS[@]}"
do
NODESET=$(echo -e "$NODESET" | sed -e "/$callout:/ s/$/ #<$COUNT>/")
COUNT=$((COUNT + 1))
done
echo -e "$NODESET" >> $BAREMETAL
echo -e "----\n$FOOTER" >> $BAREMETAL


PREPROVISIONED=docs/assemblies/samples/ref_example-OpenStackDataPlaneNodeSet-CR-for-preprovisioned-nodes.adoc
FOOTER=$(sed '0,/----/d' $PREPROVISIONED | sed -e '0,/----/d')
sed -i '/----/q' $PREPROVISIONED
NODESET=$(oc kustomize --load-restrictor LoadRestrictionsNone examples/preprovisioned | yq ' select(.kind == "OpenStackDataPlaneNodeSet")')
COUNT=1
CALLOUTS=(
"env"
"services"
"preProvisioned"
"edpm-compute-0"
"networkAttachments"
"nodeTemplate"
"ansibleSSHPrivateKeySecret"
"ansibleUser"
"ansibleVars"
"edpm_network_config_template"
)
for callout in "${CALLOUTS[@]}"
do
NODESET=$(echo -e "$NODESET" | sed -e "/$callout:/ s/$/ #<$COUNT>/")
COUNT=$((COUNT + 1))
done
echo -e "$NODESET" >> $PREPROVISIONED
echo -e "----\n$FOOTER" >> $PREPROVISIONED
Loading
Loading