Skip to content

Conversation

@zzzeek
Copy link
Contributor

@zzzeek zzzeek commented Jul 1, 2025

introduce a new class of MariaDBAccount called a "system"
MariaDBAccount, indicated by a new enumerated field AccountType
on the CR. Such accounts link directly to a Galera instance
and have no dependency on a MariaDBDatabase CR.

The expected targets for "system" accounts will include the
Galera/mysql root username and password, as well as a system
account used by mariadbbackup for SST.

Refactor mariadbaccount_controller to isolate logic used for
acquiring MariaDBDatabase and Galera CRs into separate functions,
and ensure all MariaDBDatabase logic takes place only for "user"
accounts (which would be all current MariaDBAccount CRs).

Also correct an oversight where MariaDBAccount would not unconditionally
apply a finalizer to its Secret object. This logic now takes place
in addition to an unconditional removal of the finalizer when the
MariaDBAccount object is deleted.

A subsequent change will allow system-level passwords to be changed
in place by applying the secret name to two separate fields
MariaDBAccount/Spec/Secret and MariaDBAccount/Status/Secret. When
these two names differ it will indicate an in-place password change
should take place.

@openshift-ci openshift-ci bot requested review from dprince and stuggi July 1, 2025 13:10
@zzzeek zzzeek changed the title mariadbaccount system accounts mariadbaccount system accounts (PR 4 of 6) Jul 1, 2025
@zzzeek zzzeek requested a review from dciabrin July 1, 2025 13:23
@zzzeek zzzeek force-pushed the OSPRH-14916-pr4 branch 2 times, most recently from 074a092 to ab01f3f Compare July 4, 2025 01:01
@zzzeek zzzeek force-pushed the OSPRH-14916-pr4 branch 2 times, most recently from 7eb7a65 to 6fdbd46 Compare August 18, 2025 19:22
@zzzeek zzzeek force-pushed the OSPRH-14916-pr4 branch 7 times, most recently from 8697ffc to 32c7c7b Compare October 12, 2025 21:59
@zzzeek
Copy link
Contributor Author

zzzeek commented Oct 12, 2025

/retest

1 similar comment
@zzzeek
Copy link
Contributor Author

zzzeek commented Oct 13, 2025

/retest

@zzzeek
Copy link
Contributor Author

zzzeek commented Nov 4, 2025

/retest

Copy link
Contributor

@dciabrin dciabrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to understand how the deletion of a MariaDBAccount of type System would work if we plan to create one for the root database user. Right now I have the feeling we should have a safeguard mechanism to prevent deleting root.

Also, could you please rewrite the new KUTTL test into a Chainsaw test? I'm trying to get rid of all remaining KUTTL tests before disabling that CI test in prow to free up some CI resource.

@zzzeek
Copy link
Contributor Author

zzzeek commented Nov 6, 2025

re: deletion of the root user, the root MariaDBAccount in PR 6 the GaleraSpec gets a field that refers directly to the name of the MariaDBAccount used for root, and like all services that use MariaDBAccount, a finalizer gets associated with it which in this case is from the Galera instance. Galera creates its MariaDBAccount using the same mechanism / function that all the other services use right now to create their MariaDBAccounts.

@zzzeek
Copy link
Contributor Author

zzzeek commented Nov 6, 2025

if we are nervous about mistakes (because it's near impossible to recover root from mysql) we can add an additional explicit check in the mariadb controller that tests "this is not the account that Galera has". would have to be careful that doesnt mess up deletion scenarios

@zzzeek
Copy link
Contributor Author

zzzeek commented Nov 8, 2025

All the changes are made here and seems to be passing

introduce a new class of MariaDBAccount called a "system"
MariaDBAccount, indicated by a new enumerated field AccountType
on the CR.  Such accounts link directly to a Galera instance
and have no dependency on a MariaDBDatabase CR.

The expected targets for "system" accounts will include the
Galera/mysql root username and password, as well as a system
account used by mariadbbackup for SST.

Refactor mariadbaccount_controller to isolate logic used for
acquiring MariaDBDatabase and Galera CRs into separate functions,
and ensure all MariaDBDatabase logic takes place only for "user"
accounts (which would be all current MariaDBAccount CRs).

Also correct an oversight where MariaDBAccount would not unconditionally
apply a finalizer to its Secret object.   This logic now takes place
in addition to an unconditional removal of the finalizer when the
MariaDBAccount object is deleted.

A subsequent change will allow system-level passwords to be changed
in place by applying the secret name to two separate fields
MariaDBAccount/Spec/Secret and MariaDBAccount/Status/Secret.  When
these two names differ it will indicate an in-place password change
should take place.
@dciabrin
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 18, 2025
@lmiccini
Copy link

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lmiccini, zzzeek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dciabrin
Copy link
Contributor

/test mariadb-operator-build-deploy-kuttl

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 18, 2025

@zzzeek: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/mariadb-operator-build-deploy-kuttl e72f0dc link true /test mariadb-operator-build-deploy-kuttl

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@zzzeek
Copy link
Contributor Author

zzzeek commented Nov 18, 2025

/recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants