Skip to content

Commit

Permalink
remove "mariadb" CRD references in favor of Galera
Browse files Browse the repository at this point in the history
To support upstream mariadb-operator removal of the "MariaDB"
resource in [1], openstack-operator should refer only to Galera
as the relational database deployment

[1] openstack-k8s-operators/mariadb-operator#173
  • Loading branch information
zzzeek committed Dec 11, 2023
1 parent b7c515f commit 8c448f6
Show file tree
Hide file tree
Showing 22 changed files with 25 additions and 370 deletions.
29 changes: 0 additions & 29 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7613,35 +7613,6 @@ spec:
- rabbitMqClusterName
type: object
type: object
mariadb:
properties:
enabled:
default: true
type: boolean
templates:
additionalProperties:
properties:
adoptionRedirect:
properties:
host:
type: string
type: object
containerImage:
type: string
secret:
type: string
storageClass:
type: string
storageRequest:
type: string
required:
- containerImage
- secret
- storageClass
- storageRequest
type: object
type: object
type: object
memcached:
properties:
enabled:
Expand Down
19 changes: 0 additions & 19 deletions apis/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ type OpenStackControlPlaneSpec struct {
// Cinder - Parameters related to the Cinder service
Cinder CinderSection `json:"cinder,omitempty"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Mariadb - Parameters related to the Mariadb service
Mariadb MariadbSection `json:"mariadb,omitempty"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Galera - Parameters related to the Galera services
Expand Down Expand Up @@ -324,20 +319,6 @@ type CinderSection struct {
APIOverride Override `json:"apiOverride,omitempty"`
}

// MariadbSection defines the desired state of MariaDB service
type MariadbSection struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Enabled - Whether MariaDB service should be deployed and managed
Enabled bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Templates - Overrides to use when creating the MariaDB databases
Templates map[string]mariadbv1.MariaDBSpec `json:"templates,omitempty"`
}

// GaleraSection defines the desired state of Galera services
type GaleraSection struct {
// +kubebuilder:validation:Optional
Expand Down
59 changes: 20 additions & 39 deletions apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,55 +116,55 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) string {

switch name {
case "Keystone":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled) {
reqs = "MariaDB or Galera, Memcached"
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled) {
reqs = "Galera, Memcached"
}
case "Glance":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, Memcached, Keystone"
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) {
reqs = "Galera, Memcached, Keystone"
}
case "Cinder":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, Memcached, RabbitMQ, Keystone"
reqs = "Galera, Memcached, RabbitMQ, Keystone"
}
case "Placement":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, Memcached, Keystone"
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) {
reqs = "Galera, Memcached, Keystone"
}
case "Neutron":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, RabbitMQ, Keystone"
reqs = "Galera, RabbitMQ, Keystone"
}
case "Nova":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled && r.Spec.Placement.Enabled && r.Spec.Neutron.Enabled && r.Spec.Glance.Enabled) {
reqs = "MariaDB or Galera, Memcached, RabbitMQ, Keystone, Glance Neutron, Placement"
reqs = "Galera, Memcached, RabbitMQ, Keystone, Glance Neutron, Placement"
}
case "Heat":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, Memcached, RabbitMQ, Keystone"
reqs = "Galera, Memcached, RabbitMQ, Keystone"
}
case "Swift":
if !(r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) {
reqs = "Memcached, Keystone"
}
case "Horizon":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, Memcached, Keystone"
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) {
reqs = "Galera, Memcached, Keystone"
}
case "Barbican":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, Keystone"
if !((r.Spec.Galera.Enabled) && r.Spec.Keystone.Enabled) {
reqs = "Galera, Keystone"
}
case "Octavia":
// TODO(beagles): So far we haven't declared Redis as dependency for Octavia, but we might.
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled && r.Spec.Neutron.Enabled && r.Spec.Glance.Enabled && r.Spec.Nova.Enabled &&
r.Spec.Ovn.Enabled) {
reqs = "MariaDB or Galera, Memcached, RabbitMQ, Keystone, Glance, Neutron, Nova, OVN"
reqs = "Galera, Memcached, RabbitMQ, Keystone, Glance, Neutron, Nova, OVN"
}
}

Expand Down Expand Up @@ -217,12 +217,6 @@ func (r *OpenStackControlPlane) ValidateUpdateServices(old OpenStackControlPlane
func (r *OpenStackControlPlane) ValidateServiceDependencies(basePath *field.Path) field.ErrorList {
var allErrs field.ErrorList

// Temporary check until MariaDB is deprecated
if r.Spec.Mariadb.Enabled && r.Spec.Galera.Enabled {
err := field.Invalid(basePath.Child("mariaDB").Child("enabled"), r.Spec.Mariadb.Enabled, "Mariadb and Galera are mutually exclusive")
allErrs = append(allErrs, err)
}

// Add service dependency validations

if r.Spec.Keystone.Enabled {
Expand Down Expand Up @@ -370,19 +364,6 @@ func (r *OpenStackControlPlane) DefaultServices() {
// Manila
r.Spec.Manila.Template.Default()

// MariaDB
for key, template := range r.Spec.Mariadb.Templates {
if template.StorageClass == "" {
template.StorageClass = r.Spec.StorageClass
}
if template.Secret == "" {
template.Secret = r.Spec.Secret
}
template.Default()
// By-value copy, need to update
r.Spec.Mariadb.Templates[key] = template
}

// Memcached
for key, template := range r.Spec.Memcached.Templates {
template.Default()
Expand Down
23 changes: 0 additions & 23 deletions apis/core/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7613,35 +7613,6 @@ spec:
- rabbitMqClusterName
type: object
type: object
mariadb:
properties:
enabled:
default: true
type: boolean
templates:
additionalProperties:
properties:
adoptionRedirect:
properties:
host:
type: string
type: object
containerImage:
type: string
secret:
type: string
storageClass:
type: string
storageRequest:
type: string
required:
- containerImage
- secret
- storageClass
- storageRequest
type: object
type: object
type: object
memcached:
properties:
enabled:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,6 @@ spec:
path: manila.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Mariadb - Parameters related to the Mariadb service
displayName: Mariadb
path: mariadb
- description: Enabled - Whether MariaDB service should be deployed and managed
displayName: Enabled
path: mariadb.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Templates - Overrides to use when creating the MariaDB databases
displayName: Templates
path: mariadb.templates
- description: Memcached - Parameters related to the Memcached service
displayName: Memcached
path: memcached
Expand Down
12 changes: 0 additions & 12 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,6 @@ rules:
- patch
- update
- watch
- apiGroups:
- mariadb.openstack.org
resources:
- mariadbs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- memcached.openstack.org
resources:
Expand Down
7 changes: 0 additions & 7 deletions config/samples/core_v1beta1_openstackcontrolplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@ spec:
template:
databaseInstance: openstack
secret: osp-secret
mariadb:
templates:
openstack:
storageRequest: 500M
openstack-cell1:
storageRequest: 500M
galera:
enabled: false
templates:
openstack:
storageClass: local-storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
template:
databaseInstance: openstack
secret: osp-secret
mariadb:
galera:
templates:
openstack:
storageRequest: 500M
Expand Down
8 changes: 0 additions & 8 deletions config/samples/core_v1beta1_openstackcontrolplane_galera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ spec:
template:
databaseInstance: openstack
secret: osp-secret
mariadb:
enabled: false
templates:
openstack:
storageRequest: 500M
openstack-cell1:
storageRequest: 500M
galera:
enabled: true
templates:
openstack:
storageRequest: 500M
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ spec:
template:
databaseInstance: openstack
secret: osp-secret
mariadb:
enabled: false
templates:
openstack:
storageRequest: 500M
openstack-cell1:
storageRequest: 500M
galera:
enabled: true
templates:
openstack:
storageRequest: 500M
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,7 @@ spec:
type: LoadBalancer
databaseInstance: openstack
secret: osp-secret
mariadb:
enabled: false
templates:
openstack:
storageRequest: 500M
openstack-cell1:
storageRequest: 500M
galera:
enabled: true
templates:
openstack:
storageRequest: 500M
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,7 @@ spec:
type: LoadBalancer
databaseInstance: openstack
secret: osp-secret
mariadb:
enabled: false
templates:
openstack:
storageRequest: 500M
openstack-cell1:
storageRequest: 500M
galera:
enabled: true
templates:
openstack:
storageRequest: 500M
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ spec:
type: LoadBalancer
databaseInstance: openstack
secret: osp-secret
mariadb:
galera:
templates:
openstack:
storageRequest: 500M
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ spec:
type: LoadBalancer
databaseInstance: openstack
secret: osp-secret
mariadb:
galera:
templates:
openstack:
storageRequest: 500M
Expand Down
Loading

0 comments on commit 8c448f6

Please sign in to comment.