Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneService
metadata:
name: update-services
spec:
playbook: osp.edpm.update_services
edpmServiceType: update-services
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneService
metadata:
name: update-system
spec:
playbook: osp.edpm.update_system
edpmServiceType: update-system
6 changes: 3 additions & 3 deletions controllers/dataplane/openstackdataplanenodeset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
services = instance.Spec.Services
}

// For each service, check if EDPMServiceType is "update", and
// For each service, check if EDPMServiceType is "update" or "update-services", and
// if so, copy Deployment.Status.DeployedVersion to
// NodeSet.Status.DeployedVersion
for _, serviceName := range services {
Expand All @@ -555,11 +555,11 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
return isDeploymentReady, isDeploymentRunning, isDeploymentFailed, failedDeploymentName, err
}

if service.Spec.EDPMServiceType != "update" {
if service.Spec.EDPMServiceType != "update" && service.Spec.EDPMServiceType != "update-services" {
continue
}

// An "update" service Deployment has been completed, so
// An "update" or "update-services" service Deployment has been completed, so
// set the NodeSet's DeployedVersion to the Deployment's
// DeployedVersion.
instance.Status.DeployedVersion = deployment.Status.DeployedVersion
Expand Down
9 changes: 9 additions & 0 deletions tests/functional/dataplane/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,15 @@ func MinorUpdateDataPlaneDeploymentSpec() map[string]interface{} {
}
}

func MinorUpdateServicesDataPlaneDeploymentSpec() map[string]interface{} {
return map[string]interface{}{
"nodeSets": []string{
"edpm-compute-nodeset",
},
"servicesOverride": []string{"update-services"},
}
}

// Build OpenStackDataPlnaeDeploymentSpec with duplicate services
func DuplicateServiceDeploymentSpec() map[string]interface{} {
return map[string]interface{}{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var _ = Describe("Dataplane NodeSet Test", func() {
var dataplaneConfigHash string
var dataplaneGlobalServiceName types.NamespacedName
var dataplaneUpdateServiceName types.NamespacedName
var newDataplaneUpdateServiceName types.NamespacedName

defaultEdpmServiceList := []string{
"edpm_frr_image",
Expand Down Expand Up @@ -118,6 +119,10 @@ var _ = Describe("Dataplane NodeSet Test", func() {
Name: "update",
Namespace: namespace,
}
newDataplaneUpdateServiceName = types.NamespacedName{
Name: "update-services",
Namespace: namespace,
}
err := os.Setenv("OPERATOR_SERVICES", "../../../config/services")
Expect(err).NotTo(HaveOccurred())
})
Expand Down Expand Up @@ -1306,6 +1311,54 @@ var _ = Describe("Dataplane NodeSet Test", func() {
})
})

When("A DataPlaneNodeSet is created with NoNodes and a MinorUpdateServices OpenStackDataPlaneDeployment is created", func() {
BeforeEach(func() {

dataplanev1.SetupDefaults()
updateServiceSpec := map[string]interface{}{
"playbook": "osp.edpm.update_services",
}
CreateDataPlaneServiceFromSpec(newDataplaneUpdateServiceName, updateServiceSpec)
DeferCleanup(th.DeleteService, newDataplaneUpdateServiceName)
DeferCleanup(th.DeleteInstance, CreateNetConfig(dataplaneNetConfigName, DefaultNetConfigSpec()))
DeferCleanup(th.DeleteInstance, CreateDNSMasq(dnsMasqName, DefaultDNSMasqSpec()))
DeferCleanup(th.DeleteInstance, CreateDataplaneNodeSet(dataplaneNodeSetName, DefaultDataPlaneNoNodeSetSpec(false)))
DeferCleanup(th.DeleteInstance, CreateDataplaneDeployment(dataplaneDeploymentName, MinorUpdateServicesDataPlaneDeploymentSpec()))
openstackVersionName := types.NamespacedName{
Name: "openstackversion",
Namespace: namespace,
}
err := os.Setenv("OPENSTACK_RELEASE_VERSION", "0.0.1")
Expect(err).NotTo(HaveOccurred())
openstackv1.SetupVersionDefaults()
DeferCleanup(th.DeleteInstance, CreateOpenStackVersion(openstackVersionName))

CreateSSHSecret(dataplaneSSHSecretName)
CreateCABundleSecret(caBundleSecretName)
SimulateDNSMasqComplete(dnsMasqName)
SimulateIPSetComplete(dataplaneNodeName)
SimulateDNSDataComplete(dataplaneNodeSetName)

Eventually(func(g Gomega) {
// Make an AnsibleEE name for each service
ansibleeeName := types.NamespacedName{
Name: "update-services-edpm-deployment-edpm-compute-nodeset",
Namespace: namespace,
}
ansibleEE := GetAnsibleee(ansibleeeName)
ansibleEE.Status.Succeeded = 1
g.Expect(th.K8sClient.Status().Update(th.Ctx, ansibleEE)).To(Succeed())
}, th.Timeout, th.Interval).Should(Succeed())

})
It("NodeSet.Status.DeployedVersion should be set to latest version", Label("update"), func() {
Eventually(func() string {
dataplaneNodeSetInstance := GetDataplaneNodeSet(dataplaneNodeSetName)
return dataplaneNodeSetInstance.Status.DeployedVersion
}).Should(Equal("0.0.1"))
})
})

When("A NodeSet and Deployment are created", func() {
BeforeEach(func() {
nodeSetSpec := DefaultDataPlaneNodeSetSpec("edpm-compute")
Expand Down