webhook

package
v4.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package webhook validate the request

Package webhook validate the request

Package webhook validate the request

Package webhook validate the request

Package webhook validate/mutate the request

Package webhook provide configuration for volume provider

Index

Constants

View Source
const (
	// AdmissionWebHookValidating is for validate webhook
	AdmissionWebHookValidating AdmissionWebHookType = "validating"

	// ClaimBoundFinalizer used when storageBackendClaim bound to a storageBackendContent
	ClaimBoundFinalizer string = "storagebackend.xuanwu.huawei.io/storagebackendclaim-bound-protection"
)

Variables

AdmitFunc handles a v1 admission

View Source
var Codecs = serializer.NewCodecFactory(scheme)

Codecs means a code factory

Functions

func CreateCertSecrets

func CreateCertSecrets(ctx context.Context, webHookCfg Config, cert, key []byte, ns string) (*v1.Secret, error)

CreateCertSecrets creates k8s secret to store signed cert data

func CreateValidateWebhook

func CreateValidateWebhook(ctx context.Context, webHookCfg AdmissionWebHookCFG, caBundle []byte, ns string) error

CreateValidateWebhook create new webhook config if not exist already

func GetStorageWebHookCfg

func GetStorageWebHookCfg() (Config, []AdmissionWebHookCFG)

GetStorageWebHookCfg used to get storage webhook configuration

Types

type AdmissionRule

type AdmissionRule struct {
	APIGroups   []string
	APIVersions []string
	Resources   []string
}

AdmissionRule includes admission rules

type AdmissionWebHookCFG

type AdmissionWebHookCFG struct {
	WebhookName   string
	ServiceName   string
	WebhookPath   string
	WebhookPort   int32
	AdmissionOps  []admissionV1.OperationType
	AdmissionRule AdmissionRule
}

AdmissionWebHookCFG defines cfg of admission webhook

type AdmissionWebHookType

type AdmissionWebHookType string

AdmissionWebHookType is the type of the webhook

type Config

type Config struct {
	NamespaceEnv     string
	DefaultNamespace string
	ServiceName      string
	SecretName       string

	WebHookPort int
	// address of webhook server
	WebHookAddress string
	WebHookType    AdmissionWebHookType

	PrivateKey     string
	PrivateCert    string
	HandleFuncPair []HandleFuncPair
}

Config uses to start the webhook server

type Controller

type Controller struct {
	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

Controller include webhook resources

func (*Controller) Start

func (c *Controller) Start(ctx context.Context, webHookCfg Config, admissionWebhooks []AdmissionWebHookCFG) error

Start uses to start the webhook server

func (*Controller) Stop

func (c *Controller) Stop(ctx context.Context, webHookCfg Config,
	admissionWebhooks []AdmissionWebHookCFG) error

Stop uses to stop the webhook server

type HandleFuncPair

type HandleFuncPair struct {
	WebhookPath string
	WebHookFunc func(admissionV1.AdmissionReview) *admissionV1.AdmissionResponse
}

HandleFuncPair uses for add handle func

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL