Skip to content

Conversation

@vofish
Copy link
Collaborator

@vofish vofish commented Jan 14, 2026

Add the _WaitForPolicyRelaxation method to ensure policy relaxation takes effect

The constraints for Resource Requests, Probes, and Image Tags are all part of the same "Safeguards" policy initiative and are bundled together in the Azure Policy assignment. Therefore, it is sufficient to check just one constraint. If the cluster update for the "Resource Requests" constraint is applied, the updates for "Probes" and "Image Tag" constraints are also included, as they are processed in the same transaction.

This method works by monitoring the K8sAzureV1ContainerRequests constraint and waiting for its status to switch from deny to dryrun.

Copy link
Collaborator

@hubatish hubatish left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Hopefully this contains the errors to one spot.

[
FLAGS.kubectl,
'--kubeconfig',
FLAGS.kubeconfig,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use RunKubectlCommand rather than specifying FLAGS.kubectl & FLAGS.kubeconfig.

self._RelaxAKSPolicy()
self._GetCredentials(use_admin=False)
self._WaitForDefaultServiceAccount()
self._WaitForPolicyRelaxation()
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this go at the end after _AttachContainerRegistry? Just to save a little time waiting while the latter command runs. Or do you think AttachContainerRegistry can also run into policy errors?

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.

2 participants