webhook

package
v1.0.1-2020-11-30 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidateLogic = func(w *WireUp) {
	w.Handler = &ChannelValidator{Client: w.mgr.GetClient(), Logger: w.Logger}
}

ValidateLogic add ChannelValidator to webhook wireup

Functions

func DelPreValiationCfg20

func DelPreValiationCfg20(clt client.Client) error

func GenerateWebhookCerts

func GenerateWebhookCerts(certDir, webhookServiceNs, webhookServiceName string) ([]byte, error)

GenerateWebhookCerts generate self singed CA and a signed cert pair. The signed pair is stored at the certDir. The CA will respect the inCluster DNS

func GetValidatorName

func GetValidatorName(wbhName string) string

func GetWebHookServiceName

func GetWebHookServiceName(wbhName string) string

Types

type Certificate

type Certificate struct {
	Cert string
	Key  string
}

Certificate defines a typical cert structure

func GenerateSelfSignedCACert

func GenerateSelfSignedCACert(cn string) (Certificate, error)

GenerateSelfSignedCACert generates a self signed CA

func GenerateSignedCert

func GenerateSignedCert(cn string, alternateDNS []string, ca Certificate) (Certificate, error)

GenerateSignedCert generated cert pair which is signed by the self signed CA

type ChannelValidator

type ChannelValidator struct {
	logr.Logger
	client.Client
	// contains filtered or unexported fields
}

func (*ChannelValidator) Handle

ChannelValidator admits a channel if a specific channel can co-exit in the requested namespace.

func (*ChannelValidator) InjectDecoder

func (v *ChannelValidator) InjectDecoder(d *admission.Decoder) error

InjectDecoder injects the decoder.

type CleanUpFunc

type CleanUpFunc func(client.Client) error

type WireUp

type WireUp struct {
	Server  *webhook.Server
	Handler webhook.AdmissionHandler
	CertDir string
	logr.Logger

	WebhookName string
	WebHookPort int

	WebHookeSvcKey     types.NamespacedName
	WebHookServicePort int

	ValidtorPath string

	DeployLabel        string
	DeploymentSelector map[string]string
	// contains filtered or unexported fields
}

func NewWireUp

func NewWireUp(mgr manager.Manager, stop <-chan struct{},
	opts ...func(*WireUp)) (*WireUp, error)

func (*WireUp) Attach

func (w *WireUp) Attach() ([]byte, error)

func (*WireUp) WireUpWebhookSupplymentryResource

func (w *WireUp) WireUpWebhookSupplymentryResource(caCert []byte, gvk schema.GroupVersionKind, ops []admissionv1.OperationType, cFuncs ...CleanUpFunc) error

assuming we have a service set up for the webhook, and the service is linking to a secret which has the CA

Jump to

Keyboard shortcuts

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