From 43d1cb6622e3912089c8860caee4784c6cff986e Mon Sep 17 00:00:00 2001 From: Fabricio Aguiar Date: Tue, 19 Mar 2024 12:06:05 +0000 Subject: [PATCH] Update kustomize examples and docs Signed-off-by: Fabricio Aguiar --- docs/assemblies/creating-the-data-plane.adoc | 2 +- ...oc_creating-a-set-of-data-plane-nodes.adoc | 50 +++---------------- .../proc_deploying-the-data-plane.adoc | 6 ++- examples/baremetal_nodeset/kustomization.yaml | 15 ++++++ examples/nova_cell_custom/kustomization.yaml | 33 ++++++++++++ examples/nova_cell_custom/nova-extra.conf | 3 ++ .../openstackdataplanenovaservice.yaml | 20 ++++++++ examples/nova_cell_custom/servicename.yaml | 10 ++++ .../preprovisioned_nodeset/kustomization.yaml | 17 +++++++ 9 files changed, 109 insertions(+), 47 deletions(-) create mode 100644 examples/baremetal_nodeset/kustomization.yaml create mode 100644 examples/nova_cell_custom/kustomization.yaml create mode 100644 examples/nova_cell_custom/nova-extra.conf create mode 100644 examples/nova_cell_custom/openstackdataplanenovaservice.yaml create mode 100644 examples/nova_cell_custom/servicename.yaml create mode 100644 examples/preprovisioned_nodeset/kustomization.yaml diff --git a/docs/assemblies/creating-the-data-plane.adoc b/docs/assemblies/creating-the-data-plane.adoc index a3b443017..d65d13f35 100644 --- a/docs/assemblies/creating-the-data-plane.adoc +++ b/docs/assemblies/creating-the-data-plane.adoc @@ -25,7 +25,7 @@ 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 +* oc 4.14 or higher (https://kustomize.io/[kustomize] version 5.0.1 or higher) include::proc_creating-the-SSH-key-secrets.adoc[leveloffset=+1] diff --git a/docs/assemblies/proc_creating-a-set-of-data-plane-nodes.adoc b/docs/assemblies/proc_creating-a-set-of-data-plane-nodes.adoc index 0e653bb6a..d3b3898c7 100644 --- a/docs/assemblies/proc_creating-a-set-of-data-plane-nodes.adoc +++ b/docs/assemblies/proc_creating-a-set-of-data-plane-nodes.adoc @@ -17,15 +17,15 @@ Create an `OpenStackDataPlaneNodeSet` CR for each logical grouping of nodes in y git checkout cd examples -. Use kustomize to create the `OpenStackDataPlaneDeployment` and `OpenStackDataPlaneNodeSet` CRs: +. Use kustomize to create the `OpenStackDataPlaneNodeSet` CRs: * Pre-provisioned nodes: - kustomize build preprovisioned > openstack-edpm.yaml + oc kustomize preprovisioned_nodeset > openstack-edpm.yaml * Bare metal nodes: - kustomize build baremetal > openstack-edpm.yaml + oc kustomize baremetal_nodeset > openstack-edpm.yaml + [NOTE] @@ -34,48 +34,10 @@ If desired, update the `values.yaml` file with values from your environment and ==== + -. 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: +. 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, +see kustomize example at `examples/nova_cell_custom` -.. Create a custom `nova` service that includes the `Secret` CR for the cell to connect to: -+ -[subs=+quotes] ----- -apiVersion: dataplane.openstack.org/v1beta1 -kind: OpenStackDataPlaneService -metadata: - name: *nova-cell-custom* - spec: - label: dataplane-deployment-custom-service - playbook: osp.edpm.nova - ... - secrets: - - nova-cell2-compute-config <1> ----- -+ -<1> The `Secret` CR generated by the control plane for the cell. -+ -For information about how to create a custom service, see xref:proc_creating-a-custom-service_dataplane[Creating a custom service]. -.. Replace the `nova` service in your `OpenStackDataPlaneNodeSet` CR with your custom `nova` service: -+ -[subs=+quotes] ----- -apiVersion: dataplane.openstack.org/v1beta1 -kind: OpenStackDataPlaneNodeSet -metadata: - name: openstack-edpm-ipam -spec: - services: - - configure-network - - validate-network - - install-os - - configure-os - - run-os - - ovn - - libvirt - - *nova-cell-custom* - - telemetry ----- + [NOTE] Do not change the order of the default services. @@ -310,7 +272,7 @@ endif::[] . Save the `openstack-edpm.yaml` definition file. -. Create and <> the data plane resources: +. Create the data plane resources: + ---- $ oc create -f openstack-edpm.yaml diff --git a/docs/assemblies/proc_deploying-the-data-plane.adoc b/docs/assemblies/proc_deploying-the-data-plane.adoc index 337dc4e44..89f461b78 100644 --- a/docs/assemblies/proc_deploying-the-data-plane.adoc +++ b/docs/assemblies/proc_deploying-the-data-plane.adoc @@ -6,7 +6,7 @@ You use the `OpenStackDataPlaneDeployment` CRD to configure the services on the .Procedure -. Complete the steps from <> procedure, ensuring that you have a file named `openstack-edpm.yaml` on your workstation. +. Copy the sample `OpenStackDataPlaneDeployment` CR from https://github.com/openstack-k8s-operators/dataplane-operator/blob/main/examples/base/crs/openstackdataplanedeployment.yaml and save it to a file named `openstack-edpm-deploy.yaml` on your workstation. . Optional: Update `nodeSets` to include all the `OpenStackDataPlaneNodeSet` CRs that you want to deploy: + @@ -25,10 +25,12 @@ spec: + * Replace `` 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: diff --git a/examples/baremetal_nodeset/kustomization.yaml b/examples/baremetal_nodeset/kustomization.yaml new file mode 100644 index 000000000..582fef270 --- /dev/null +++ b/examples/baremetal_nodeset/kustomization.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +components: +- ../baremetal + +patches: +- target: + kind: OpenStackDataPlaneDeployment + patch: | + $patch: delete + apiVersion: dataplane.openstack.org/v1beta1 + kind: OpenStackDataPlaneDeployment + metadata: + name: edpm-deployment diff --git a/examples/nova_cell_custom/kustomization.yaml b/examples/nova_cell_custom/kustomization.yaml new file mode 100644 index 000000000..a43375738 --- /dev/null +++ b/examples/nova_cell_custom/kustomization.yaml @@ -0,0 +1,33 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +namespace: openstack + +components: +- ../base + +resources: +- openstackdataplanenovaservice.yaml + +configMapGenerator: +- name: nova-extra-config + files: + - 25-nova-extra.conf=nova-extra.conf + options: + disableNameSuffixHash: true + +patches: +- target: + kind: OpenStackDataPlaneService + name: nova + patch: |- + - op: replace + path: /metadata/name + value: nova-cell-custom + - op: add + path: /spec/configMaps + value: + - nova-extra-config + +configurations: +- servicename.yaml diff --git a/examples/nova_cell_custom/nova-extra.conf b/examples/nova_cell_custom/nova-extra.conf new file mode 100644 index 000000000..e9de0ef51 --- /dev/null +++ b/examples/nova_cell_custom/nova-extra.conf @@ -0,0 +1,3 @@ +[compute] +cpu_shared_set = 2,6 +cpu_dedicated_set = 1,3,5,7 diff --git a/examples/nova_cell_custom/openstackdataplanenovaservice.yaml b/examples/nova_cell_custom/openstackdataplanenovaservice.yaml new file mode 100644 index 000000000..669eea54f --- /dev/null +++ b/examples/nova_cell_custom/openstackdataplanenovaservice.yaml @@ -0,0 +1,20 @@ +apiVersion: dataplane.openstack.org/v1beta1 +kind: OpenStackDataPlaneService +metadata: + name: nova +spec: + secrets: + - nova-cell1-compute-config + # NOTE: this Secret needs to be created before deploying the data plane. + # It should contain an ssh key-pair in the secret fields: ssh-privatekey + # and ssh-publickey + - nova-migration-ssh-key + playbook: osp.edpm.nova + tlsCert: + contents: + - dnsnames + - ips + networks: + - ctlplane + issuer: osp-rootca-issuer-internal + caCerts: combined-ca-bundle diff --git a/examples/nova_cell_custom/servicename.yaml b/examples/nova_cell_custom/servicename.yaml new file mode 100644 index 000000000..7d43116bd --- /dev/null +++ b/examples/nova_cell_custom/servicename.yaml @@ -0,0 +1,10 @@ +# This file is for teaching kustomize how to substitute OpenStackDataPlaneService name reference in OpenStackDataPlaneNodeSet +nameReference: +- kind: OpenStackDataPlaneService + version: v1beta1 + group: dataplane.openstack.org + fieldSpecs: + - kind: OpenStackDataPlaneNodeSet + version: v1beta1 + group: dataplane.openstack.org + path: spec/services diff --git a/examples/preprovisioned_nodeset/kustomization.yaml b/examples/preprovisioned_nodeset/kustomization.yaml new file mode 100644 index 000000000..269575aa5 --- /dev/null +++ b/examples/preprovisioned_nodeset/kustomization.yaml @@ -0,0 +1,17 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +namespace: openstack + +components: +- ../preprovisioned + +patches: +- target: + kind: OpenStackDataPlaneDeployment + patch: | + $patch: delete + apiVersion: dataplane.openstack.org/v1beta1 + kind: OpenStackDataPlaneDeployment + metadata: + name: edpm-deployment