admit

package
v4.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: BSD-3-Clause Imports: 24 Imported by: 4

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
)

Variables

View Source
var (
	DanmNetMapping    = []Validator{validateIpv4Fields, validateIpv6Fields, validateAllocationPool, validateVids, validateNetworkId, validateAbsenceOfAllowedTenants, validateNeType}
	ClusterNetMapping = []Validator{validateIpv4Fields, validateIpv6Fields, validateAllocationPool, validateVids, validateNeType, validateNetworkId}
	TenantNetMapping  = []Validator{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) error

func CreateReviewResponseFromPatches

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

func DecodeAdmissionReview

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

func DeleteNetwork

func 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 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, uid types.UID, err error)

func ValidateNetwork

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

func ValidateTenantConfig

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

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 func(oldManifest, newManifest *danmtypes.DanmNet, opType admissionv1.Operation) error

type ValidatorMapping

type ValidatorMapping []Validator

Jump to

Keyboard shortcuts

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