Skip to content

Commit 2b2bc1b

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#2792
1 parent 12466b0 commit 2b2bc1b

30 files changed

+14684
-10
lines changed

.zuul.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,21 @@
9797
cifmw_test_operator_tempest_ntp_extra_images: https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img
9898
cifmw_test_operator_tempest_network_attachments:
9999
- ctlplane
100+
cifmw_test_operator_tempest_extra_mounts:
101+
- name: v1
102+
region: r1
103+
extraVol:
104+
- propagation:
105+
- Tempest
106+
extraVolType: Ceph
107+
volumes:
108+
- name: ceph
109+
secret:
110+
secretName: webhook-server-cert
111+
mounts:
112+
- name: ceph
113+
mountPath: "/etc/ceph"
114+
readOnly: true
100115

101116
# Tobiko
102117
cifmw_run_tobiko: true
@@ -108,13 +123,43 @@
108123
testenv: 'sanity'
109124
cifmw_test_operator_tobiko_network_attachments:
110125
- ctlplane
126+
cifmw_test_operator_tobiko_extra_mounts:
127+
- name: v1
128+
region: r1
129+
extraVol:
130+
- propagation:
131+
- Tobiko
132+
extraVolType: Ceph
133+
volumes:
134+
- name: ceph
135+
secret:
136+
secretName: webhook-server-cert
137+
mounts:
138+
- name: ceph
139+
mountPath: "/etc/ceph"
140+
readOnly: true
111141

112142
# Horizontest
113143
cifmw_run_horizontest: true
114144
cifmw_test_operator_horizontest_auth_url: "https://keystone-public-openstack.apps-crc.testing"
115145
cifmw_test_operator_horizontest_dashboard_url: "https://horizon-openstack.apps-crc.testing/"
116146
cifmw_test_operator_horizontest_extra_flag: "not pagination and test_users.py"
117147
cifmw_test_operator_horizontest_project_name_xpath: //*[@class="context-project"]//ancestor::ul
148+
cifmw_test_operator_horizontest_extra_mounts:
149+
- name: v1
150+
region: r1
151+
extraVol:
152+
- propagation:
153+
- HorizonTest
154+
extraVolType: Ceph
155+
volumes:
156+
- name: ceph
157+
secret:
158+
secretName: webhook-server-cert
159+
mounts:
160+
- name: ceph
161+
mountPath: "/etc/ceph"
162+
readOnly: true
118163

119164
# Ansibletest
120165
run_ansibletest: true
@@ -127,6 +172,21 @@
127172
cifmw_test_operator_ansibletest_ansible_var_files: |
128173
---
129174
foo: bar
175+
cifmw_test_operator_ansibletest_extra_mounts:
176+
- name: v1
177+
region: r1
178+
extraVol:
179+
- propagation:
180+
- AnsibleTest
181+
extraVolType: Ceph
182+
volumes:
183+
- name: ceph
184+
secret:
185+
secretName: webhook-server-cert
186+
mounts:
187+
- name: ceph
188+
mountPath: "/etc/ceph"
189+
readOnly: true
130190

131191
pre_deploy:
132192
- name: 61 HCI pre deploy kustomizations
@@ -136,6 +196,7 @@
136196
type: playbook
137197
source: control_plane_horizon.yml
138198

199+
139200
required-projects: &rp
140201
- name: openstack-k8s-operators/install_yamls
141202
override-checkout: main

api/bases/test.openstack.org_ansibletests.yaml

Lines changed: 1797 additions & 0 deletions
Large diffs are not rendered by default.

api/bases/test.openstack.org_horizontests.yaml

Lines changed: 1797 additions & 0 deletions
Large diffs are not rendered by default.

api/bases/test.openstack.org_tempests.yaml

Lines changed: 1797 additions & 0 deletions
Large diffs are not rendered by default.

api/bases/test.openstack.org_tobikoes.yaml

Lines changed: 1797 additions & 0 deletions
Large diffs are not rendered by default.

api/go.mod

Lines changed: 1 addition & 0 deletions
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.20250315090821-34e570d2d5fb
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

Lines changed: 2 additions & 0 deletions
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.20250315090821-34e570d2d5fb h1:UAFYEHnbyhO0+yymquFmIqxc9QGji9mzreuYrDS1Ev4=
7777
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250315090821-34e570d2d5fb/go.mod h1:1CtBP0MQffdjE6buOv5jP2rB3+h7WH0a11lcyrpmxOk=
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 30 additions & 0 deletions
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

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)