Documentation ¶
Index ¶
- Constants
- Variables
- func CreateReviewResponseFromPatches(patchList []Patch) *v1beta1.AdmissionResponse
- func DecodeAdmissionReview(httpRequest *http.Request) (v1beta1.AdmissionReview, error)
- func IsTypeDynamic(cniType string) bool
- func SendAdmissionResponse(responseWriter http.ResponseWriter, reviewResponse v1beta1.AdmissionReview)
- func SendErroneousAdmissionResponse(responseWriter http.ResponseWriter, request *v1beta1.AdmissionRequest, ...)
- type Patch
- type Validator
- func (validator *Validator) DeleteNetwork(responseWriter http.ResponseWriter, request *http.Request)
- func (validator *Validator) ValidateNetwork(responseWriter http.ResponseWriter, request *http.Request)
- func (validator *Validator) ValidateTenantConfig(responseWriter http.ResponseWriter, request *http.Request)
- type ValidatorFunc
- type ValidatorMapping
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 = 10
)
Variables ¶
View Source
var ( DanmNetMapping = []ValidatorFunc{validateIpv4Fields, validateIpv6Fields, validateAllocationPools, validateVids, validateNetworkId, validateAbsenceOfAllowedTenants, validateNeType, validateVniChange} ClusterNetMapping = []ValidatorFunc{validateIpv4Fields, validateIpv6Fields, validateAllocationPools, validateVids, validateNetworkId, validateNeType, validateVniChange} TenantNetMapping = []ValidatorFunc{validateIpv4Fields, validateIpv6Fields, validateAllocationPools, validateAbsenceOfAllowedTenants, validateTenantNetRules, validateNeType} )
View Source
var (
NetworkPatchPaths = map[string]string{
"NetworkType": "/spec/NetworkType",
"NetworkID": "/spec/NetworkID",
"Alloc": "/spec/Options/alloc",
"Alloc6": "/spec/Options/alloc6",
"Pool": "/spec/Options/allocation_pool",
"Pool6": "/spec/Options/allocation_pool_v6",
"Device": "/spec/Options/host_device",
"Vlan": "/spec/Options/vlan",
"Vxlan": "/spec/Options/vxlan",
}
)
Functions ¶
func CreateReviewResponseFromPatches ¶
func CreateReviewResponseFromPatches(patchList []Patch) *v1beta1.AdmissionResponse
func DecodeAdmissionReview ¶
func DecodeAdmissionReview(httpRequest *http.Request) (v1beta1.AdmissionReview, error)
func IsTypeDynamic ¶
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"` }
type Validator ¶
type Validator struct {
Client danmclientset.Interface
}
func CreateNewValidator ¶
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
Click to show internal directories.
Click to hide internal directories.