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(webhook): Log all admission requests of CRDs #465

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

uwe-mayer
Copy link
Contributor

Description

This PR adds logging to all CREATE, UPDATE, DELETE operations on Greenhouse CRDs.
This is the first step to fix #415 without having access to api server audit logs.

Example log for DELETE on organization:

2024-08-21T13:53:51+02:00	INFO	AdmissionRequest	{"Request": {"uid":"22a2b441-a966-46e2-aa30-1b39ceb5d6ca","kind":{"group":"greenhouse.sap","version":"v1alpha1","kind":"Organization"},"resource":{"group":"greenhouse.sap","version":"v1alpha1","resource":"organizations"},"requestKind":{"group":"greenhouse.sap","version":"v1alpha1","kind":"Organization"},"requestResource":{"group":"greenhouse.sap","version":"v1alpha1","resource":"organizations"},"name":"test-org","operation":"DELETE","userInfo":{"username":"admin","groups":["system:masters","system:authenticated"]},"object":null,"oldObject":{"apiVersion":"greenhouse.sap/v1alpha1","kind":"Organization","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"greenhouse.sap/v1alpha1\",\"kind\":\"Organization\",\"metadata\":{\"annotations\":{},\"name\":\"test-org\"},\"spec\":{\"description\":\"Test organization\",\"mappedOrgAdminIdPGroup\":\"TEST_ORG_ADMIN\"}}\n"},"creationTimestamp":"2024-08-21T11:53:31Z","generation":1,"managedFields":[{"apiVersion":"greenhouse.sap/v1alpha1","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:description":{},"f:mappedOrgAdminIdPGroup":{}}},"manager":"kubectl-client-side-apply","operation":"Update","time":"2024-08-21T11:53:31Z"}],"name":"test-org","resourceVersion":"270","uid":"f02101f3-16a6-4c9b-85a0-6e08410e3b33"},"spec":{"description":"Test organization","displayName":"test org","mappedOrgAdminIdPGroup":"TEST_ORG_ADMIN"}},"dryRun":false,"options":{"kind":"DeleteOptions","apiVersion":"meta.k8s.io/v1","propagationPolicy":"Background"}}}

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

@uwe-mayer uwe-mayer merged commit 7dbd55f into main Aug 23, 2024
7 checks passed
@uwe-mayer uwe-mayer deleted the feat/issue-415/audit-logs branch August 23, 2024 08:04
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.

[FEAT] - Audit Log forwarding for central cluster audit logs
2 participants