Skip to content

Conversation

@pcallewaert
Copy link
Contributor

@pcallewaert pcallewaert commented Apr 30, 2021

Hi all, I'm back with an Azure fix, this time it's related with the dropOnDelete option of a Postgres object. (Didn't use it until this week)

In Azure Database for PostgreSQL servers the username has the format <user@servername>
This username is also passed to the DropRole as the newOwner, which is not a valid user for postgres.

This is a copy of the DropRole base method, but the user for newOwner is fixed with the GetRoleForLogin method.

Setting this as draft until I have tested this more on our cluster. Tested and works now!

@pcallewaert pcallewaert marked this pull request as ready for review May 3, 2021 07:31
Copy link

@arnarg arnarg left a comment

Choose a reason for hiding this comment

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

Wouldn't this also work? This has much less code duplication

func (azpg *azurepg) DropRole(role, newOwner, database string, logger logr.Logger) error {
    azNewOwner := azpg.GetRoleForLogin(newOwner)
    return azpg.pg.DropRole(role, azNewOwner, database, logger)
}

Copy link

@arnarg arnarg left a comment

Choose a reason for hiding this comment

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

LGTM. But I want to wait for @hitman99 to review this.

Copy link
Member

@hitman99 hitman99 left a comment

Choose a reason for hiding this comment

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

LGTM!

@hitman99 hitman99 merged commit 9cad050 into movetokube:master Jun 1, 2021
@hitman99
Copy link
Member

hitman99 commented Jun 1, 2021

Release: https://github.com/movetokube/postgres-operator/releases/tag/0.4.4

@pcallewaert pcallewaert deleted the fix/azure-drop-role branch June 8, 2021 07:15
arni-wxnc added a commit to wuxi-nextcode/postgres-operator that referenced this pull request Sep 16, 2021
* Added host and database_name to Kubernetes secret

* Fixed indentation

* WIP: operator-sdk update from v0.14.0 to v0.17.1 (movetokube#55)

* operator-sdk update from v0.14.0 to v0.15.2

* operator-sdk update from v0.15.2 to v0.16.0

* operator-sdk update from v0.16.0 to v0.17.1

* operator-sdk update from v0.14.0 to v0.17.1 (movetokube#55)

* operator-sdk update from v0.14.0 to v0.15.2

* operator-sdk update from v0.15.2 to v0.16.0

* operator-sdk update from v0.16.0 to v0.17.1

* Override DropRole method for Azure (movetokube#62)

* Override DropRole method for Azure, the newOwner can be an invalid format for postgres

* Refactor

* Create FUNDING.yml

* update readme with contribution notes (movetokube#64)

Co-authored-by: Tomas Adomavicius <tomas.adomavicius@devbridge.com>

* change base image to ubi8 (movetokube#59)

update container base image to ubi8

* use ubuntu-latest instead of ubuntu-16 (movetokube#68)

* add JDBC compliant URI to kubernetes secret (movetokube#69)

* Add generated secret details to README.md

* Add optional annotations (movetokube#66)

Co-authored-by: lemstra.b <lemstra.b@tkppensioen.nl>
Co-authored-by: Tomas <admin@hitman.lt>
Co-authored-by: Tomas <tomas@adomavicius.com>
Co-authored-by: Pieter C <pieter.callewaert@nipro-group.com>
Co-authored-by: Tomas Adomavicius <tomas.adomavicius@devbridge.com>
Co-authored-by: eapri <a@pouli.nl>
Co-authored-by: Steve Boardwell <steve.boardwell@datameer.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants