-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add status field to policy resource #1317
Conversation
docs-web/configuration/global-configuration/reporting-resources-status.md
Outdated
Show resolved
Hide resolved
pkg/client/clientset/versioned/typed/configuration/v1/fake/fake_policy.go
Show resolved
Hide resolved
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.
Just left a couple of comments, but looking great Lorcan.
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.
We need to consider a few more cases related to leader election:
(1) only report the status from the leader. this is needed so that all Ingress Controller pods don't try to report statuses, but only one, to avoid duplicated work/errors related to collisions of updates.
For example, for VS/VSR, before reporting a status, the following check is performed:
if lbc.reportVsVsrStatusEnabled() {
we need to do a similar check for policies.
we can use that function. Better to rename it so it doesn't apply only for VS/VSR. For example, reportCustomResourceStatusEnabled()
(2) when an Ingress Controller pod becomes the leader, it needs to report statuses of the resources it handles. Otherwise, the resources that were processed during the period when there was no elected leader (can happen during upgrades or when the leader pod fails) will not have the status reported.
We already do that for VirtualServer/VirtualServerRoute and Ingresses. See
kubernetes-ingress/internal/k8s/leader.go
Line 51 in 2cdc714
OnStartedLeading: func(ctx context.Context) { |
Proposed changes
This PR adds the status field, with the sub-fields 'state', 'reason' and 'message', to the policy resource.
It also prints out the state of the policy when
kubectl get policy <policy-name>
is ran.Checklist
Before creating a PR, run through this checklist and mark each as complete.