webhook

package
v0.0.0-...-8eb8255 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registration

type Registration struct {
	Name              string   `mapstructure:"name" yaml:"name"`
	Targets           []Target `mapstructure:"targets" yaml:"targets"`
	NamespaceSelector string   `mapstructure:"namespace-selector" yaml:"namespace-selector,omitempty"`
	FailurePolicy     string   `mapstructure:"failure-policy" yaml:"failure-policy"`
}

type Server

type Server struct {
	CompanyDomain string
	Namespace     string
	Service       string
	CACert        []byte
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cd, ns, svc string, ca []byte, k *kubernetes.Clientset, port int) Server

NewServer creates a new webhook server and sets up the initial graffiti handler. Use AddGraffitiRule to load the rules into the webhook server before starting.

func (Server) AddGraffitiRule

func (s Server) AddGraffitiRule(rule graffiti.Rule)

AddGraffitiRule provides a way of adding new rules into the http mux and corresponding handler context map

func (Server) RegisterHook

func (s Server) RegisterHook(r Registration, clientset *kubernetes.Clientset) error

RegisterHook registers our webhook as MutatingWebhook with the kubernetes api.

func (Server) StartWebhookServer

func (s Server) StartWebhookServer(certPath, keyPath string)

StartWebhookServer starts the webhook server with TLS encryption

type Target

type Target struct {
	APIGroups   []string `mapstructure:"api-groups" yaml:"api-groups"`
	APIVersions []string `mapstructure:"api-versions" yaml:"api-versions"`
	Resources   []string `mapstructure:"resources" yaml:"resources"`
}

Target defines a kubernetes compatible admissionreg.Rule but with mapstructure tags so that we can unmarshal it as part of a Viper structured configuration.

Jump to

Keyboard shortcuts

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