-
Notifications
You must be signed in to change notification settings - Fork 23
feat: add validating webhook for run-levels #1405
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis PR introduces a validating admission webhook for Securesign CRs by implementing a SecureSignValidator in Go, registering it with controller-runtime, generating and patching Kubernetes webhook and certificate manifests using kustomize overlays, updating the operator deployment to mount TLS secrets, and enhancing CI/test configurations to support and verify the new webhook functionality. Entity relationship diagram for webhook and certificate resourceserDiagram
"ValidatingWebhookConfiguration" ||--o| "Service" : uses
"Service" ||--o| "Certificate" : secured_by
"Certificate" ||--o| "Issuer" : issued_by
"ValidatingWebhookConfiguration" {
string name
string[] admissionReviewVersions
string failurePolicy
string[] rules
string sideEffects
}
"Service" {
string name
string namespace
string[] ports
string selector
}
"Certificate" {
string name
string secretName
string[] dnsNames
string issuerRef
}
"Issuer" {
string name
string kind
}
Class diagram for SecureSignValidator and related typesclassDiagram
class SecureSignValidator {
+client.Client Client
+ValidateCreate(ctx, obj)
+ValidateUpdate(ctx, oldObj, newObj)
+ValidateDelete(ctx, obj)
-validateNamespacePolicy(ctx, operandCR)
}
class Securesign {
+GetNamespace()
<<CRD>>
}
SecureSignValidator --> Securesign : validates
SecureSignValidator ..> client.Client : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
341a9d1 to
bc323a6
Compare
|
Do we need a webhook for this? It doesn't look as if the webhook is doing anything too complicated, would CEL not be a better choice? |
Never mind, it looks as if we are still supporting 1.27 until end of October. |
4227c18 to
8ea0160
Compare
32c6830 to
39202ff
Compare
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
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.
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
Signed-off-by: SequeI <[email protected]>
39202ff to
2bdfe35
Compare
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
User description
Summary by Sourcery
Enforce a run-level policy for Securesign CRs by adding a validating webhook, configure its TLS infrastructure across Kubernetes and OpenShift overlays, update the manager deployment to serve the webhook, and expand CI and test suites to install and validate the webhook components.
New Features:
Enhancements:
Build:
CI:
Tests:
PR Type
Enhancement
Description
Implement validating webhook to enforce namespace policies for Securesign CRs
defaultnamespaceRegister webhook in manager and add kubebuilder marker to Securesign CRD
Add webhook service and ValidatingWebhookConfiguration resources with kustomize overlays
Mount webhook TLS certificate in manager deployment and configure cert-manager integration
Add comprehensive unit tests for webhook validation logic
Diagram Walkthrough
File Walkthrough
15 files
Add kubebuilder webhook marker to Securesign CRDCreate webhook kustomization overlay configurationDefine webhook service for HTTPS communicationDefine ValidatingWebhookConfiguration for Securesign CRsMount webhook TLS certificate in manager deploymentEnable webhook overlay in default kustomizationAdd cert-manager Issuer and Certificate resourcesAdd cert-manager annotation patch for webhook configurationConfigure Kubernetes environment with cert-manager resourcesAdd OpenShift serving certificate annotation for webhook serviceAdd OpenShift CA bundle injection annotation for webhookConfigure OpenShift environment patches for webhookInstall cert-manager in KinD cluster for webhook testingAdd retest-all-comment event type to pipeline selectorRemove webhook generation flag from manifests target4 files
Register validating webhook in manager initializationDefine SecureSignValidator with reserved run-levels mapImplement namespace policy validation logic for SecuresignAdd private network ranges to no-proxy configuration2 files
Add comprehensive unit tests for webhook validationAdd webhook infrastructure setup and cert-manager integration to e2etests1 files
Add testify dependency for webhook unit tests