Documentation
¶
Overview ¶
This is the main package to import to embed kubeconform in your software
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct {
Cache string // Cache schemas downloaded via HTTP to this folder
Debug bool // Debug infos will be print here
SkipTLS bool // skip TLS validation when downloading from an HTTP Schema Registry
SkipKinds map[string]struct{} // List of resource Kinds to ignore
RejectKinds map[string]struct{} // List of resource Kinds to reject
KubernetesVersion string // Kubernetes Version - has to match one in https://github.com/instrumenta/kubernetes-json-schema
Strict bool // thros an error if resources contain undocumented fields
IgnoreMissingSchemas bool // skip a resource if no schema for that resource can be found
}
Opts contains a set of options for the validator.
type Result ¶
type Result struct {
Resource resource.Resource
Err error
Status Status
ValidationErrors []ValidationError
}
Result contains the details of the result of a resource validation
type Status ¶
type Status int
Different types of validation results
const ( Error Status // an error occurred processing the file / resource Skipped // resource has been skipped, for example if its Kind was part of the kinds to skip Valid // resource is valid Invalid // resource is invalid Empty // resource is empty. Note: is triggered for files starting with a --- separator. )
type ValidationError ¶
type ValidationError struct {
Path string `json:"path"`
Msg string `json:"msg"`
// Keyword is the JSON Schema keyword that failed, such as required, additionalProperties or
// type. Added in ConfigHub's copy.
Keyword string `json:"keyword,omitempty"`
}
func (*ValidationError) Error ¶
func (ve *ValidationError) Error() string
type Validator ¶
type Validator interface {
ValidateResource(res resource.Resource) Result
Validate(filename string, r io.ReadCloser) []Result
ValidateWithContext(ctx context.Context, filename string, r io.ReadCloser) []Result
}
Validator exposes multiple methods to validate your Kubernetes resources.
Click to show internal directories.
Click to hide internal directories.