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 WebHook, cert, key []byte, ns string) (*v1.Secret, error)
- func CreateValidateWebhook(ctx context.Context, admissionWebhook AdmissionWebHookCFG, caBundle []byte, ...) error
- func GenerateCertificate(ctx context.Context, cn string, dnsName string) ([]byte, []byte, error)
- func GetStorageWebHookCfg() (WebHook, []AdmissionWebHookCFG)
- func GetTLSCertificate(cert, priv []byte) (tls.Certificate, error)
- type AdmissionRule
- type AdmissionWebHookCFG
- type AdmissionWebHookType
- type Controller
- type HandleFuncPair
- type WebHook
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 WebHook, cert, key []byte, ns string) (*v1.Secret, error)
CreateCertSecrets creates k8s secret to store signed cert data
func CreateValidateWebhook ¶
func CreateValidateWebhook(ctx context.Context, admissionWebhook AdmissionWebHookCFG, caBundle []byte, ns string) error
CreateValidateWebhook create new webhook config if not exist already
func GenerateCertificate ¶
GenerateCertificate Self Signed certificate using given CN, returns x509 cert and priv key in PEM format
func GetStorageWebHookCfg ¶
func GetStorageWebHookCfg() (WebHook, []AdmissionWebHookCFG)
GetStorageWebHookCfg used to get storage webhook configuration
func GetTLSCertificate ¶
func GetTLSCertificate(cert, priv []byte) (tls.Certificate, error)
GetTLSCertificate from pub and priv key
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 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 WebHook, admissionWebhooks []AdmissionWebHookCFG) error
Start uses to start the webhook server
func (*Controller) Stop ¶
func (c *Controller) Stop(ctx context.Context, webHookCfg WebHook, 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
type WebHook ¶
type WebHook 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 }
WebHook uses to start the webhook server