admit

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//This is just a dimensioning decision to avoid reserving unnecessarily big bitarrays in TenantConfig
	MaxAllowedVni  = 5000
	HostDevicePath = "/hostDevices"
)
View Source
const (
	MaxNidLength     = 11
	MaxNetMaskLength = 8
)

Variables

View Source
var (
	DanmNetMapping    = []ValidatorFunc{validateIpv4Fields, validateIpv6Fields, validateAllocationPool, validateVids, validateNetworkId, validateAbsenceOfAllowedTenants, validateNeType, validateVniChange}
	ClusterNetMapping = []ValidatorFunc{validateIpv4Fields, validateIpv6Fields, validateAllocationPool, validateVids, validateNetworkId, validateNeType, validateVniChange}
	TenantNetMapping  = []ValidatorFunc{validateIpv4Fields, validateIpv6Fields, validateAllocationPool, validateAbsenceOfAllowedTenants, validateTenantNetRules, validateNeType}
)
View Source
var (
	NetworkPatchPaths = map[string]string{
		"NetworkType": "/spec/NetworkType",
		"NetworkID":   "/spec/NetworkID",
		"Alloc":       "/spec/Options/alloc",
		"Pool":        "/spec/Options/allocation_pool",
		"Device":      "/spec/Options/host_device",
		"Vlan":        "/spec/Options/vlan",
		"Vxlan":       "/spec/Options/vxlan",
	}
)

Functions

func CreateAllocationArray

func CreateAllocationArray(dnet *danmtypes.DanmNet)

func CreateReviewResponseFromPatches

func CreateReviewResponseFromPatches(patchList []Patch) *v1beta1.AdmissionResponse

func DecodeAdmissionReview

func DecodeAdmissionReview(httpRequest *http.Request) (v1beta1.AdmissionReview, error)

func GetBroadcastAddress

func GetBroadcastAddress(subnet *net.IPNet) net.IP

func IsTypeDynamic

func IsTypeDynamic(cniType string) bool

func SendAdmissionResponse

func SendAdmissionResponse(responseWriter http.ResponseWriter, reviewResponse v1beta1.AdmissionReview)

func SendErroneousAdmissionResponse

func SendErroneousAdmissionResponse(responseWriter http.ResponseWriter, request *v1beta1.AdmissionRequest, err error)

Types

type Patch

type Patch struct {
	Op    string      `json:"op"`
	Path  string      `json:"path"`
	Value interface{} `json:"value,omitempty"`
}

func CreateGenericPatchFromChange

func CreateGenericPatchFromChange(path string, value interface{}) Patch

type Validator

type Validator struct {
	Client danmclientset.Interface
}

func CreateNewValidator

func CreateNewValidator() (*Validator, error)

func (*Validator) DeleteNetwork

func (validator *Validator) DeleteNetwork(responseWriter http.ResponseWriter, request *http.Request)

A GIGANTIC DISCLAIMER: THIS DOES NOT WORK BEFORE K8S 1.15! See ticket: https://github.com/kubernetes/kubernetes/pull/76346 Tested with 1.15 though, works like a charm

func (*Validator) ValidateNetwork

func (validator *Validator) ValidateNetwork(responseWriter http.ResponseWriter, request *http.Request)

func (*Validator) ValidateTenantConfig

func (validator *Validator) ValidateTenantConfig(responseWriter http.ResponseWriter, request *http.Request)

type ValidatorFunc

type ValidatorFunc func(oldManifest, newManifest *danmtypes.DanmNet, opType admissionv1.Operation, client danmclientset.Interface) error

type ValidatorMapping

type ValidatorMapping []ValidatorFunc

Jump to

Keyboard shortcuts

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