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

feat: add counter prometheus metric from fleet guard rail rejection #918

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Arvindthiru
Copy link
Contributor

@Arvindthiru Arvindthiru commented Sep 25, 2024

Description of your changes

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

image

@@ -57,13 +59,16 @@ func ValidateUserForFleetCRD(req admission.Request, whiteListedUsers []string, g
}

// ValidateUserForResource checks to see if user is allowed to modify argued resource modified by request.
func ValidateUserForResource(req admission.Request, whiteListedUsers []string) admission.Response {
func ValidateUserForResource(req admission.Request, whiteListedUsers []string, isTerminalCall bool) admission.Response {
Copy link
Contributor Author

@Arvindthiru Arvindthiru Sep 25, 2024

Choose a reason for hiding this comment

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

We call this function here https://github.com/Azure/fleet/blob/main/pkg/webhook/fleetresourcehandler/fleetresourcehandler_webhook.go#L151 where we don't reject immediately, we call another function to allow/reject hence added the isTerminalCall variable to enable counting the rejection correctly

@Arvindthiru
Copy link
Contributor Author

Looks like the API Server exposes the rejection count as a prometheus metric by default https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#admission-webhook-metrics

image

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.

1 participant