Skip to content

Commit fdf9869

Browse files
Merge pull request openstack-k8s-operators#1478 from ciecierski/update-split-services
Add new update data plane service CRs into openstack-operator
2 parents a7ebf5e + 5dfbabd commit fdf9869

5 files changed

Lines changed: 79 additions & 3 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: dataplane.openstack.org/v1beta1
2+
kind: OpenStackDataPlaneService
3+
metadata:
4+
name: update-services
5+
spec:
6+
playbook: osp.edpm.update_services
7+
edpmServiceType: update-services
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: dataplane.openstack.org/v1beta1
2+
kind: OpenStackDataPlaneService
3+
metadata:
4+
name: update-system
5+
spec:
6+
playbook: osp.edpm.update_system
7+
edpmServiceType: update-system

controllers/dataplane/openstackdataplanenodeset_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
540540
services = instance.Spec.Services
541541
}
542542

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

558-
if service.Spec.EDPMServiceType != "update" {
558+
if service.Spec.EDPMServiceType != "update" && service.Spec.EDPMServiceType != "update-services" {
559559
continue
560560
}
561561

562-
// An "update" service Deployment has been completed, so
562+
// An "update" or "update-services" service Deployment has been completed, so
563563
// set the NodeSet's DeployedVersion to the Deployment's
564564
// DeployedVersion.
565565
instance.Status.DeployedVersion = deployment.Status.DeployedVersion

tests/functional/dataplane/base_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,15 @@ func MinorUpdateDataPlaneDeploymentSpec() map[string]interface{} {
316316
}
317317
}
318318

319+
func MinorUpdateServicesDataPlaneDeploymentSpec() map[string]interface{} {
320+
return map[string]interface{}{
321+
"nodeSets": []string{
322+
"edpm-compute-nodeset",
323+
},
324+
"servicesOverride": []string{"update-services"},
325+
}
326+
}
327+
319328
// Build OpenStackDataPlnaeDeploymentSpec with duplicate services
320329
func DuplicateServiceDeploymentSpec() map[string]interface{} {
321330
return map[string]interface{}{

tests/functional/dataplane/openstackdataplanenodeset_controller_test.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ var _ = Describe("Dataplane NodeSet Test", func() {
6666
var dataplaneConfigHash string
6767
var dataplaneGlobalServiceName types.NamespacedName
6868
var dataplaneUpdateServiceName types.NamespacedName
69+
var newDataplaneUpdateServiceName types.NamespacedName
6970

7071
defaultEdpmServiceList := []string{
7172
"edpm_frr_image",
@@ -118,6 +119,10 @@ var _ = Describe("Dataplane NodeSet Test", func() {
118119
Name: "update",
119120
Namespace: namespace,
120121
}
122+
newDataplaneUpdateServiceName = types.NamespacedName{
123+
Name: "update-services",
124+
Namespace: namespace,
125+
}
121126
err := os.Setenv("OPERATOR_SERVICES", "../../../config/services")
122127
Expect(err).NotTo(HaveOccurred())
123128
})
@@ -1306,6 +1311,54 @@ var _ = Describe("Dataplane NodeSet Test", func() {
13061311
})
13071312
})
13081313

1314+
When("A DataPlaneNodeSet is created with NoNodes and a MinorUpdateServices OpenStackDataPlaneDeployment is created", func() {
1315+
BeforeEach(func() {
1316+
1317+
dataplanev1.SetupDefaults()
1318+
updateServiceSpec := map[string]interface{}{
1319+
"playbook": "osp.edpm.update_services",
1320+
}
1321+
CreateDataPlaneServiceFromSpec(newDataplaneUpdateServiceName, updateServiceSpec)
1322+
DeferCleanup(th.DeleteService, newDataplaneUpdateServiceName)
1323+
DeferCleanup(th.DeleteInstance, CreateNetConfig(dataplaneNetConfigName, DefaultNetConfigSpec()))
1324+
DeferCleanup(th.DeleteInstance, CreateDNSMasq(dnsMasqName, DefaultDNSMasqSpec()))
1325+
DeferCleanup(th.DeleteInstance, CreateDataplaneNodeSet(dataplaneNodeSetName, DefaultDataPlaneNoNodeSetSpec(false)))
1326+
DeferCleanup(th.DeleteInstance, CreateDataplaneDeployment(dataplaneDeploymentName, MinorUpdateServicesDataPlaneDeploymentSpec()))
1327+
openstackVersionName := types.NamespacedName{
1328+
Name: "openstackversion",
1329+
Namespace: namespace,
1330+
}
1331+
err := os.Setenv("OPENSTACK_RELEASE_VERSION", "0.0.1")
1332+
Expect(err).NotTo(HaveOccurred())
1333+
openstackv1.SetupVersionDefaults()
1334+
DeferCleanup(th.DeleteInstance, CreateOpenStackVersion(openstackVersionName))
1335+
1336+
CreateSSHSecret(dataplaneSSHSecretName)
1337+
CreateCABundleSecret(caBundleSecretName)
1338+
SimulateDNSMasqComplete(dnsMasqName)
1339+
SimulateIPSetComplete(dataplaneNodeName)
1340+
SimulateDNSDataComplete(dataplaneNodeSetName)
1341+
1342+
Eventually(func(g Gomega) {
1343+
// Make an AnsibleEE name for each service
1344+
ansibleeeName := types.NamespacedName{
1345+
Name: "update-services-edpm-deployment-edpm-compute-nodeset",
1346+
Namespace: namespace,
1347+
}
1348+
ansibleEE := GetAnsibleee(ansibleeeName)
1349+
ansibleEE.Status.Succeeded = 1
1350+
g.Expect(th.K8sClient.Status().Update(th.Ctx, ansibleEE)).To(Succeed())
1351+
}, th.Timeout, th.Interval).Should(Succeed())
1352+
1353+
})
1354+
It("NodeSet.Status.DeployedVersion should be set to latest version", Label("update"), func() {
1355+
Eventually(func() string {
1356+
dataplaneNodeSetInstance := GetDataplaneNodeSet(dataplaneNodeSetName)
1357+
return dataplaneNodeSetInstance.Status.DeployedVersion
1358+
}).Should(Equal("0.0.1"))
1359+
})
1360+
})
1361+
13091362
When("A NodeSet and Deployment are created", func() {
13101363
BeforeEach(func() {
13111364
nodeSetSpec := DefaultDataPlaneNodeSetSpec("edpm-compute")

0 commit comments

Comments
 (0)