Skip to content

Commit

Permalink
feat: introduce maxscale (#166)
Browse files Browse the repository at this point in the history
* feat: introduce maxscale

With the release of the mariadb operator v0.25.0 maxscale was introduced
to resolve issues with multi-master deployments, enhance scale, and make
better use of nodes in the environment. This change creates the maxscale
resources and converts our standard deployment systems to use maxscale
as the point of ingress.

Specific feature we're interested in

> point to an existing MaxScale instance. Doing this will delegate tasks
  such as primary failover to MaxScale.

Docs: https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/MAXSCALE.md
Related: https://github.com/mariadb-operator/mariadb-operator/releases/tag/v0.0.26
Signed-off-by: Kevin Carter <[email protected]>

* fix: add annotations to reserve resources

This change resolves issue #165. The change adds the helm annotations
needed to permit helm to retain resouces even in the event of an uninstall.

Resolves: #165
Signed-off-by: Kevin Carter <[email protected]>

---------

Signed-off-by: Kevin Carter <[email protected]>
  • Loading branch information
cloudnull authored Mar 22, 2024
1 parent 1635ade commit 9013dab
Show file tree
Hide file tree
Showing 34 changed files with 297 additions and 38 deletions.
6 changes: 3 additions & 3 deletions docs/infrastructure-mariadb-connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Sometimes an operator may need to connect to the database to troubleshoot things or otherwise make modifications to the databases in place. The following command can be used to connect to the database from a node within the cluster.

``` shell
mysql -h $(kubectl -n openstack get service mariadb-galera-primary -o jsonpath='{.spec.clusterIP}') \
-p$(kubectl --namespace openstack get secret mariadb -o jsonpath='{.data.root-password}' | base64 -d) \
-u root
mysql -h $(kubectl -n openstack get service maxscale-galera -o jsonpath='{.spec.clusterIP}') \
-p$(kubectl --namespace openstack get secret maxscale -o jsonpath='{.data.password}' | base64 -d) \
-u maxscale-galera-client
```

!!! info
Expand Down
16 changes: 16 additions & 0 deletions docs/infrastructure-mariadb.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,19 @@ kubectl --namespace openstack apply -k /opt/genestack/kustomize/mariadb-cluster/
``` shell
kubectl --namespace openstack get mariadbs -w
```

## MaxScale

Within the deployment the OpenStack services use MaxScale for loadlancing and greater reliability. While the MaxScale ecosystem is a good one, there are some limitations that you should be aware of. It is recommended that you review the [MaxScale reference documentation](https://mariadb.com/kb/en/mariadb-maxscale-2302-limitations-and-known-issues-within-mariadb-maxscale) for more about all of the known limitations and potential workarounds available.

``` mermaid
flowchart TD
A[Connection] ---B{MaxScale}
B ---|ro| C[ES-0]
B ---|rw| D[ES-1] ---|sync| E & C
B ---|ro| E[ES-2]
```

### MaxScale GUI

The MaxScale deployment has access to a built in GUI that can be exposed for further debuging and visibility into the performance of the MariDB backend. For more information on accessing the GUI please refer to the MaxScale documentation that can be found [here](https://mariadb.com/resources/blog/getting-started-with-the-mariadb-maxscale-gui).
2 changes: 1 addition & 1 deletion docs/openstack-skyline.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kubectl --namespace openstack \
--from-literal=service-domain="service" \
--from-literal=service-project="service" \
--from-literal=service-project-domain="service" \
--from-literal=db-endpoint="mariadb-galera-primary.openstack.svc.cluster.local" \
--from-literal=db-endpoint="maxscale-galera.openstack.svc.cluster.local" \
--from-literal=db-name="skyline" \
--from-literal=db-username="skyline" \
--from-literal=db-password="$(< /dev/urandom tr -dc _A-Za-z0-9 | head -c${1:-32};echo;)" \
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/cinder/cinder-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ endpoints:
username: cinder
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /cinder
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/glance/glance-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ endpoints:
username: glance
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /glance
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/gnocchi/gnocchi-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ endpoints:
username: gnocchi
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /gnocchi
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/heat/heat-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ endpoints:
username: heat
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /heat
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/horizon/horizon-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7242,7 +7242,7 @@ endpoints:
username: horizon
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /horizon
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/keystone/keystone-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ endpoints:
username: keystone
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /keystone
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/neutron/neutron-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ endpoints:
username: neutron
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /neutron
Expand Down
6 changes: 3 additions & 3 deletions helm-configs/nova/nova-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,7 @@ endpoints:
username: nova
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /nova
Expand All @@ -1657,7 +1657,7 @@ endpoints:
username: nova
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /nova_api
Expand All @@ -1674,7 +1674,7 @@ endpoints:
username: nova
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /nova_cell0
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/octavia/octavia-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ endpoints:
username: octavia
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /octavia
Expand Down
2 changes: 1 addition & 1 deletion helm-configs/placement/placement-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ endpoints:
username: nova
password: password
hosts:
default: mariadb-galera-primary
default: maxscale-galera
host_fqdn_override:
default: null
path: /placement
Expand Down
6 changes: 6 additions & 0 deletions kustomize/cinder/base/cinder-mariadb-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: Database
metadata:
name: cinder
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the database to be created with a different name than the resource name
# name: data-custom
Expand All @@ -18,6 +20,8 @@ kind: User
metadata:
name: cinder
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the user to be created with a different name than the resource name
# name: user-custom
Expand All @@ -36,6 +40,8 @@ kind: Grant
metadata:
name: cinder-grant
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
mariaDbRef:
name: mariadb-galera
Expand Down
8 changes: 8 additions & 0 deletions kustomize/cinder/base/cinder-rabbitmq-queue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: User
metadata:
name: cinder
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
tags:
- management # available tags are 'management', 'policymaker', 'monitoring' and 'administrator'
Expand All @@ -19,6 +21,8 @@ kind: Vhost
metadata:
name: cinder-vhost
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
name: "cinder" # vhost name; required and cannot be updated
defaultQueueType: quorum # default queue type for this vhost; require RabbitMQ version 3.11.12 or above
Expand All @@ -38,6 +42,8 @@ kind: Queue
metadata:
name: cinder-queue
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
name: cinder-qq # name of the queue
vhost: "cinder" # default to '/' if not provided
Expand All @@ -53,6 +59,8 @@ kind: Permission
metadata:
name: cinder-permission
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
vhost: "cinder" # name of a vhost
userReference:
Expand Down
6 changes: 6 additions & 0 deletions kustomize/glance/base/glance-mariadb-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: Database
metadata:
name: glance
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the database to be created with a different name than the resource name
# name: data-custom
Expand All @@ -18,6 +20,8 @@ kind: User
metadata:
name: glance
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the user to be created with a different name than the resource name
# name: user-custom
Expand All @@ -36,6 +40,8 @@ kind: Grant
metadata:
name: glance-grant
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
mariaDbRef:
name: mariadb-galera
Expand Down
8 changes: 8 additions & 0 deletions kustomize/glance/base/glance-rabbitmq-queue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: User
metadata:
name: glance
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
tags:
- management # available tags are 'management', 'policymaker', 'monitoring' and 'administrator'
Expand All @@ -19,6 +21,8 @@ kind: Vhost
metadata:
name: glance-vhost
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
name: "glance" # vhost name; required and cannot be updated
defaultQueueType: quorum # default queue type for this vhost; require RabbitMQ version 3.11.12 or above
Expand All @@ -38,6 +42,8 @@ kind: Queue
metadata:
name: glance-queue
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
name: glance-qq # name of the queue
vhost: "glance" # default to '/' if not provided
Expand All @@ -53,6 +59,8 @@ kind: Permission
metadata:
name: glance-permission
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
vhost: "glance" # name of a vhost
userReference:
Expand Down
14 changes: 11 additions & 3 deletions kustomize/grafana/base/grafana-database.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
apiVersion: mariadb.mmontes.io/v1alpha1
apiVersion: k8s.mariadb.com/v1alpha1
kind: Database
metadata:
name: grafana
namespace: openstack
annotations:
helm.sh/resource-policy: keep
labels:
app.kubernetes.io/managed-by: Helm
spec:
# If you want the database to be created with a different name than the resource name
# name: data-custom
Expand All @@ -13,11 +17,13 @@ spec:
requeueInterval: 30s
retryInterval: 5s
---
apiVersion: mariadb.mmontes.io/v1alpha1
apiVersion: k8s.mariadb.com/v1alpha1
kind: User
metadata:
name: grafana
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the user to be created with a different name than the resource name
# name: user-custom
Expand All @@ -32,11 +38,13 @@ spec:
requeueInterval: 30s
retryInterval: 5s
---
apiVersion: mariadb.mmontes.io/v1alpha1
apiVersion: k8s.mariadb.com/v1alpha1
kind: Grant
metadata:
name: grant
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
mariaDbRef:
name: mariadb-galera
Expand Down
6 changes: 6 additions & 0 deletions kustomize/heat/base/heat-mariadb-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: Database
metadata:
name: heat
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the database to be created with a different name than the resource name
# name: data-custom
Expand All @@ -18,6 +20,8 @@ kind: User
metadata:
name: heat
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the user to be created with a different name than the resource name
# name: user-custom
Expand All @@ -36,6 +40,8 @@ kind: Grant
metadata:
name: heat-grant
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
mariaDbRef:
name: mariadb-galera
Expand Down
6 changes: 6 additions & 0 deletions kustomize/horizon/base/horizon-mariadb-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: Database
metadata:
name: horizon
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the database to be created with a different name than the resource name
# name: data-custom
Expand All @@ -18,6 +20,8 @@ kind: User
metadata:
name: horizon
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
# If you want the user to be created with a different name than the resource name
# name: user-custom
Expand All @@ -36,6 +40,8 @@ kind: Grant
metadata:
name: horizon-grant
namespace: openstack
annotations:
helm.sh/resource-policy: keep
spec:
mariaDbRef:
name: mariadb-galera
Expand Down
Loading

0 comments on commit 9013dab

Please sign in to comment.