Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates and mariadb related fixes #245

Closed
wants to merge 3 commits into from

Conversation

weinimo
Copy link
Collaborator

@weinimo weinimo commented Feb 19, 2024

Used openstack-k8s-operators/designate-operator#147 as a template.

Depends-On: install_yamls#742

Copy link
Contributor

openshift-ci bot commented Feb 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: weinimo

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

@weinimo
Copy link
Collaborator Author

weinimo commented Feb 19, 2024

/retest

go.mod Outdated Show resolved Hide resolved
@weinimo weinimo force-pushed the mariadb-bump branch 6 times, most recently from 52f6471 to 718da2e Compare February 20, 2024 13:59
@weinimo weinimo mentioned this pull request Feb 20, 2024
controllers/octavia_controller.go Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@weinimo weinimo changed the title Bump mariadb-operator version Updates and mariadb related fixes Feb 21, 2024
@@ -83,7 +83,7 @@ func DbSyncJob(
initContainerDetails := APIDetails{
ContainerImage: instance.Spec.OctaviaAPI.ContainerImage,
DatabaseHost: instance.Status.DatabaseHostname,
DatabaseUser: instance.Spec.DatabaseUser,
DatabaseAccount: instance.Spec.DatabaseAccount,
Copy link
Contributor

Choose a reason for hiding this comment

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

this part is going to have to change more. The prior use of DatabaseUser was also not appropriate here as this forms part of the job hash. it means as the username changes, the hash of the dbsync job changes and it will keep running again. This hash should only be based on the database name, not the username.

Yesterday I figured all this out and made these changes for designate and heat; the database account / secret has to be put into the configmaps, which also ideally needs to be a secret, not a configmap.

see the designate / heat PRs for how I changed the job hash for dbsync and others to not use account:
openstack-k8s-operators/designate-operator#156 openstack-k8s-operators/heat-operator#322

these also change from configmap to secret, based on guidance in this doc: https://github.com/openstack-k8s-operators/docs/blob/main/service_config.md#proposed-approach

I took a look at the keystone-operator to see what APIs they use to use a Secret for the config

Copy link
Contributor

Choose a reason for hiding this comment

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

This comment was marked as resolved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I also replaced ConfigMapVolumeSource with SecretVolumeSource. I see in the Designate PR that you removed DBPasswordSelector as well, so I removed it here too.

@weinimo
Copy link
Collaborator Author

weinimo commented Feb 21, 2024

Current error:
E0221 14:33:23.689026 1 reflector.go:147] go/pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1beta1.MariaDBAccount: failed to list *v1beta1.MariaDBAccount: mariadbaccounts.mariadb.openstack.org is forbidden: User "system:serviceaccount:openstack-operators:octavia-operator-controller-manager" cannot list resource "mariadbaccounts" in API group "mariadb.openstack.org" at the cluster scope

See https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openstack-k8s-operators_octavia-operator/245/pull-ci-openstack-k8s-operators-octavia-operator-main-octavia-operator-build-deploy-kuttl/1760298908078051328/artifacts/octavia-operator-build-deploy-kuttl/openstack-k8s-operators-gather/artifacts/must-gather/quay-io-openstack-k8s-operators-openstack-must-gather-sha256-f745587ef185f9023b8c83c4d40a4e1c7478de462a91dc6280e5277545650bbe/namespaces/openstack-operators/pods/octavia-operator-controller-manager-d789d9578-kt2wv/logs/manager.log

@zzzeek
Copy link
Contributor

zzzeek commented Feb 21, 2024

Current error: E0221 14:33:23.689026 1 reflector.go:147] go/pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1beta1.MariaDBAccount: failed to list *v1beta1.MariaDBAccount: mariadbaccounts.mariadb.openstack.org is forbidden: User "system:serviceaccount:openstack-operators:octavia-operator-controller-manager" cannot list resource "mariadbaccounts" in API group "mariadb.openstack.org" at the cluster scope

See https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openstack-k8s-operators_octavia-operator/245/pull-ci-openstack-k8s-operators-octavia-operator-main-octavia-operator-build-deploy-kuttl/1760298908078051328/artifacts/octavia-operator-build-deploy-kuttl/openstack-k8s-operators-gather/artifacts/must-gather/quay-io-openstack-k8s-operators-openstack-must-gather-sha256-f745587ef185f9023b8c83c4d40a4e1c7478de462a91dc6280e5277545650bbe/namespaces/openstack-operators/pods/octavia-operator-controller-manager-d789d9578-kt2wv/logs/manager.log

