-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds the new value enableMultiMaster to the Galera CR defaulting to false; when set to true, the "statefulset.kubernetes.io/pod-name" key is removed from the mariadb service spec, and when set to false it is restored. This has the effect of publishing the service either under one specific pod for active/passive use, or using any pod for any request which is multi-master use. the value of the attribute is also propigated out to the status within the MariaDBDatabase CR, which is then consumable by openstack services in a similar manner as the TLS settings. Openstack services will then want to set wsrep_sync_wait accordingly for AP or MM mode, which will be proposed in followup changes. Fixes: OSPRH-7406
- Loading branch information
Showing
15 changed files
with
285 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/kuttl/tests/galera_multi_master/01-deploy_ap_galera.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: Galera | ||
metadata: | ||
name: openstack | ||
spec: | ||
secret: osp-secret | ||
storageClass: local-storage | ||
storageRequest: 500M | ||
replicas: 3 | ||
enableMultiMaster: false | ||
--- | ||
apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: MariaDBDatabase | ||
metadata: | ||
name: mydatabase | ||
labels: | ||
dbName: openstack | ||
spec: | ||
name: mydatabase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# | ||
# Check for: | ||
# | ||
# - 1 MariaDB CR | ||
# - 1 Pod for MariaDB CR | ||
# | ||
|
||
apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: Galera | ||
metadata: | ||
name: openstack | ||
spec: | ||
replicas: 3 | ||
secret: osp-secret | ||
storageRequest: 500M | ||
status: | ||
bootstrapped: true | ||
conditions: | ||
- message: Setup complete | ||
reason: Ready | ||
status: "True" | ||
type: Ready | ||
- message: Deployment completed | ||
reason: Ready | ||
status: "True" | ||
type: DeploymentReady | ||
- message: Exposing service completed | ||
reason: Ready | ||
status: "True" | ||
type: ExposeServiceReady | ||
- message: Input data complete | ||
reason: Ready | ||
status: "True" | ||
type: InputReady | ||
- message: RoleBinding created | ||
reason: Ready | ||
status: "True" | ||
type: RoleBindingReady | ||
- message: Role created | ||
reason: Ready | ||
status: "True" | ||
type: RoleReady | ||
- message: ServiceAccount created | ||
reason: Ready | ||
status: "True" | ||
type: ServiceAccountReady | ||
- message: Service config create completed | ||
reason: Ready | ||
status: "True" | ||
type: ServiceConfigReady | ||
- message: Input data complete | ||
reason: Ready | ||
status: "True" | ||
type: TLSInputReady | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: openstack-galera | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: galera | ||
cr: galera-openstack | ||
galera/name: openstack | ||
serviceName: openstack-galera | ||
template: | ||
metadata: | ||
labels: | ||
app: galera | ||
cr: galera-openstack | ||
galera/name: openstack | ||
spec: | ||
containers: | ||
- command: | ||
- /usr/bin/dumb-init | ||
- -- | ||
- /usr/local/bin/kolla_start | ||
name: galera | ||
ports: | ||
- containerPort: 3306 | ||
name: mysql | ||
protocol: TCP | ||
- containerPort: 4567 | ||
name: galera | ||
protocol: TCP | ||
serviceAccount: galera-openstack | ||
serviceAccountName: galera-openstack | ||
status: | ||
availableReplicas: 3 | ||
readyReplicas: 3 | ||
replicas: 3 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: openstack-galera-0 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: openstack-galera-1 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: openstack-galera-2 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: openstack-galera | ||
spec: | ||
ports: | ||
- name: mysql | ||
port: 3306 | ||
protocol: TCP | ||
targetPort: 3306 | ||
selector: | ||
app: galera | ||
cr: galera-openstack | ||
--- | ||
apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: MariaDBDatabase | ||
metadata: | ||
labels: | ||
dbName: openstack | ||
name: mydatabase | ||
spec: | ||
name: mydatabase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
commands: | ||
- script: | | ||
# ensure kubernetes pod key present | ||
oc get -n ${NAMESPACE} service openstack -o yaml | grep "statefulset.kubernetes.io/pod-name: openstack-galera-" |
10 changes: 10 additions & 0 deletions
10
tests/kuttl/tests/galera_multi_master/04-deploy_mm_galera.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: Galera | ||
metadata: | ||
name: openstack | ||
spec: | ||
secret: osp-secret | ||
storageClass: local-storage | ||
storageRequest: 500M | ||
replicas: 3 | ||
enableMultiMaster: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
commands: | ||
- script: | | ||
# ensure kubernetes pod key *not* present | ||
! oc get -n ${NAMESPACE} service openstack -o yaml | grep "statefulset.kubernetes.io/pod-name: openstack-galera-" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: Galera | ||
metadata: | ||
name: openstack | ||
spec: | ||
replicas: 3 | ||
secret: osp-secret | ||
storageRequest: 500M | ||
enableMultiMaster: true | ||
--- | ||
apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: MariaDBDatabase | ||
metadata: | ||
labels: | ||
dbName: openstack | ||
name: mydatabase | ||
spec: | ||
name: mydatabase | ||
status: | ||
enableMultiMaster: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
delete: | ||
- apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: Galera | ||
name: openstack | ||
- apiVersion: mariadb.openstack.org/v1beta1 | ||
kind: MariaDBDatabase | ||
name: mydatabase | ||
commands: | ||
- script: | | ||
oc delete -n $NAMESPACE pvc mysql-db-openstack-galera-0 mysql-db-openstack-galera-1 mysql-db-openstack-galera-2 | ||
for i in `oc get pv | awk '/mysql-db.*galera/ {print $1}'`; do oc patch pv $i -p '{"spec":{"claimRef": null}}'; done |