encryption/controllers/kms_preflight_controller: read EncryptionKMSPreflightRequired condition and compare config hash#2322
Conversation
…eflightRequired condition and compare config hash
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesKMS Preflight Hash Protocol
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: p0lyn0mial The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| return "", fmt.Errorf("failed to get apiserver config: %w", err) | ||
| } | ||
|
|
||
| providerCfg, err := newKMSProviderConfig(apiServer.Spec.Encryption.KMS) |
There was a problem hiding this comment.
@tjungblu we have accessed providerCfg. This can be used for encryption-config.
There was a problem hiding this comment.
maybe @p0lyn0mial can make up his mind on what he wants to pass down to the Deployer. I'll take whatever works.
There was a problem hiding this comment.
not sure if i understand your comment.
| // picks up the config change (via apiServerInformer), which triggers us through | ||
| // operatorClient.Informer(). The minute-based resync is a backstop. | ||
| if currentHash != requiredHash { | ||
| klog.V(4).Infof("KMS config hash changed: required=%s, current=%s; waiting for the key-controller to post an updated condition", requiredHash, currentHash) |
There was a problem hiding this comment.
It might make sense adding a TODO about we should cleanup the running pods. They are obsolete now.
|
@p0lyn0mial: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
|
|
||
| func (c *kmsPreflightController) runPreflightChecks(ctx context.Context) error { | ||
| return fmt.Errorf("implement me") | ||
| requiredHash, err := c.preflightRequired(ctx) |
There was a problem hiding this comment.
don't you need to pass the config along that matches this hash here? the deployer can't deploy from the hash itself
| // picks up the config change (via apiServerInformer), which triggers us through | ||
| // operatorClient.Informer(). The minute-based resync is a backstop. | ||
| if currentHash != requiredHash { | ||
| klog.V(4).Infof("KMS config hash changed: required=%s, current=%s; waiting for the key-controller to post an updated condition", requiredHash, currentHash) |
There was a problem hiding this comment.
can we record an event for this?
|
|
||
| // preflightRequired returns the config hash that needs preflight validation, | ||
| // or an empty string when no preflight is needed. | ||
| func (c *kmsPreflightController) preflightRequired(ctx context.Context) (string, error) { |
There was a problem hiding this comment.
this reads like it will return a bool, requiredPreflightHash maybe?
depends on whether you intend to return the config along
There was a problem hiding this comment.
I think our plan for the first iteration was to "just" deploy the preflight pod. The next iteration will focus on wiring the configuration.
| // or an empty string when no preflight is needed. | ||
| func (c *kmsPreflightController) preflightRequired(ctx context.Context) (string, error) { | ||
| _, operatorStatus, _, err := c.operatorClient.GetOperatorState() | ||
| if err != nil { |
There was a problem hiding this comment.
you mention
which triggers this controller ... via the operatorClient informer.
earlier, why use a live client here?
Summary by CodeRabbit
Bug Fixes
Tests