Skip to content

Commit 85f6bf0

Browse files
committed
Introduce ExtraMounts to test-operator
This patch introduces the ExtraMounts parameter to test-operator. The purpose is to be able to specify PersistentVolumeClaim, Secret, ConfigMap and mount it to the test pod spawned by the test-operator. Depends-On: openstack-k8s-operators/ci-framework#2906
1 parent cf44fd9 commit 85f6bf0

30 files changed

+14685
-10
lines changed

.zuul.yaml

+62
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- openstack-k8s-operators-content-provider
1212
vars:
1313
cifmw_test_operator_bundle: "{{ content_provider_registry_ip }}:5001/openstack-k8s-operators/test-operator:{{ zuul.patchset }}"
14+
cifmw_test_operator_version: "{{ zuul.patchset }}"
1415
periodic:
1516
jobs:
1617
- openstack-k8s-operators-content-provider:
@@ -97,6 +98,21 @@
9798
cifmw_test_operator_tempest_ntp_extra_images: https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img
9899
cifmw_test_operator_tempest_network_attachments:
99100
- ctlplane
101+
cifmw_test_operator_tempest_extra_mounts:
102+
- name: v1
103+
region: r1
104+
extraVol:
105+
- propagation:
106+
- Tempest
107+
extraVolType: Ceph
108+
volumes:
109+
- name: ceph
110+
secret:
111+
secretName: openstack-config-secret
112+
mounts:
113+
- name: ceph
114+
mountPath: "/etc/ceph"
115+
readOnly: true
100116

101117
# Tobiko
102118
cifmw_run_tobiko: true
@@ -108,13 +124,43 @@
108124
testenv: 'sanity'
109125
cifmw_test_operator_tobiko_network_attachments:
110126
- ctlplane
127+
cifmw_test_operator_tobiko_extra_mounts:
128+
- name: v1
129+
region: r1
130+
extraVol:
131+
- propagation:
132+
- Tobiko
133+
extraVolType: Ceph
134+
volumes:
135+
- name: ceph
136+
secret:
137+
secretName: openstack-config-secret
138+
mounts:
139+
- name: ceph
140+
mountPath: "/etc/ceph"
141+
readOnly: true
111142

112143
# Horizontest
113144
cifmw_run_horizontest: true
114145
cifmw_test_operator_horizontest_auth_url: "https://keystone-public-openstack.apps-crc.testing"
115146
cifmw_test_operator_horizontest_dashboard_url: "https://horizon-openstack.apps-crc.testing/"
116147
cifmw_test_operator_horizontest_extra_flag: "not pagination and test_users.py"
117148
cifmw_test_operator_horizontest_project_name_xpath: //*[@class="context-project"]//ancestor::ul
149+
cifmw_test_operator_horizontest_extra_mounts:
150+
- name: v1
151+
region: r1
152+
extraVol:
153+
- propagation:
154+
- HorizonTest
155+
extraVolType: Ceph
156+
volumes:
157+
- name: ceph
158+
secret:
159+
secretName: openstack-config-secret
160+
mounts:
161+
- name: ceph
162+
mountPath: "/etc/ceph"
163+
readOnly: true
118164

119165
# Ansibletest
120166
run_ansibletest: true
@@ -127,6 +173,21 @@
127173
cifmw_test_operator_ansibletest_ansible_var_files: |
128174
---
129175
foo: bar
176+
cifmw_test_operator_ansibletest_extra_mounts:
177+
- name: v1
178+
region: r1
179+
extraVol:
180+
- propagation:
181+
- AnsibleTest
182+
extraVolType: Ceph
183+
volumes:
184+
- name: ceph
185+
secret:
186+
secretName: openstack-config-secret
187+
mounts:
188+
- name: ceph
189+
mountPath: "/etc/ceph"
190+
readOnly: true
130191

131192
pre_deploy:
132193
- name: 61 HCI pre deploy kustomizations
@@ -136,6 +197,7 @@
136197
type: playbook
137198
source: control_plane_horizon.yml
138199

200+
139201
required-projects: &rp
140202
- name: openstack-k8s-operators/install_yamls
141203
override-checkout: main

