Files
kamaji/internal/webhook/handlers/handler.go
2023-06-05 17:03:35 +02:00

21 lines
543 B
Go

// Copyright 2022 Clastix Labs
// SPDX-License-Identifier: Apache-2.0
package handlers
import (
"context"
"gomodules.xyz/jsonpatch/v2"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)
type AdmissionResponse func(ctx context.Context, req admission.Request) ([]jsonpatch.JsonPatchOperation, error)
type Handler interface {
OnCreate(runtime.Object) AdmissionResponse
OnDelete(runtime.Object) AdmissionResponse
OnUpdate(newObject runtime.Object, prevObject runtime.Object) AdmissionResponse
}