add a role directive on top of the controller, near the mariadbdatabase one at

// +kubebuilder:rbac:groups=mariadb.openstack.org,resources=mariadbdatabases,verbs=get;list;watch;create;update;patch;delete;

// +kubebuilder:rbac:groups=mariadb.openstack.org,resources=mariadbaccounts,verbs=get;list;watch;create;update;patch;delete

then do a make manifests and you should see new entries in config/rbac/role.yaml

the controller should already have some of these roles...

@weinimo
Copy link
Collaborator Author

weinimo commented Mar 5, 2024

/test all

@weinimo
Copy link
Collaborator Author

weinimo commented Mar 5, 2024

/test all

@weinimo
Copy link
Collaborator Author

weinimo commented Mar 6, 2024

/test octavia-operator-build-deploy-kuttl

1 similar comment
@weinimo
Copy link
Collaborator Author

weinimo commented Mar 6, 2024

/test octavia-operator-build-deploy-kuttl

Copy link
Contributor

@zzzeek zzzeek left a comment

Choose a reason for hiding this comment

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

I've gone through everything we should need to get this ready. There are a few additional steps that could happen here, including reorg for my.cnf file and switch EnsureConfigMaps to EnsureSecret, however I can do these in a followup

api/v1beta1/amphoracontroller_types.go Outdated Show resolved Hide resolved
api/v1beta1/amphoracontroller_types.go Outdated Show resolved Hide resolved
api/v1beta1/octavia_types.go Outdated Show resolved Hide resolved
api/v1beta1/octaviaapi_types.go Outdated Show resolved Hide resolved
controllers/amphoracontroller_controller.go Show resolved Hide resolved
pkg/octaviaapi/deployment.go Outdated Show resolved Hide resolved
templates/octavia/bin/init.sh Outdated Show resolved Hide resolved
templates/octavia/config/octavia.conf Show resolved Hide resolved
templates/octaviaamphoracontroller/bin/init.sh Outdated Show resolved Hide resolved
templates/octaviaapi/bin/init.sh Show resolved Hide resolved
@weinimo weinimo marked this pull request as ready for review March 11, 2024 11:16
@openshift-ci openshift-ci bot requested review from slawqo and viroel March 11, 2024 11:16
@zzzeek
Copy link
Contributor

zzzeek commented Mar 11, 2024

/retest

@weinimo weinimo requested a review from zzzeek March 12, 2024 09:06
@weinimo
Copy link
Collaborator Author

weinimo commented Mar 12, 2024

kuttl test are currently broken. openstack-k8s-operators/install_yamls#742 should fix it.

@weinimo
Copy link
Collaborator Author

weinimo commented Mar 13, 2024

/retest

weinimo added 2 commits March 13, 2024 09:56
migrate von databaseUsername to databaseAccount and fully use
MariaDBAccount

Use EnsureMariaDBAccount

fix database.connection and more

PR review comments

Remove DBPasswordSelector attribute

Replace ConfigMapVolumeSource

... with SecretVolumeSource
Copy link
Contributor

openshift-ci bot commented Mar 13, 2024

@weinimo: 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/octavia-operator-build-deploy-kuttl ff1f0df link true /test octavia-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/test-infra repository. I understand the commands that are listed here.

@beagles
Copy link
Collaborator

beagles commented Mar 13, 2024

looks like db-sync job is failing

@zzzeek
Copy link
Contributor

zzzeek commented Mar 13, 2024

that usually happens on these PRs because the DB URL is not correct in the conf file.

i can take a look if you want

@weinimo
Copy link
Collaborator Author

weinimo commented Mar 13, 2024

I will be out till 25th of March, so I would appreciate if you could have a look in the meantime. I pushed the changes of this PR to https://github.com/openstack-k8s-operators/octavia-operator/tree/mariadb-bump so that you could push commits there and create a new PR if needed. Thanks.

instance.Spec.DatabaseInstance, // mariadb/galera service to target
octavia.PersistenceDatabaseName, // name used in CREATE DATABASE in mariadb
"octavia-persistence", // CR name for MariaDBDatabase
instance.Spec.DatabaseAccount, // CR name for MariaDBAccount
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, this is the problem, or at least one of them, a MariaDBAccount is only for one MariaDBDatabase. If octavia has two databases, we need two MariaDBAccounts

@weinimo weinimo closed this Mar 14, 2024
@weinimo
Copy link
Collaborator Author

weinimo commented Mar 14, 2024

Superseded by #269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants