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
- Variables
- func CreateCertSecrets(ctx context.Context, webHookCfg Config, cert, key []byte, ns string) (*v1.Secret, error)
- func CreateValidateWebhook(ctx context.Context, webHookCfg AdmissionWebHookCFG, caBundle []byte, ...) error
- func GetStorageWebHookCfg() (Config, []AdmissionWebHookCFG)
- type AdmissionRule
- type AdmissionWebHookCFG
- type AdmissionWebHookType
- type Config
- type Controller
- type HandleFuncPair
Constants ¶
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 ¶
var AdmitFunc func(admissionV1.AdmissionReview) *admissionV1.AdmissionResponse
AdmitFunc handles a v1 admission
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 ¶
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