-
Notifications
You must be signed in to change notification settings - Fork 511
CNTRLPLANE-3553: Wire osImageStream into NodePool controller (hash, token, status, validation) #8730
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
base: main
Are you sure you want to change the base?
CNTRLPLANE-3553: Wire osImageStream into NodePool controller (hash, token, status, validation) #8730
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -368,6 +368,20 @@ func (r *NodePoolReconciler) validMachineConfigCondition(ctx context.Context, no | |
| return &ctrl.Result{}, nil | ||
| } | ||
|
|
||
| // Validate osImageStream before expensive config generation to fail fast. | ||
| // TODO(CNTRLPLANE-3553): add integration test covering this condition path | ||
| // (invalid osImageStream.Name → ValidMachineConfig condition False + error return). | ||
| if err := validateOSImageStream(nodePool, releaseImage); err != nil { | ||
|
sdminonne marked this conversation as resolved.
|
||
| SetStatusCondition(&nodePool.Status.Conditions, hyperv1.NodePoolCondition{ | ||
| Type: hyperv1.NodePoolValidMachineConfigConditionType, | ||
| Status: corev1.ConditionFalse, | ||
| Reason: hyperv1.NodePoolValidationFailedReason, | ||
| Message: err.Error(), | ||
| ObservedGeneration: nodePool.Generation, | ||
| }) | ||
| return &ctrl.Result{}, fmt.Errorf("failed to validate osImageStream: %w", err) | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This runs after `NewConfigGenerator` succeeds — meaning we do expensive MCO config generation (listing core configs, parsing MachineConfigs) before checking a simple string allowlist. Moving `validateOSImageStream` before the config generation would fail fast for invalid stream names. Not blocking, but worth reordering.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| haproxyRawConfig, err := r.generateHAProxyRawConfig(ctx, nodePool, hcluster, releaseImage) | ||
| if err != nil { | ||
| return &ctrl.Result{}, fmt.Errorf("failed to generate HAProxy raw config: %w", err) | ||
|
|
@@ -385,6 +399,7 @@ func (r *NodePoolReconciler) validMachineConfigCondition(ctx context.Context, no | |
| }) | ||
| return &ctrl.Result{}, fmt.Errorf("failed to generate config: %w", err) | ||
| } | ||
|
|
||
| SetStatusCondition(&nodePool.Status.Conditions, hyperv1.NodePoolCondition{ | ||
| Type: hyperv1.NodePoolValidMachineConfigConditionType, | ||
| Status: corev1.ConditionTrue, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test cases!