Skip to content

✨ Add ConfigMap watching capability to trigger provider upgrades #856

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

PavanNeerudu
Copy link

@PavanNeerudu PavanNeerudu commented Jul 18, 2025

✨ Add ConfigMap watching capability to trigger provider upgrades

What this PR does / why we need it:

This PR adds the ability for cluster-api-operator to watch ConfigMaps and trigger provider upgrades when ConfigMap content changes, even without version bumps. This addresses scenarios where operators need to update provider configurations (like resource limits, concurrency settings, or other operational parameters) through ConfigMaps without requiring a full version upgrade.

Key Changes:

  • Adds --watch-configmap CLI flag to enable ConfigMap watching (default: false for backward compatibility)
  • Implements ConfigMap-to-provider mapping logic to identify which providers are affected by ConfigMap changes
  • Extends the existing hash-based upgrade detection to include ConfigMap content in addition to version changes
  • Uses SHA256 hashing to detect both version and ConfigMap content changes through a unified mechanism
  • Maintains full backward compatibility - existing deployments continue to work unchanged

Use Cases:

  • Updating provider resource limits (CPU/memory) without version changes
  • Modifying concurrency settings for better performance tuning
  • Adjusting operational parameters like API QPS/burst settings
  • Hot-fixing provider configurations in production environments
  • Enabling fine-grained configuration management for GitOps workflows

Technical Implementation:

  • ConfigMap watching is integrated into the existing provider reconciliation loop
  • Hash calculation includes both provider version and associated ConfigMap content
  • When ConfigMap content changes, the hash changes, triggering a provider upgrade
  • Robust error handling and logging for ConfigMap operations
  • Efficient watching mechanism that only processes relevant ConfigMaps

Which issue(s) this PR fixes:
Fixes #795

Testing:

  • Verified ConfigMap content changes trigger provider upgrades correctly
  • Confirmed version changes continue to work as before
  • Tested backward compatibility with existing deployments
  • Validated error handling for missing or invalid ConfigMaps

Copy link

linux-foundation-easycla bot commented Jul 18, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot requested a review from neolit123 July 18, 2025 12:42
@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 18, 2025
@k8s-ci-robot k8s-ci-robot requested a review from timothysc July 18, 2025 12:42
@k8s-ci-robot
Copy link
Contributor

Welcome @PavanNeerudu!

It looks like this is your first PR to kubernetes-sigs/cluster-api-operator 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-operator has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 18, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @PavanNeerudu. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 18, 2025
Copy link

netlify bot commented Jul 18, 2025

Deploy Preview for kubernetes-sigs-cluster-api-operator ready!

Name Link
🔨 Latest commit 6ae2ced
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-cluster-api-operator/deploys/687fad7974268a00080b4f21
😎 Deploy Preview https://deploy-preview-856--kubernetes-sigs-cluster-api-operator.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@PavanNeerudu PavanNeerudu changed the title Add ConfigMap watching capability to trigger provider upgrades ✨ Add ConfigMap watching capability to trigger provider upgrades Jul 18, 2025
@PavanNeerudu PavanNeerudu force-pushed the user/pavanneerudu/addwatches-for-cm branch from 351ae92 to 0869c19 Compare July 18, 2025 13:00
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 18, 2025
@PavanNeerudu
Copy link
Author

Hey @furkatgofurov7 , could you review this PR?

@PavanNeerudu
Copy link
Author

@neolit123, @timothysc , could you please review this PR?

Copy link
Member

@Danil-Grigorev Danil-Grigorev left a comment

Choose a reason for hiding this comment

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

Looks fine to me, only one nit

@Danil-Grigorev
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 22, 2025
- Add comprehensive test coverage for ConfigMap changes
- Fix timing issues with hash annotations
- Add test for multiple ConfigMaps error condition
- Improve controller to reject multiple ConfigMaps per provider
- Add proper ReadyCondition setting in tests
- Replace string literals with testNamespaceName constant
- Reduce complexity in addConfigMapToHash function
- Add blank lines before return statements
- Fix whitespace/cuddling issues per wsl linter
Copy link
Member

@Danil-Grigorev Danil-Grigorev left a comment

Choose a reason for hiding this comment

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

/approve

LGTM, just some lint job failures

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Danil-Grigorev

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 22, 2025
@PavanNeerudu
Copy link
Author

Hey @Danil-Grigorev , could you re-approve this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster-api-operator not updating resources on ConfigMap changes
3 participants