Skip to content

Commit 3a6fabe

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 51bb165 commit 3a6fabe

30 files changed

+14686
-10
lines changed

.zuul.yaml

+63
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
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_repo: https://github.com/openstack-k8s-operators/test-operator.git
15+
cifmw_test_operator_version: "{{ zuul.patchset }}"
1416
periodic:
1517
jobs:
1618
- openstack-k8s-operators-content-provider:
@@ -97,6 +99,21 @@
9799
cifmw_test_operator_tempest_ntp_extra_images: https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img
98100
cifmw_test_operator_tempest_network_attachments:
99101
- ctlplane
102+
cifmw_test_operator_tempest_extra_mounts:
103+
- name: v1
104+
region: r1
105+
extraVol:
106+
- propagation:
107+
- Tempest
108+
extraVolType: Ceph
109+
volumes:
110+
- name: ceph
111+
secret:
112+
secretName: webhook-server-cert
113+
mounts:
114+
- name: ceph
115+
mountPath: "/etc/ceph"
116+
readOnly: true
100117

101118
# Tobiko
102119
cifmw_run_tobiko: true
@@ -108,13 +125,43 @@
108125
testenv: 'sanity'
109126
cifmw_test_operator_tobiko_network_attachments:
110127
- ctlplane
128+
cifmw_test_operator_tobiko_extra_mounts:
129+
- name: v1
130+
region: r1
131+
extraVol:
132+
- propagation:
133+
- Tobiko
134+
extraVolType: Ceph
135+
volumes:
136+
- name: ceph
137+
secret:
138+
secretName: webhook-server-cert
139+
mounts:
140+
- name: ceph
141+
mountPath: "/etc/ceph"
142+
readOnly: true
111143

112144
# Horizontest
113145
cifmw_run_horizontest: true
114146
cifmw_test_operator_horizontest_auth_url: "https://keystone-public-openstack.apps-crc.testing"
115147
cifmw_test_operator_horizontest_dashboard_url: "https://horizon-openstack.apps-crc.testing/"
116148
cifmw_test_operator_horizontest_extra_flag: "not pagination and test_users.py"
117149
cifmw_test_operator_horizontest_project_name_xpath: //*[@class="context-project"]//ancestor::ul
150+
cifmw_test_operator_horizontest_extra_mounts:
151+
- name: v1
152+
region: r1
153+
extraVol:
154+
- propagation:
155+
- HorizonTest
156+
extraVolType: Ceph
157+
volumes:
158+
- name: ceph
159+
secret:
160+
secretName: webhook-server-cert
161+
mounts:
162+
- name: ceph
163+
mountPath: "/etc/ceph"
164+
readOnly: true
118165

119166
# Ansibletest
120167
run_ansibletest: true
@@ -127,6 +174,21 @@
127174
cifmw_test_operator_ansibletest_ansible_var_files: |
128175
---
129176
foo: bar
177+
cifmw_test_operator_ansibletest_extra_mounts:
178+
- name: v1
179+
region: r1
180+
extraVol:
181+
- propagation:
182+
- AnsibleTest
183+
extraVolType: Ceph
184+
volumes:
185+
- name: ceph
186+
secret:
187+
secretName: webhook-server-cert
188+
mounts:
189+
- name: ceph
190+
mountPath: "/etc/ceph"
191+
readOnly: true
130192

131193
pre_deploy:
132194
- name: 61 HCI pre deploy kustomizations
@@ -136,6 +198,7 @@
136198
type: playbook
137199
source: control_plane_horizon.yml
138200

201+
139202
required-projects: &rp
140203
- name: openstack-k8s-operators/install_yamls
141204
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.20250408123225-0d9e9b82c41b
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.20250408123225-0d9e9b82c41b h1:T+N6xOT2NP+hVp2K1xl/NV3uheVHu38CcBuW+8uOBYw=
7777
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250408123225-0d9e9b82c41b/go.mod h1:A9Ohw5Q90YOGhcDF4ZHkMr5RArz3phoBu9+ibbYDKG4=
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)