Skip to content

Commit dfd5294

Browse files
committed
Import ExtraMounts to keystone-operator
This patch introduces the extraMounts feature and the Propagation keys provided by storage. The purpose is to allow entities to provide files (via Secrets, ConfigMaps, regular PVCs and so forth) to the KeystoneAPI pods via the existing Volume/VolumeMounts interface. Signed-off-by: Francesco Pantano <[email protected]>
1 parent dbe5adf commit dfd5294

File tree

15 files changed

+2267
-17
lines changed

15 files changed

+2267
-17
lines changed

api/bases/keystone.openstack.org_keystoneapis.yaml

Lines changed: 1064 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
@@ -10,6 +10,7 @@ require (
1010
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250328101744-699b0b8f418d
1111
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250324161140-e9964a1b2266
1212
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250324161140-e9964a1b2266
13+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250402133843-5a4c5f4fb4f1
1314
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20250324161140-e9964a1b2266
1415
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
1516
k8s.io/api v0.29.15

api/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.2025032416
8686
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250324161140-e9964a1b2266/go.mod h1:1CtBP0MQffdjE6buOv5jP2rB3+h7WH0a11lcyrpmxOk=
8787
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250324161140-e9964a1b2266 h1:YpJtUjf/CX48D1qteG33EQCe0o5wXae2FtSn/H/Mi28=
8888
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250324161140-e9964a1b2266/go.mod h1:fesgTbs2j30Fhw2hebXkPgbeAIqG0Yk2oaeOklAInZg=
89+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250402133843-5a4c5f4fb4f1 h1:KcltUDbUA0sjtf6bV60L7GDpC0pmokhtdK3579yytS4=
90+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250402133843-5a4c5f4fb4f1/go.mod h1:5+v92XC/PRATIiBrhNLEpJ+T4R9JpxBCgRP6QvbfwgE=
8991
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20250324161140-e9964a1b2266 h1:TIkLc7L4NaByud0qnlVGouRgDoVQgwxufayPKduzcJ0=
9092
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20250324161140-e9964a1b2266/go.mod h1:oKvVb28i6wwBR5uQO2B2KMzZnCFTPCUCj31c5Zvz2lo=
9193
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=

api/v1beta1/keystoneapi_types.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2626
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
2727
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
28+
"github.com/openstack-k8s-operators/lib-common/modules/storage"
2829
"k8s.io/apimachinery/pkg/util/validation/field"
2930
corev1 "k8s.io/api/core/v1"
3031
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -201,6 +202,10 @@ type KeystoneAPISpecCore struct {
201202
// TopologyRef to apply the Topology defined by the associated CR referenced
202203
// by name
203204
TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"`
205+
206+
// ExtraMounts containing conf files
207+
// +kubebuilder:default={}
208+
ExtraMounts []KeystoneExtraMounts `json:"extraMounts,omitempty"`
204209
}
205210

206211
// APIOverrideSpec to override the generated manifest of several child resources.
@@ -334,6 +339,27 @@ func SetupDefaults() {
334339
SetupKeystoneAPIDefaults(keystoneDefaults)
335340
}
336341

342+
// KeystoneExtraVolMounts exposes additional parameters processed by keystone-operator
343+
// and defines the common VolMounts structure provided by the main storage module
344+
type KeystoneExtraMounts struct {
345+
// +kubebuilder:validation:Optional
346+
Name string `json:"name,omitempty"`
347+
// +kubebuilder:validation:Optional
348+
Region string `json:"region,omitempty"`
349+
// +kubebuilder:validation:Required
350+
VolMounts []storage.VolMounts `json:"extraVol"`
351+
}
352+
353+
// Propagate is a function used to filter VolMounts according to the specified
354+
// PropagationType array
355+
func (c *KeystoneExtraMounts) Propagate(svc []storage.PropagationType) []storage.VolMounts {
356+
var vl []storage.VolMounts
357+
for _, gv := range c.VolMounts {
358+
vl = append(vl, gv.Propagate(svc)...)
359+
}
360+
return vl
361+
}
362+
337363
// GetLastTopologyRef - Returns a TopoRef object that can be passed to the
338364
// Handle topology logic
339365
func (instance KeystoneAPI) GetLastAppliedTopologyRef() *topologyv1.TopoRef {

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)