Skip to content

feat: custom secret labels #173

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

Merged
merged 5 commits into from
Apr 28, 2025

Conversation

geekifier
Copy link
Contributor

@geekifier geekifier commented Apr 24, 2025

Description of changes

Support for user-defined labels on secrets generated from the PostgresUser resources

Motivation

labels are commonly used on Kubernetes resources, but currently only an app label is hardcoded by the operator.

Other Changes included in the PR

  • Change e2e test to source the Helm chart install from current workdir instead of the upstream repo
  • Bump the Helm chart version and app version reference
    • App version skips one release since chart was not updated in master for the current release tag (1.3.4).

Notes

I added some very basic tests for the PostgresUser.newSecretForCR function. There were no tests for that file.

It was a huge pain to get the e2e tests working due to the old SDK versions, which cannot be build on Apple silicon. The tests are now passing after I changed the Helm install to use the updated chart/CRDs. I added a basic check for the new label map in the secret (same should be probably done for annotations as well).

I am not a Go dev by any means, so please let me know if anything needs to be worked on.

Edit: Added testing resources in #173 (comment)

@geekifier geekifier changed the title Feat/custom secret labels (wip) feat: custom secret labels Apr 24, 2025
commit dbb7c8d
Author: Kamil Markowicz <kamil@markowicz.net>
Date:   Thu Apr 24 17:06:33 2025 -0400

    fix: fix e2e, add updated CRDs, bump helm chart

    chore: add schema generated by old operator-sdk

    chore: add generated crds

    fix: e2e test logic

    fix: use local chart dir for e2e and not remote repo

    update deploy CRDs and bump Helm chart version

    Signed-off-by: Kamil Markowicz <kamil@markowicz.net>

Signed-off-by: Kamil Markowicz <kamil@markowicz.net>
@geekifier geekifier marked this pull request as ready for review April 25, 2025 02:34
@geekifier geekifier changed the title (wip) feat: custom secret labels feat: custom secret labels Apr 25, 2025
@pcallewaert pcallewaert self-requested a review April 25, 2025 07:06
@pcallewaert pcallewaert added the enhancement New feature or request label Apr 25, 2025
@geekifier
Copy link
Contributor Author

Added testing resources:

Helm Repo: geekifier.github.io/postgres-operator
Docker Image: ghcr.io/geekifier/postgres-operator:1.3.5-test
Updated CRD: https://raw.githubusercontent.com/geekifier/postgres-operator/refs/heads/release/1.3.5-test/deploy/crds/db.movetokube.com_postgresusers_crd.yaml

# Provide following Helm values if using the chart
image:
  repository: ghcr.io/geekifier/postgres-operator
  tag: "1.3.5-test"

In addition to e2e, I tested on my k8s cluster and it worked as intended.

@pcallewaert
Copy link
Contributor

Hey @geekifier, thank you for this PR. This looks great.
I'm aware of the outdated operator-sdk and the missing tests for the postgresuser controller. This is being tackled in #172 that hopefully will be ready in a few days/weeks. In the meanwhile I'll merge this and then I'll port your changes to the new SDK.

Copy link
Contributor

@pcallewaert pcallewaert left a comment

Choose a reason for hiding this comment

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

🙌

@pcallewaert pcallewaert merged commit 2302925 into movetokube:master Apr 28, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants