diff --git a/config/services/dataplane_v1beta1_openstackdataplaneservice_upgrade_services.yaml b/config/services/dataplane_v1beta1_openstackdataplaneservice_upgrade_services.yaml new file mode 100644 index 000000000..bb63fbe0a --- /dev/null +++ b/config/services/dataplane_v1beta1_openstackdataplaneservice_upgrade_services.yaml @@ -0,0 +1,7 @@ +apiVersion: dataplane.openstack.org/v1beta1 +kind: OpenStackDataPlaneService +metadata: + name: upgrade-services +spec: + playbook: osp.edpm.upgrade_services + edpmServiceType: upgrade-services diff --git a/docs/assemblies/con_data-plane-services.adoc b/docs/assemblies/con_data-plane-services.adoc index 0ecf88aa3..925e0d5b3 100644 --- a/docs/assemblies/con_data-plane-services.adoc +++ b/docs/assemblies/con_data-plane-services.adoc @@ -87,6 +87,7 @@ spec: |`neutron-metadata` |(Deprecated) Include this service to run the standalone Neutron OVN Metadata agent on the data plane nodes. Superseded by the `metadata` extension of the `neutron-ovn` service, which is enabled by default. |`neutron-dhcp` |Include this service to run a Neutron DHCP agent on the data plane nodes. |`cleanup` |Include this service to clean up containers and configurations for services that have been removed from the nodeset. The cleanup service compares the current services list with previously deployed services, removes containers for services no longer in the list, removes startup_config and configuration files, and runs service-specific cleanup tasks. Use this service via `servicesOverride` for one-time cleanup after removing services from a nodeset, or add to the services list if cleanup should run on every deployment. +|`upgrade-services` |Include this service explicitly through `servicesOverride` to run the `osp.edpm.upgrade_services` playbook. This service is not enabled by default and should only be used for a major-version upgrade of the data plane. |=== For more information about the available default services, see https://github.com/openstack-k8s-operators/openstack-operator/tree/main/config/services. diff --git a/test/functional/dataplane/openstackdataplanenodeset_controller_test.go b/test/functional/dataplane/openstackdataplanenodeset_controller_test.go index 29a3f6d2c..c81b26260 100644 --- a/test/functional/dataplane/openstackdataplanenodeset_controller_test.go +++ b/test/functional/dataplane/openstackdataplanenodeset_controller_test.go @@ -1322,6 +1322,52 @@ var _ = Describe("Dataplane NodeSet Test", func() { }) }) + When("A DataPlaneNodeSet is deployed with the upgrade service override", func() { + BeforeEach(func() { + dataplanev1.SetupDefaults() + + deploymentSpec := DefaultDataPlaneDeploymentSpec() + deploymentSpec["servicesOverride"] = []string{"upgrade-services"} + + DeferCleanup(th.DeleteInstance, + CreateNetConfig(dataplaneNetConfigName, DefaultNetConfigSpec())) + DeferCleanup(th.DeleteInstance, + CreateDNSMasq(dnsMasqName, DefaultDNSMasqSpec())) + DeferCleanup(th.DeleteInstance, + CreateDataplaneNodeSet( + dataplaneNodeSetName, + DefaultDataPlaneNoNodeSetSpec(false))) + DeferCleanup(th.DeleteInstance, + CreateDataplaneDeployment(dataplaneDeploymentName, deploymentSpec)) + + CreateSSHSecret(dataplaneSSHSecretName) + CreateCABundleSecret(caBundleSecretName) + SimulateDNSMasqComplete(dnsMasqName) + SimulateIPSetComplete(dataplaneNodeName) + SimulateDNSDataComplete(dataplaneNodeSetName) + }) + + It("creates an Ansible execution for the upgrade playbook", func() { + Eventually(func(g Gomega) { + ansibleeeName := types.NamespacedName{ + Name: fmt.Sprintf("%s-%s-%s", + "upgrade-services", + dataplaneDeploymentName.Name, + dataplaneNodeSetName.Name), + Namespace: namespace, + } + ansibleEE := GetAnsibleee(ansibleeeName) + container := ansibleEE.Spec.Template.Spec.Containers[0] + + g.Expect(container.Args).To(ContainElement("osp.edpm.upgrade_services")) + g.Expect(findEnvVar(container.Env).Value). + To(ContainSubstring("edpm_service_type")) + g.Expect(findEnvVar(container.Env).Value). + To(ContainSubstring("upgrade-services")) + }, th.Timeout, th.Interval).Should(Succeed()) + }) + }) + When("A NodeSet and Deployment are created", func() { BeforeEach(func() { nodeSetSpec := DefaultDataPlaneNodeSetSpec("edpm-compute")