Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#221 from dciabrin/galera
Browse files Browse the repository at this point in the history
Allow deploying the control plane with Galera instead of MariaDB
  • Loading branch information
openshift-merge-robot authored Mar 6, 2023
2 parents c49cfd7 + 31c214a commit a1bce3b
Show file tree
Hide file tree
Showing 10 changed files with 441 additions and 6 deletions.
52 changes: 52 additions & 0 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13965,6 +13965,58 @@ spec:
- extraVol
type: object
type: array
galera:
description: Galera - Parameters related to the Galera services
properties:
enabled:
default: true
description: Enabled - Whether Galera services should be deployed
and managed
type: boolean
templates:
additionalProperties:
description: GaleraSpec defines the desired state of Galera
properties:
adoptionRedirect:
description: Adoption configuration
properties:
host:
description: MariaDB host to redirect to (IP or name)
type: string
type: object
containerImage:
default: quay.io/tripleozedcentos9/openstack-mariadb:current-tripleo
description: Name of the galera container image to run
type: string
replicas:
default: 1
description: Size of the galera cluster deployment
enum:
- 1
- 3
format: int32
minimum: 1
type: integer
secret:
description: Name of the secret to look for password keys
type: string
storageClass:
description: Storage class to host the mariadb databases
type: string
storageRequest:
description: Storage size allocated for the mariadb databases
type: string
required:
- containerImage
- replicas
- secret
- storageClass
- storageRequest
type: object
description: Templates - Overrides to use when creating the Galera
databases
type: object
type: object
glance:
description: Glance - Parameters related to the Glance service
properties:
Expand Down
16 changes: 16 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ type OpenStackControlPlaneSpec struct {
// Mariadb - Parameters related to the Mariadb service
Mariadb MariadbSection `json:"mariadb,omitempty"`

// +kubebuilder:validation:Optional
// Galera - Parameters related to the Galera services
Galera GaleraSection `json:"galera,omitempty"`

// +kubebuilder:validation:Optional
// Rabbitmq - Parameters related to the Rabbitmq service
Rabbitmq RabbitmqSection `json:"rabbitmq,omitempty"`
Expand Down Expand Up @@ -162,6 +166,18 @@ type MariadbSection struct {
Templates map[string]mariadbv1.MariaDBSpec `json:"templates,omitempty"`
}

// GaleraSection defines the desired state of Galera services
type GaleraSection struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=true
// Enabled - Whether Galera services should be deployed and managed
Enabled bool `json:"enabled,omitempty"`

// +kubebuilder:validation:Optional
// Templates - Overrides to use when creating the Galera databases
Templates map[string]mariadbv1.GaleraSpec `json:"templates,omitempty"`
}