api/bases/test.openstack.org_ansibletests.yaml

+1,797
Large diffs are not rendered by default.

api/bases/test.openstack.org_horizontests.yaml

+1,797
Large diffs are not rendered by default.

api/bases/test.openstack.org_tempests.yaml

+1,797
Large diffs are not rendered by default.

api/bases/test.openstack.org_tobikoes.yaml

+1,797
Large diffs are not rendered by default.

api/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.21
55
require (
66
github.com/google/go-cmp v0.7.0
77
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250423055245-3cb2ae8df6f0
8+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0
89
k8s.io/api v0.29.15
910
k8s.io/apimachinery v0.29.15
1011
sigs.k8s.io/controller-runtime v0.17.6

api/go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
7575
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
7676
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250423055245-3cb2ae8df6f0 h1:L2YsApIsUga1ku2siRM/kPViRNk756q+g7jrweAHkdo=
7777
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250423055245-3cb2ae8df6f0/go.mod h1:UwHXRIrMSPJD3lFqrA4oKmRXVLFQCRkLAj9x6KLEHiQ=
78+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0 h1:iVGCAds5eVjKEoZS0KSBwYziLeLW3ZBs8PqPMrljPcg=
79+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0/go.mod h1:cGynoLGY9NfyIeWXI3zZ+hgZdHF3SUi8ht5ygZ8CmhI=
7880
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
7981
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
8082
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

api/v1beta1/ansibletest_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ type AnsibleTestSpec struct {
100100

101101
type AnsibleTestWorkflowSpec struct {
102102
WorkflowCommonParameters `json:",inline"`
103-
CommonOpenstackConfig `json:",inline"`
103+
CommonOpenstackConfig `json:",inline"`
104104

105105
// +operator-sdk:csv:customresourcedefinitions:type=spec
106106
// +kubebuilder:validation:Required

api/v1beta1/common.go

+30
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package v1beta1
1818

1919
import (
2020
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
21+
"github.com/openstack-k8s-operators/lib-common/modules/storage"
2122
corev1 "k8s.io/api/core/v1"
2223
)
2324

@@ -85,6 +86,11 @@ type CommonOptions struct {
8586
// Extra configmaps for mounting inside the pod
8687
ExtraConfigmapsMounts []ExtraConfigmapsMounts `json:"extraConfigmapsMounts,omitempty"`
8788

89+
// +operator-sdk:csv:customresourcedefinitions:type=spec
90+
// +kubebuilder:validation:Optional
91+
// ExtraMounts containing conf files, credentials and storage volumes
92+
ExtraMounts []ExtraVolMounts `json:"extraMounts,omitempty"`
93+
8894
// +kubebuilder:validation:Optional
8995
// +operator-sdk:csv:customresourcedefinitions:type=spec
9096
// This value contains a nodeSelector value that is applied to test pods
@@ -181,3 +187,27 @@ type WorkflowCommonParameters struct {
181187
// test pods that are spawned by the test-operator.
182188
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
183189
}
190+
191+
type ExtraVolMounts struct {
192+
// +operator-sdk:csv:customresourcedefinitions:type=spec
193+
// +kubebuilder:validation:Optional
194+
Name string `json:"name,omitempty"`
195+
196+
// +operator-sdk:csv:customresourcedefinitions:type=spec
197+
// +kubebuilder:validation:Optional
198+
Region string `json:"region,omitempty"`
199+
200+
// +operator-sdk:csv:customresourcedefinitions:type=spec
201+
// +kubebuilder:validation:Required
202+
VolMounts []storage.VolMounts `json:"extraVol"`
203+
}
204+
205+
// Propagate is a function used to filter VolMounts according to the specified
206+
// PropagationType array
207+
func (c *ExtraVolMounts) Propagate(svc []storage.PropagationType) []storage.VolMounts {
208+
var vl []storage.VolMounts
209+
for _, gv := range c.VolMounts {
210+
vl = append(vl, gv.Propagate(svc)...)
211+
}
212+
return vl
213+
}

api/v1beta1/zz_generated.deepcopy.go

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)