Documentation
¶
Index ¶
- func RegisterCMValidator(validator *CMValidator, webhooks *webhooks.K8sRegistry)
- type CMFileValidator
- type CMValidator
- func (v *CMValidator) RegisterCMFileValidator(validator CMFileValidator)
- func (v *CMValidator) ValidateConfigMap(ctx context.Context, cm corev1.ConfigMap) (bool, string, error)
- func (v *CMValidator) ValidateObject(ctx context.Context, req *admissionv1.AdmissionRequest) (ok bool, msg string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCMValidator ¶
func RegisterCMValidator(validator *CMValidator, webhooks *webhooks.K8sRegistry)
RegisterCMValidator registers configmap validator as k8s webhook.
Types ¶
type CMFileValidator ¶
type CMFileValidator interface { CheckCMName(name string) bool ValidateFile( ctx context.Context, name string, yamlSrc []byte, ) (bool, string, error) }
CMFileValidator is an interface for configmap validation.
type CMValidator ¶
type CMValidator struct {
// contains filtered or unexported fields
}
CMValidator validates the policies configmap.
func ProvideCMValidator ¶
func ProvideCMValidator() *CMValidator
ProvideCMValidator provides config map validator
Note: This validator must be registered to be accessible.
func (*CMValidator) RegisterCMFileValidator ¶
func (v *CMValidator) RegisterCMFileValidator(validator CMFileValidator)
RegisterCMFileValidator adds a configmap file validator to be handled on validator
This function should be only called before Start phase.
func (*CMValidator) ValidateConfigMap ¶
func (v *CMValidator) ValidateConfigMap(ctx context.Context, cm corev1.ConfigMap) (bool, string, error)
ValidateConfigMap checks if configmap is valid
returns: * true, "", nil when config is valid * false, message, nil when config is invalid and * false, "", err on other errors.
func (*CMValidator) ValidateObject ¶
func (v *CMValidator) ValidateObject( ctx context.Context, req *admissionv1.AdmissionRequest, ) (ok bool, msg string, err error)
ValidateObject checks the validity of a object as a k8s object.