Skip to content

Conversation

@halkeye
Copy link
Contributor

@halkeye halkeye commented Aug 18, 2025

scenario: Wanting to create a secret that has logging enable uri, but don't want to hard code connection uris in the template string

So something like

DB_LOGGING_URL: postgresql://{{.Role}}:{{.Password}}@{{.Host}}/{{.Database}}?{{ "logging=true" | mergeUriArgs }}

halkeye added a commit to halkeye/home-k8s that referenced this pull request Aug 18, 2025
@pcallewaert pcallewaert force-pushed the halkeye/add-uri-params-in-templates branch from f781e77 to 8ade555 Compare August 19, 2025 11:42
@halkeye
Copy link
Contributor Author

halkeye commented Aug 19, 2025

did you just merge/rebase? or did you change something I missed?

@pcallewaert
Copy link
Contributor

I only did a rebase, the PR looks good on first sight, but I need to free some time to review it properly

@pcallewaert pcallewaert requested a review from Copilot August 21, 2025 11:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds the ability to dynamically add URI arguments to secret templates without hardcoding connection URIs in the template strings. It introduces a new mergeUriArgs template function that allows merging URI arguments from both the template and the Postgres configuration.

  • Added UriArgs field to the TemplateContext struct and corresponding pgUriArgs field to the controller
  • Implemented a mergeUriArgs template function that merges URI query parameters
  • Added comprehensive test coverage for the new functionality with various merge scenarios

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pkg/utils/template.go Implements the mergeUriArgs template function and adds UriArgs to the template context
internal/controller/postgresuser_controller.go Integrates URI args configuration into the controller and adds URI_ARGS to generated secrets
internal/controller/postgresuser_controller_test.go Adds comprehensive test cases for the new URI args merging functionality
README.md Documents the new URI_ARGS secret field and mergeUriArgs template function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

Looks good, thank you!

@pcallewaert pcallewaert merged commit 49b0461 into movetokube:master Aug 21, 2025
3 checks passed
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.

2 participants