Skip to content

Commit

Permalink
[ironic][[pxc-db] Add support for PXC galera cluster
Browse files Browse the repository at this point in the history
Add default values for pxc-db chart dependency

Add an explicit dbType option to be able to force the usage of service DB.

Without setting pxc_db.enabled=true this PR causes no change in deployment
  • Loading branch information
s10 committed Jan 30, 2025
1 parent d76cdc7 commit 360fd88
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 29 deletions.
7 changes: 5 additions & 2 deletions openstack/ironic/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ dependencies:
- name: mariadb
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 0.15.3
- name: pxc-db
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 0.2.13
- name: memcached
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 0.6.3
Expand All @@ -23,5 +26,5 @@ dependencies:
- name: linkerd-support
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 1.1.0
digest: sha256:923d38665af49bed9ae82c71af46bdd28692c58f6537c7d9f7e7b5e7ab587a1e
generated: "2025-01-15T10:55:29.950058+02:00"
digest: sha256:4f8b37f96a876826beb37c2a0c4f8d7ebade6c8910800a3b501dadbf454e5d98
generated: "2025-01-29T17:51:43.459114+02:00"
7 changes: 6 additions & 1 deletion openstack/ironic/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ apiVersion: v2
description: A Helm chart for Kubernetes
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Ironic/OpenStack_Project_Ironic_vertical.png
name: ironic
version: 0.1.8
version: 0.2.0
dependencies:
- condition: mariadb.enabled
name: mariadb
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: ~0.15.3
- condition: pxc_db.enabled
name: pxc-db
alias: pxc_db
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: ~0.2.13
- name: memcached
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: ~0.6.3
Expand Down
28 changes: 28 additions & 0 deletions openstack/ironic/ci/test-values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
global:
registry: keppel.regionOne.cloud
registryAlternateRegion: other.docker.registry
dockerHubMirrorAlternateRegion: myRegistry/dockerhubalternate
master_password: topSecret
dbPassword: secret
Expand Down Expand Up @@ -29,6 +31,32 @@ console:
secret: another-secret
ssl_dhparam: again-a-secret

pxc_db:
enabled: true
users:
ironic:
password: topSecret!
ironic_inspector:
password: topSecret!
system_users:
root:
password: topSecret!
xtrabackup:
password: topSecret!
monitor:
password: topSecret!
proxyadmin:
password: topSecret!
operator:
password: topSecret!
replication:
password: topSecret!
backup:
s3:
secrets:
aws_access_key_id: topSecret!
aws_secret_access_key: topSecret!

rabbitmq:
users:
default:
Expand Down
12 changes: 12 additions & 0 deletions openstack/ironic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@
{{ $k | quote }}: {{ $v | quote }}
{{- end }}
{{- end }}

{{- define "ironic.service_dependencies" }}
{{- include "ironic.db_service" . }},{{ include "ironic.rabbitmq_service" . -}}
{{- end }}

{{- define "ironic.db_service" }}
{{- include "utils.db_host" . }}
{{- end }}

{{- define "ironic.rabbitmq_service" -}}
ironic-rabbitmq
{{- end }}
2 changes: 1 addition & 1 deletion openstack/ironic/templates/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
{{ tuple . "ironic" "api" | include "kubernetes_pod_anti_affinity" | indent 6 }}
{{- include "utils.proxysql.pod_settings" . | indent 6 }}
initContainers:
{{- tuple . (dict "service" "ironic-mariadb,ironic-rabbitmq") | include "utils.snippets.kubernetes_entrypoint_init_container" | indent 6 }}
{{- tuple . (dict "service" (include "ironic.service_dependencies" . | quote)) | include "utils.snippets.kubernetes_entrypoint_init_container" | indent 6 }}
containers:
- name: ironic-api
image: {{ .Values.global.registry }}/loci-ironic:{{ .Values.imageVersion }}
Expand Down
2 changes: 1 addition & 1 deletion openstack/ironic/templates/db-migration-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
template:
spec:
initContainers:
{{- tuple . (dict "service" "ironic-mariadb") | include "utils.snippets.kubernetes_entrypoint_init_container" | indent 6 }}
{{- tuple . (dict "service" (include "ironic.db_service" . | quote)) | include "utils.snippets.kubernetes_entrypoint_init_container" | indent 6 }}
restartPolicy: OnFailure
containers:
- name: ironic-dbsync
Expand Down
8 changes: 7 additions & 1 deletion openstack/ironic/templates/etc/_inspector_secrets.conf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ username = {{ .Values.global.ironicServiceUser }}
password = {{ required ".Values.global.ironicServicePassword is missing" .Values.global.ironicServicePassword }}

[database]
connection = {{ tuple . .Values.mariadb.users.ironic_inspector.name .Values.mariadb.users.ironic_inspector.name .Values.mariadb.users.ironic_inspector.password | include "db_url_mysql" }}
{{- if eq .Values.dbType "mariadb" }}
connection = {{ tuple . .Values.mariadb.users.ironic_inspector.name .Values.mariadb.users.ironic_inspector.name .Values.mariadb.users.ironic_inspector.password | include "utils._db_url_mariadb" }}
{{- else if eq .Values.dbType "pxc-db" }}
connection = {{ tuple . .Values.pxc_db.users.ironic_inspector.name .Values.pxc_db.users.ironic_inspector.name .Values.pxc_db.users.ironic_inspector.password | include "utils._db_url_pxc_db" }}
{{- else }}
{{ fail "Unknown database type" }}
{{- end }}

[keystone_authtoken]
username = {{ .Values.global.ironicServiceUser }}
Expand Down
2 changes: 1 addition & 1 deletion openstack/ironic/templates/etc/_secrets.conf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- include "ini_sections.oslo_messaging_rabbit" .}}

[database]
connection = {{ include "db_url_mysql" . }}
connection = {{ include "utils.db_url" . }}

[keystone_authtoken]
username = {{ .Values.global.ironicServiceUser }}
Expand Down
2 changes: 1 addition & 1 deletion openstack/ironic/templates/inspector-db-migration-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
spec:
restartPolicy: OnFailure
initContainers:
{{- tuple . (dict "service" "ironic-mariadb") | include "utils.snippets.kubernetes_entrypoint_init_container" | indent 6 }}
{{- tuple . (dict "service" (include "ironic.db_service" . | quote)) | include "utils.snippets.kubernetes_entrypoint_init_container" | indent 6 }}
containers:
- name: dbsync
image: {{ .Values.global.registry }}/loci-ironic:{{ .Values.imageVersion }}
Expand Down
75 changes: 54 additions & 21 deletions openstack/ironic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ mysql_metrics:
- "name"
- "provision_state"
query: |
SELECT
uuid,
name,
SELECT
uuid,
name,
provision_state,
COUNT(*) AS in_24hrs_gauge
FROM nodes
WHERE updated_at >= NOW() - INTERVAL 1 DAY
FROM nodes
WHERE updated_at >= NOW() - INTERVAL 1 DAY
GROUP BY uuid, provision_state, name;
values:
- "in_24hrs_gauge"
Expand All @@ -292,10 +292,10 @@ mysql_metrics:
values:
- "node_not_in_maint"
query: |
SELECT
COUNT(case when maintenance = 0 then 1 end) AS node_not_in_maint,
uuid,
name,
SELECT
COUNT(case when maintenance = 0 then 1 end) AS node_not_in_maint,
uuid,
name,
COALESCE(maintenance_reason,'reason unknown') AS maintenance_reason
FROM nodes
GROUP BY
Expand All @@ -311,10 +311,10 @@ mysql_metrics:
values:
- "node_in_maint"
query: |
SELECT
COUNT(case when maintenance = 1 then 1 end) AS node_in_maint,
uuid,
name,
SELECT
COUNT(case when maintenance = 1 then 1 end) AS node_in_maint,
uuid,
name,
COALESCE(maintenance_reason,'reason unknown') AS maintenance_reason
FROM nodes
GROUP BY
Expand All @@ -328,22 +328,24 @@ mysql_metrics:
- "name"
- "conductor_group"
query: |
SELECT
uuid,
name,
SELECT
uuid,
name,
conductor_group,
COUNT(conductor_group) AS groups
FROM nodes
GROUP BY
name,
uuid,
GROUP BY
name,
uuid,
conductor_group;
values:
- "groups"

proxysql:
mode: ""

dbType: "mariadb"

mariadb:
enabled: true
name: ironic
Expand Down Expand Up @@ -373,14 +375,45 @@ mariadb:
verify_tables:
- ironic.nodes
- ironic_inspector.nodes

root_password: "AHardPa55w0rd!"
root_password: null
initdb_secret: true
ccroot_user:
enabled: true
persistence_claim:
name: db-ironic-pvclaim

pxc_db:
alerts:
support_group: foundation
enabled: false
name: ironic
initdb_job: true
ccroot_user:
enabled: true
databases:
- ironic
- ironic_inspector
users:
ironic:
name: ironic
grants:
- "ALL PRIVILEGES on ironic.*"
ironic_inspector:
name: ironic_inspector
grants:
- "ALL PRIVILEGES on ironic_inspector.*"
pxc:
persistence:
size: 10Gi
backup:
enabled: true
s3:
secrets:
aws_access_key_id: null
aws_secret_access_key: null
pitr:
enabled: true

dbName: ironic
#dbPassword: null
max_pool_size: 1
Expand Down

0 comments on commit 360fd88

Please sign in to comment.