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

[EV-5299] Disable Policy Recommendation for Windows OS #3563

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

dimitri-nicolo
Copy link
Contributor

Description

Disable Image Resolution for Windows

  • Policy Recommendations is unsupported until Staged Network Policies are supported in Windows

For PR author

  • Tests for change.
  • If changing pkg/apis/, run make gen-files
  • If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

@@ -430,6 +431,12 @@ func (r *ReconcilePolicyRecommendation) Reconcile(ctx context.Context, request r
return reconcile.Result{}, nil
}

// Render a Policy Recommendation component for Windows if the cluster has Windows nodes.
Copy link
Member

Choose a reason for hiding this comment

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

If I understand it correctly, we cannot have a cluster using policy recommendation and windows nodes at the same time, because windows does not support staged policies.

If that is the case, we should degrade the TigeraStatus immediately if hasWindowsNodes is true. I think we can move this if-statement further up, so we may save some unnecessary calculations, perhaps right underneath the ready checks at line 291.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the check to below line 291.

It isn't used, but I've kept the check in the render to enforce a defensive pattern

return reconcile.Result{}, err
}
if hasWindowsNodes {
r.status.SetDegraded(operatorv1.ResourceValidationError, "Unsupported OS (Windows)", err, logc)
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering if we could make it a bit more descriptive, so they understand well what's going on.

Policy Recommendation is not supported in combination with Windows nodes.

// Render a Policy Recommendation component for Windows if the cluster has Windows nodes.
hasWindowsNodes, err := common.HasWindowsNodes(r.client)
if err != nil {
r.status.SetDegraded(operatorv1.ResourceNotReady, "OS not found", err, logc)
Copy link
Member

@rene-dekker rene-dekker Oct 24, 2024

Choose a reason for hiding this comment

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

Judging by the implementation of HashWindowsNodes, I think it should be a ResourceReadError and perhaps the following message would be better.

Unable to determine if there are Windows nodes.

Copy link
Member

@rene-dekker rene-dekker left a comment

Choose a reason for hiding this comment

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

lgtm

@rene-dekker
Copy link
Member

/merge-when-ready delete-branch

@marvin-tigera
Copy link
Contributor

OK, I will merge the pull request when it's ready, leave the commits as is when I merge it, and delete the branch after I've merged it.

@marvin-tigera
Copy link
Contributor

Removing "merge-when-ready" label due to new commits

@rene-dekker
Copy link
Member

/merge-when-ready

@marvin-tigera
Copy link
Contributor

OK, I will merge the pull request when it's ready, leave the commits as is when I merge it, and leave the branch after I've merged it.

@marvin-tigera
Copy link
Contributor

Removing "merge-when-ready" label due to new commits

@rene-dekker rene-dekker merged commit 2d22f1a into tigera:master Oct 25, 2024
5 checks passed
@dimitri-nicolo dimitri-nicolo deleted the dimitri-EV-5299 branch October 25, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants