@@ -23,6 +23,7 @@ import (
2323 . "github.com/onsi/ginkgo/v2" //revive:disable:dot-imports
2424 . "github.com/onsi/gomega" //revive:disable:dot-imports
2525 "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
26+ "github.com/openstack-k8s-operators/lib-common/modules/storage"
2627 openstackv1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1"
2728 dataplanev1 "github.com/openstack-k8s-operators/openstack-operator/apis/dataplane/v1beta1"
2829
@@ -1435,6 +1436,72 @@ var _ = Describe("Dataplane NodeSet Test", func() {
14351436 })
14361437 })
14371438
1439+ When ("A NodeSet and Deployment are created with extraMounts with pvc template" , func () {
1440+ BeforeEach (func () {
1441+ edpmVolClaimTemplate := corev1.PersistentVolumeClaimVolumeSource {
1442+ ClaimName : "edpm-ansible" ,
1443+ ReadOnly : true ,
1444+ }
1445+ nodeSetSpec := DefaultDataPlaneNodeSetSpec ("edpm-compute" )
1446+ nodeSetSpec ["preProvisioned" ] = true
1447+ nodeSetSpec ["services" ] = []string {"bootstrap" }
1448+ nodeSetSpec ["nodeTemplate" ] = map [string ]interface {}{
1449+ "extraMounts" : []storage.VolMounts {
1450+ {
1451+ Mounts : []corev1.VolumeMount {
1452+ {
1453+ Name : "edpm-ansible" ,
1454+ MountPath : "/usr/share/ansible/collections/ansible_collections/osp/edpm" ,
1455+ },
1456+ },
1457+ Volumes : []storage.Volume {
1458+ {
1459+ Name : "edpm-ansible" ,
1460+ VolumeSource : storage.VolumeSource {
1461+ PersistentVolumeClaim : & edpmVolClaimTemplate ,
1462+ },
1463+ },
1464+ },
1465+ },
1466+ },
1467+ "ansibleSSHPrivateKeySecret" : "dataplane-ansible-ssh-private-key-secret" ,
1468+ "ansible" : map [string ]interface {}{
1469+ "ansibleUser" : "cloud-user" ,
1470+ },
1471+ }
1472+ DeferCleanup (th .DeleteInstance , CreateNetConfig (dataplaneNetConfigName , DefaultNetConfigSpec ()))
1473+ DeferCleanup (th .DeleteInstance , CreateDNSMasq (dnsMasqName , DefaultDNSMasqSpec ()))
1474+ DeferCleanup (th .DeleteInstance , CreateDataplaneNodeSet (dataplaneNodeSetName , nodeSetSpec ))
1475+ DeferCleanup (th .DeleteInstance , CreateDataplaneDeployment (dataplaneDeploymentName , DefaultDataPlaneDeploymentSpec ()))
1476+ CreateSSHSecret (dataplaneSSHSecretName )
1477+ SimulateDNSMasqComplete (dnsMasqName )
1478+ SimulateIPSetComplete (dataplaneNodeName )
1479+ SimulateDNSDataComplete (dataplaneNodeSetName )
1480+
1481+ })
1482+ It ("Should have ExtraMounts, SSH and Inventory volume mounts" , func () {
1483+ Eventually (func (g Gomega ) {
1484+ const bootstrapName string = "bootstrap"
1485+ // Make an AnsibleEE name for each service
1486+ ansibleeeName := types.NamespacedName {
1487+ Name : fmt .Sprintf (
1488+ bootstrapName + "-" + dataplaneDeploymentName .Name + "-" + dataplaneNodeSetName .Name ),
1489+ Namespace : namespace ,
1490+ }
1491+ ansibleEE := GetAnsibleee (ansibleeeName )
1492+ g .Expect (ansibleEE .Spec .Template .Spec .Volumes ).To (HaveLen (3 ))
1493+ g .Expect (ansibleEE .Spec .Template .Spec .Volumes [0 ].Name ).To (Equal ("edpm-ansible" ))
1494+ g .Expect (ansibleEE .Spec .Template .Spec .Volumes [1 ].Name ).To (Equal ("ssh-key" ))
1495+ g .Expect (ansibleEE .Spec .Template .Spec .Volumes [2 ].Name ).To (Equal ("inventory" ))
1496+ g .Expect (ansibleEE .Spec .Template .Spec .Volumes [0 ].VolumeSource .PersistentVolumeClaim .ClaimName ).To (Equal ("edpm-ansible" ))
1497+ g .Expect (ansibleEE .Spec .Template .Spec .Volumes [1 ].VolumeSource .Secret .SecretName ).To (Equal ("dataplane-ansible-ssh-private-key-secret" ))
1498+ g .Expect (ansibleEE .Spec .Template .Spec .Volumes [1 ].VolumeSource .Secret .Items [0 ].Path ).To (Equal ("ssh_key" ))
1499+ g .Expect (ansibleEE .Spec .Template .Spec .Volumes [1 ].VolumeSource .Secret .Items [0 ].Key ).To (Equal ("ssh-privatekey" ))
1500+
1501+ }, th .Timeout , th .Interval ).Should (Succeed ())
1502+ })
1503+ })
1504+
14381505 When ("A ImageContentSourcePolicy exists in the cluster" , func () {
14391506 BeforeEach (func () {
14401507 nodeSetSpec := DefaultDataPlaneNodeSetSpec ("edpm-compute" )
0 commit comments