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

K8SPG-712: Allow overriding default configurations #1108

Merged
merged 7 commits into from
Apr 7, 2025
Merged

K8SPG-712: Allow overriding default configurations #1108

merged 7 commits into from
Apr 7, 2025

Conversation

egegunes
Copy link
Contributor

@egegunes egegunes commented Mar 26, 2025

K8SPG-712 Powered by Pull Request Badge

CHANGE DESCRIPTION

Our support team wants to have the ability to change all Patroni configuration options. For this we're introducing an annotation (pgv2.percona.com/override-config) that if a ConfigMap has it, operator won't reconcile the ConfigMap. So you can annotate the ConfigMap and change any values in it. Beware that there's a sync period (~1m) after changing the ConfigMap and your changes to be reflected to file mounted to the container.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

@egegunes egegunes added this to the 2.7.0 milestone Mar 31, 2025
@egegunes egegunes marked this pull request as ready for review April 2, 2025 14:30
hors
hors previously approved these changes Apr 3, 2025
"# Generated by postgres-operator. DO NOT EDIT.\n" +
"# Your changes will not be saved.\n"
"# Generated by postgres-operator. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING.\n" +
"# If you want to override the config, annotate this ConfigMap with " + naming.OverrideConfigAnnotation + "=true\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

😂 🎻

Comment on lines +73 to +77
// OverrideConfigAnnotation is an annotation used to prevent the controller from reconciling
// ConfigMaps when a user wants to manually override their contents. When this annotation
// is present, the controller will not update the ConfigMap, allowing users to make custom
// modifications that won't be overwritten during reconciliation.
OverrideConfigAnnotation = perconaAnnotationPrefix + "override-config"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we mention the ticket here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -504,9 +507,22 @@ func (r *Reconciler) SetupWithManager(mgr manager.Manager) error {
}
}

// K8SPG-712: Allow overriding default configurations
configMapPredicate := builder.WithPredicates(predicate.Funcs{
Copy link
Contributor

@gkech gkech Apr 4, 2025

Choose a reason for hiding this comment

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

Maybe we can cover this in our controller tests if it is not a major change for the controller_test.go file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gkech
gkech previously approved these changes Apr 4, 2025
@hors hors self-requested a review April 6, 2025 09:41
Copy link
Collaborator

@hors hors left a comment

Choose a reason for hiding this comment

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

@egegunes please check unit tests

@hors hors self-requested a review April 7, 2025 08:12
@hors hors merged commit 9d8b028 into main Apr 7, 2025
17 of 18 checks passed
@hors hors deleted the K8SPG-712 branch April 7, 2025 08:22
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