// RabbitmqSection defines the desired state of RabbitMQ service
type RabbitmqSection struct {
// +kubebuilder:validation:Optional
Expand Down
22 changes: 16 additions & 6 deletions apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,24 @@ func (r *OpenStackControlPlane) ValidateDelete() error {
func (r *OpenStackControlPlane) checkDepsEnabled(name string) bool {
switch name {
case "Keystone":
return r.Spec.Mariadb.Enabled
return (r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled)
case "Glance":
return r.Spec.Mariadb.Enabled && r.Spec.Keystone.Enabled
return (r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) &&
r.Spec.Keystone.Enabled
case "Cinder":
return (r.Spec.Mariadb.Enabled && r.Spec.Rabbitmq.Enabled &&
return ((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) &&
r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled)
case "Placement":
return r.Spec.Mariadb.Enabled && r.Spec.Keystone.Enabled
return (r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) &&
r.Spec.Keystone.Enabled
case "Neutron":
return (r.Spec.Mariadb.Enabled && r.Spec.Rabbitmq.Enabled &&
return ((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) &&
r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled)
case "Nova":
return (r.Spec.Mariadb.Enabled && r.Spec.Rabbitmq.Enabled &&
return ((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) &&
r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled && r.Spec.Placement.Enabled &&
r.Spec.Neutron.Enabled && r.Spec.Glance.Enabled)
}
Expand All @@ -88,6 +93,11 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) bool {
// ValidateServices implements common function for validating services
func (r *OpenStackControlPlane) ValidateServices() error {

// Temporary check until MariaDB is deprecated
if r.Spec.Mariadb.Enabled && r.Spec.Galera.Enabled {
return fmt.Errorf("Mariadb and Galera are mutually exclusive")
}

// Add service dependency validations
errorMsg := "%s service dependencies are not enabled."

Expand Down
23 changes: 23 additions & 0 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.

52 changes: 52 additions & 0 deletions config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13965,6 +13965,58 @@ spec:
- extraVol
type: object
type: array
galera:
description: Galera - Parameters related to the Galera services
properties:
enabled:
default: true
description: Enabled - Whether Galera services should be deployed
and managed
type: boolean
templates:
additionalProperties:
description: GaleraSpec defines the desired state of Galera
properties:
adoptionRedirect:
description: Adoption configuration
properties:
host:
description: MariaDB host to redirect to (IP or name)
type: string
type: object
containerImage:
default: quay.io/tripleozedcentos9/openstack-mariadb:current-tripleo
description: Name of the galera container image to run
type: string
replicas:
default: 1
description: Size of the galera cluster deployment
enum:
- 1
- 3
format: int32
minimum: 1
type: integer
secret:
description: Name of the secret to look for password keys
type: string
storageClass:
description: Storage class to host the mariadb databases
type: string
storageRequest:
description: Storage size allocated for the mariadb databases
type: string
required:
- containerImage
- replicas
- secret
- storageClass
- storageRequest
type: object
description: Templates - Overrides to use when creating the Galera
databases
type: object
type: object
glance:
description: Glance - Parameters related to the Glance service
properties:
Expand Down
12 changes: 12 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- mariadb.openstack.org
resources:
- galeras
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- mariadb.openstack.org
resources:
Expand Down
9 changes: 9 additions & 0 deletions config/samples/core_v1beta1_openstackcontrolplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ spec:
openstack:
containerImage: quay.io/tripleozedcentos9/openstack-mariadb:current-tripleo
storageRequest: 500M
galera:
enabled: false
templates:
openstack:
containerImage: quay.io/tripleozedcentos9/openstack-mariadb:current-tripleo
storageClass: local-storage
storageRequest: 500M
secret: osp-secret
replicas: 1
rabbitmq:
templates:
rabbitmq:
Expand Down
118 changes: 118 additions & 0 deletions config/samples/core_v1beta1_openstackcontrolplane_galera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
apiVersion: core.openstack.org/v1beta1
kind: OpenStackControlPlane
metadata:
name: openstack
spec:
secret: osp-secret
storageClass: local-storage
keystone:
template:
containerImage: quay.io/tripleozedcentos9/openstack-keystone:current-tripleo
databaseInstance: openstack
secret: osp-secret
mariadb:
enabled: false
templates:
openstack:
containerImage: quay.io/tripleozedcentos9/openstack-mariadb:current-tripleo
storageRequest: 500M
galera:
enabled: true
templates:
openstack:
containerImage: quay.io/tripleozedcentos9/openstack-mariadb:current-tripleo
storageClass: local-storage
storageRequest: 500M
secret: osp-secret
replicas: 1
rabbitmq:
templates:
rabbitmq:
replicas: 1
#resources:
# requests:
# cpu: 500m
# memory: 1Gi
# limits:
# cpu: 800m
# memory: 1Gi
rabbitmq-cell1:
replicas: 1
placement:
template:
databaseInstance: openstack
containerImage: quay.io/tripleozedcentos9/openstack-placement-api:current-tripleo
secret: osp-secret
glance:
template:
databaseInstance: openstack
containerImage: quay.io/tripleozedcentos9/openstack-glance-api:current-tripleo
storageClass: ""
storageRequest: 10G
glanceAPIInternal:
containerImage: quay.io/tripleozedcentos9/openstack-glance-api:current-tripleo
glanceAPIExternal:
containerImage: quay.io/tripleozedcentos9/openstack-glance-api:current-tripleo
cinder:
template:
cinderAPI:
replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-cinder-api:current-tripleo
cinderScheduler:
replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-cinder-scheduler:current-tripleo
cinderBackup:
replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-cinder-backup:current-tripleo
cinderVolumes:
volume1:
containerImage: quay.io/tripleozedcentos9/openstack-cinder-volume:current-tripleo
replicas: 1
ovn:
template:
ovnDBCluster:
ovndbcluster-nb:
replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-ovn-nb-db-server:current-tripleo
dbType: NB
storageRequest: 10G
ovndbcluster-sb:
replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-ovn-sb-db-server:current-tripleo
dbType: SB
storageRequest: 10G
ovnNorthd:
replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-ovn-northd:current-tripleo
ovs:
template:
ovsContainerImage: "quay.io/skaplons/ovs:latest"
ovnContainerImage: "quay.io/tripleozedcentos9/openstack-ovn-controller:current-tripleo"
external-ids:
system-id: "random"
ovn-bridge: "br-int"
ovn-encap-type: "geneve"
neutron:
template:
databaseInstance: openstack
containerImage: quay.io/tripleozedcentos9/openstack-neutron-server:current-tripleo
secret: osp-secret
nova:
template:
secret: osp-secret
ironic:
template:
databaseInstance: openstack
ironicAPI:
replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-ironic-api:current-tripleo
ironicConductors:
- replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-ironic-conductor:current-tripleo
pxeContainerImage: quay.io/tripleozedcentos9/openstack-ironic-pxe:current-tripleo
storageRequest: 10G
ironicInspector:
replicas: 1
containerImage: quay.io/tripleozedcentos9/openstack-ironic-inspector:current-tripleo
pxeContainerImage: quay.io/tripleozedcentos9/openstack-ironic-pxe:current-tripleo
secret: osp-secret
Loading

0 comments on commit a1bce3b

Please sign in to comment.