// LayerValidator makes sure that endpoint specs conform with the layer number set (e.g., a layer 3 endpoint can not have a port set)
LayerValidator makes sure that endpoint specs conform with the layer number set
// LayerValidator makes sure that endpoint specs conform with the layer number set ( e . g . a layer 3 endpoint can not have a port set )
func (v *LayerValidator) Handle(ctx context.Context, req admission.Request) admission.Response {
	networkConnectivityTest := &v1alpha1.NetworkConnectivityTest{}
	err := v.decoder.Decode(req, networkConnectivityTest)
	if err != nil {
		return admission.Errored(http.StatusBadRequest, err)
	}
	allowed, reason, err := v.validateLayerFn(ctx, networkConnectivityTest)
	if err != nil {
		return admission.Errored(http.StatusInternalServerError, err)
	}
	return admission.ValidationResponse(allowed, reason)
}
func ( v * LayerValidator ) Handle ( ctx context . Context , req admission . Request ) admission . Response { networkConnectivityTest := & v1alpha1 . NetworkConnectivityTest { } err := v . decoder . Decode ( req , networkConnectivityTest ) if err != nil { return admission . Errored ( http . StatusBadRequest , err ) } allowed , reason , err := v . validateLayerFn ( ctx , networkConnectivityTest ) if err != nil { return admission . Errored ( http . StatusInternalServerError , err ) } return admission . ValidationResponse ( allowed , reason ) }
LayerValidator makes sure that endpoint specs conform with the layer number set
LayerValidator makes sure that endpoint specs conform with the layer number set