server

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Overview

Package server contains the implementation of a RuntimeSDK webhook server.

Index

Constants

This section is empty.

Variables

View Source
var DefaultPort = 9443

DefaultPort is the default port that the webhook server serves.

Functions

This section is empty.

Types

type ExtensionHandler

type ExtensionHandler struct {

	// Hook is the corresponding hook of the handler.
	Hook runtimecatalog.Hook

	// Name is the name of the extension handler.
	// An extension handler name must be valid in line RFC 1123 Label Names.
	Name string

	// HandlerFunc is the handler function.
	HandlerFunc runtimecatalog.Hook

	// TimeoutSeconds is the timeout of the extension handler.
	// If left undefined, this will be defaulted to 10s when processing the answer to the discovery
	// call for this server.
	TimeoutSeconds *int32

	// FailurePolicy is the failure policy of the extension handler.
	// If left undefined, this will be defaulted to FailurePolicyFail when processing the answer to the discovery
	// call for this server.
	FailurePolicy *runtimehooksv1.FailurePolicy
	// contains filtered or unexported fields
}

ExtensionHandler represents an extension handler.

type Options

type Options struct {
	// Catalog is the catalog used to handle requests.
	Catalog *runtimecatalog.Catalog

	// Port is the port that the webhook server serves at.
	// It is used to set webhook.Server.Port.
	Port int

	// Host is the hostname that the webhook server binds to.
	// It is used to set webhook.Server.Host.
	Host string

	// CertDir is the directory that contains the server key and certificate.
	// If not set, webhook server would look up the server key and certificate in
	// {TempDir}/k8s-webhook-server/serving-certs. The server key and certificate
	// must be named tls.key and tls.crt, respectively.
	// It is used to set webhook.Server.CertDir.
	CertDir string
}

Options are the options for the Server.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a runtime webhook server.

func New added in v1.3.0

func New(options Options) (*Server, error)

New creates a new runtime webhook server based on the given Options.

func (*Server) AddExtensionHandler

func (s *Server) AddExtensionHandler(handler ExtensionHandler) error

AddExtensionHandler adds an extension handler to the server.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the server.

Jump to

Keyboard shortcuts

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