server

package
v1.5.2-0...-73c76f7 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context)

Run starts the API server

Types

type Config

type Config struct {
	LogLevel              string   `json:"log_level"`
	BlacklistedNamespaces []string `json:"blacklisted_namespaces"`
	TLS                   struct {
		Cert string
		Key  string
	}
	GlobalReportOnly bool `json:"global_report_only"`
	Policies         []PolicySettings
	PolicyConfig     policies.Config `json:"policy_config"`
}

type Policy

type Policy interface {
	Name() string
	Validate(ctx context.Context,
		config policies.Config,
		ar *admissionv1beta1.AdmissionRequest,
	) ([]policies.ResourceViolation, []policies.PatchOperation)
}

Policy specifies how a Policy is implemented Returns a slice of violations and an optional slice of patch operations if mutation is desired.

type PolicySettings

type PolicySettings struct {
	Name       string
	Enabled    bool
	ReportOnly bool `json:"report_only"`
}

type Server

type Server struct {
	Config             Config
	RequestedShutdown  bool
	EnforcedPolicies   []Policy
	ReportOnlyPolicies []Policy
	Exemptions         []policies.CompiledExemption
}

Server contains configuration state needed for the API server

func (*Server) LogAndPrintError

func (s *Server) LogAndPrintError(user string, err error)

func (*Server) ValidatingWebhook

func (s *Server) ValidatingWebhook(w http.ResponseWriter, r *http.Request)

ValidatingWebhook is a ValidatingWebhook endpoint that accepts K8s resources to process

Jump to

Keyboard shortcuts

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