Skip to content

Commit

Permalink
new API to allow services to generate MariaDBAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzeek committed Feb 22, 2024
1 parent fe54250 commit 268cd89
Show file tree
Hide file tree
Showing 22 changed files with 184 additions and 111 deletions.
10 changes: 3 additions & 7 deletions api/bases/cinder.openstack.org_cinderapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
items:
type: string
type: array
databaseHostname:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseHostname:
type: string
debug:
properties:
service:
Expand Down Expand Up @@ -876,12 +876,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
10 changes: 3 additions & 7 deletions api/bases/cinder.openstack.org_cinderbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
items:
type: string
type: array
databaseHostname:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseHostname:
type: string
debug:
properties:
service:
Expand Down Expand Up @@ -825,12 +825,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
10 changes: 3 additions & 7 deletions api/bases/cinder.openstack.org_cinders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ spec:
type: object
customServiceConfig:
type: string
databaseInstance:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseInstance:
type: string
dbPurge:
properties:
age:
Expand Down Expand Up @@ -1151,12 +1151,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
10 changes: 3 additions & 7 deletions api/bases/cinder.openstack.org_cinderschedulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
items:
type: string
type: array
databaseHostname:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseHostname:
type: string
debug:
properties:
service:
Expand Down Expand Up @@ -825,12 +825,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
10 changes: 3 additions & 7 deletions api/bases/cinder.openstack.org_cindervolumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
items:
type: string
type: array
databaseHostname:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseHostname:
type: string
debug:
properties:
service:
Expand Down Expand Up @@ -825,12 +825,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
1 change: 1 addition & 0 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo/v2 v2.15.0 // indirect
github.com/onsi/gomega v1.31.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY=
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo=
github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0=
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20240216173409-86913e6d5885 h1:o7KZaxKt8Dr97ZJIBPW0P482gLyFEURKF89fizcJCBQ=
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20240216173409-86913e6d5885/go.mod h1:bQwzyQtWCR9F0+IvWZ30J9d1lB6tcX3CNJ0Ten1smDw=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20240216173409-86913e6d5885 h1:sMO+IYsZ91Nho0FV6y03J0NTGd8+ZWB4KmKJJU94gTU=
Expand Down
16 changes: 5 additions & 11 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ type CinderTemplate struct {

// +kubebuilder:validation:Optional
// +kubebuilder:default=cinder
// DatabaseUser - optional username used for cinder DB, defaults to cinder
// TODO: -> implement needs work in mariadb-operator, right now only cinder
DatabaseUser string `json:"databaseUser"`
// DatabaseAccount - optional MariaDBAccount used for cinder DB, defaults to cinder
DatabaseAccount string `json:"databaseAccount"`

// +kubebuilder:validation:Required
// Secret containing OpenStack password information for CinderDatabasePassword
// Secret containing OpenStack password information
Secret string `json:"secret"`

// +kubebuilder:validation:Optional
// +kubebuilder:default={database: CinderDatabasePassword, service: CinderPassword}
// PasswordSelectors - Selectors to identify the DB and ServiceUser password from the Secret
// +kubebuilder:default={service: CinderPassword}
// PasswordSelectors - Selectors to identify the ServiceUser password from the Secret
PasswordSelectors PasswordSelector `json:"passwordSelectors"`
}

Expand Down Expand Up @@ -84,11 +83,6 @@ type CinderServiceTemplate struct {

// PasswordSelector to identify the DB and AdminUser password from the Secret
type PasswordSelector struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default="CinderDatabasePassword"
// Database - Selector to get the cinder database user password from the Secret
// TODO: not used, need change in mariadb-operator
Database string `json:"database"`
// +kubebuilder:validation:Optional
// +kubebuilder:default="CinderPassword"
// Service - Selector to get the cinder service password from the Secret
Expand Down
10 changes: 3 additions & 7 deletions config/crd/bases/cinder.openstack.org_cinderapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
items:
type: string
type: array
databaseHostname:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseHostname:
type: string
debug:
properties:
service:
Expand Down Expand Up @@ -876,12 +876,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
10 changes: 3 additions & 7 deletions config/crd/bases/cinder.openstack.org_cinderbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
items:
type: string
type: array
databaseHostname:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseHostname:
type: string
debug:
properties:
service:
Expand Down Expand Up @@ -825,12 +825,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
10 changes: 3 additions & 7 deletions config/crd/bases/cinder.openstack.org_cinders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ spec:
type: object
customServiceConfig:
type: string
databaseInstance:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseInstance:
type: string
dbPurge:
properties:
age:
Expand Down Expand Up @@ -1151,12 +1151,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
10 changes: 3 additions & 7 deletions config/crd/bases/cinder.openstack.org_cinderschedulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
items:
type: string
type: array
databaseHostname:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseHostname:
type: string
debug:
properties:
service:
Expand Down Expand Up @@ -825,12 +825,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
10 changes: 3 additions & 7 deletions config/crd/bases/cinder.openstack.org_cindervolumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
items:
type: string
type: array
databaseHostname:
type: string
databaseUser:
databaseAccount:
default: cinder
type: string
databaseHostname:
type: string
debug:
properties:
service:
Expand Down Expand Up @@ -825,12 +825,8 @@ spec:
type: object
passwordSelectors:
default:
database: CinderDatabasePassword
service: CinderPassword
properties:
database:
default: CinderDatabasePassword
type: string
service:
default: CinderPassword
type: string
Expand Down
2 changes: 1 addition & 1 deletion config/samples/cinder_v1beta1_cinder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
[DEFAULT]
debug = true
databaseInstance: openstack
databaseUser: cinder
databaseAccount: cinder
rabbitMqClusterName: rabbitmq
cinderAPI: {}
cinderScheduler: {}
Expand Down
2 changes: 1 addition & 1 deletion config/samples/cinder_v1beta1_cinder_tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
[DEFAULT]
debug = true
databaseInstance: openstack
databaseUser: cinder
databaseAccount: cinder
rabbitMqClusterName: rabbitmq
cinderAPI:
tls:
Expand Down
Loading

0 comments on commit 268cd89

Please sign in to comment.