Skip to content

Commit

Permalink
Updates validating webhook name to `validation.webhook.manual-approva…
Browse files Browse the repository at this point in the history
…l.openshift-pipelines.org`

Signed-off-by: PuneetPunamiya <[email protected]>
  • Loading branch information
PuneetPunamiya committed Jun 13, 2024
1 parent b59711e commit 4775bda
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func getEnvOrDefault(key, defaultValue string) string {
func main() {
serviceName := getEnvOrDefault("WEBHOOK_SERVICE_NAME", "manual-approval-webhook")
secretName := getEnvOrDefault("WEBHOOK_SECRET_NAME", "manual-approval-gate-webhook-certs")
webhookName := getEnvOrDefault("WEBHOOK_ADMISSION_CONTROLLER_NAME", "webhook.manual.approval.dev")
webhookName := getEnvOrDefault("WEBHOOK_ADMISSION_CONTROLLER_NAME", "validation.webhook.manual-approval.openshift-pipelines.org")

systemNamespace := os.Getenv("SYSTEM_NAMESPACE")
// Scope informers to the webhook's namespace instead of cluster-wide
Expand Down
2 changes: 1 addition & 1 deletion config/kubernetes/201-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ rules:
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations"]
# validation.webhook.approvaltask.openshift.org performs schema validation when you, for example, create TaskLoops.
resourceNames: ["webhook.manual.approval.dev"]
resourceNames: ["validation.webhook.manual-approval.openshift-pipelines.org"]
# When there are changes to the configs or secrets, knative updates the validatingwebhook config
# with the updated certificates or the refreshed set of rules.
verbs: ["get", "list", "update", "patch", "watch"]
Expand Down
4 changes: 2 additions & 2 deletions config/kubernetes/400-webhook-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ metadata:
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: webhook.manual.approval.dev
name: validation.webhook.manual-approval.openshift-pipelines.org
webhooks:
- admissionReviewVersions: ["v1"]
clientConfig:
Expand All @@ -32,7 +32,7 @@ webhooks:
namespace: tekton-pipelines
failurePolicy: Fail
sideEffects: None
name: webhook.manual.approval.dev
name: validation.webhook.manual-approval.openshift-pipelines.org

---

Expand Down
2 changes: 1 addition & 1 deletion config/openshift/201-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ rules:
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations"]
# validation.webhook.approvaltask.openshift.org performs schema validation when you, for example, create TaskLoops.
resourceNames: ["webhook.manual.approval.dev"]
resourceNames: ["validation.webhook.manual-approval.openshift-pipelines.org"]
# When there are changes to the configs or secrets, knative updates the validatingwebhook config
# with the updated certificates or the refreshed set of rules.
verbs: ["get", "list", "update", "patch", "watch", "delete", "create"]
Expand Down
4 changes: 2 additions & 2 deletions config/openshift/400-webhook-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ metadata:
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: webhook.manual.approval.dev
name: validation.webhook.manual-approval.openshift-pipelines.org
webhooks:
- admissionReviewVersions: ["v1"]
clientConfig:
Expand All @@ -32,7 +32,7 @@ webhooks:
namespace: openshift-pipelines
failurePolicy: Fail
sideEffects: None
name: webhook.manual.approval.dev
name: validation.webhook.manual-approval.openshift-pipelines.org

---

Expand Down
6 changes: 3 additions & 3 deletions test/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func TestValidateUserUpdateOwnApprovalStatus(t *testing.T) {

_, err = clients.ApprovalTaskClient.ApprovalTasks("default").Patch(context.TODO(), cr.GetName(), types.MergePatchType, patch, metav1.PatchOptions{})

errMsg := `admission webhook "webhook.manual.approval.dev" denied the request: User can only update their own approval input`
errMsg := `admission webhook "validation.webhook.manual-approval.openshift-pipelines.org" denied the request: User can only update their own approval input`
assert.Equal(t, errMsg, err.Error())
})
}
Expand Down Expand Up @@ -369,7 +369,7 @@ func TestValidateUserDoesNotExists(t *testing.T) {

_, err = clients.ApprovalTaskClient.ApprovalTasks("default").Patch(context.TODO(), cr.GetName(), types.MergePatchType, patch, metav1.PatchOptions{})

errMsg := `admission webhook "webhook.manual.approval.dev" denied the request: User does not exist in the in the approval list`
errMsg := `admission webhook "validation.webhook.manual-approval.openshift-pipelines.org" denied the request: User does not exist in the in the approval list`
assert.Equal(t, errMsg, err.Error())
})
}
Expand Down Expand Up @@ -481,7 +481,7 @@ func TestValidateApprovalTaskHasReachedFinalState(t *testing.T) {
}

_, err = clients.ApprovalTaskClient.ApprovalTasks("default").Patch(context.TODO(), cr.GetName(), types.MergePatchType, patch, metav1.PatchOptions{})
errMsg := `admission webhook "webhook.manual.approval.dev" denied the request: ApprovalTask has already reached it's final state`
errMsg := `admission webhook "validation.webhook.manual-approval.openshift-pipelines.org" denied the request: ApprovalTask has already reached it's final state`
assert.Equal(t, errMsg, err.Error())
})
}
Expand Down

0 comments on commit 4775bda

Please sign in to comment.