Documentation ¶
Index ¶
- Constants
- type InvalidObject
- type K8sObjectInfo
- type LintContext
- func CreateContexts(ignorePaths []string, filesOrDirs ...string) ([]LintContext, error)
- func CreateContextsFromHelmArchive(ignorePaths []string, fileName string, tgzReader io.Reader) ([]LintContext, error)
- func CreateContextsWithOptions(options Options, ignorePaths []string, filesOrDirs ...string) ([]LintContext, error)
- type Object
- type ObjectMetadata
- type Options
Constants ¶
const ReadFromStdin = "-"
ReadFromStdin is a path used to indicate reading from os.Stdin
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InvalidObject ¶
type InvalidObject struct { Metadata ObjectMetadata LoadErr error }
An InvalidObject represents something that couldn't be loaded from a YAML file.
type K8sObjectInfo ¶
type K8sObjectInfo struct {
Namespace, Name string
GroupVersionKind schema.GroupVersionKind
}
K8sObjectInfo contains identifying information about k8s object.
func (K8sObjectInfo) String ¶
func (n K8sObjectInfo) String() string
String provides plain-text representation of k8s object name.
type LintContext ¶
type LintContext interface { Objects() []Object InvalidObjects() []InvalidObject }
A LintContext represents the context for a lint run.
func CreateContexts ¶
func CreateContexts(ignorePaths []string, filesOrDirs ...string) ([]LintContext, error)
CreateContexts creates a context. Each context contains a set of files that should be linted as a group. Currently, each directory of Kube YAML files (or Helm charts) are treated as a separate context. TODO: Figure out if it's useful to allow people to specify that files spanning different directories should be treated as being in the same context.
func CreateContextsFromHelmArchive ¶
func CreateContextsFromHelmArchive(ignorePaths []string, fileName string, tgzReader io.Reader) ([]LintContext, error)
CreateContextsFromHelmArchive creates a context from TGZ reader of Helm Chart. Note: although this function is not used in CLI, it is exposed from kube-linter library and therefore should stay. See https://github.com/stackrox/kube-linter/pull/173
func CreateContextsWithOptions ¶
func CreateContextsWithOptions(options Options, ignorePaths []string, filesOrDirs ...string) ([]LintContext, error)
CreateContextsWithOptions creates a context with additional Options
type Object ¶
type Object struct { Metadata ObjectMetadata K8sObject k8sutil.Object `json:"-"` }
An Object references an object that is loaded from a YAML file.
func (*Object) GetK8sObjectName ¶
func (o *Object) GetK8sObjectName() K8sObjectInfo
GetK8sObjectName extracts K8sObjectInfo from Object.K8sObject.
func (*Object) MarshalJSON ¶
MarshalJSON provides custom serialization for Object. Object.K8sObject is not serialized directly because that would be too much data. This function limits output to only K8sObjectInfo returned for K8sObject.
type ObjectMetadata ¶
ObjectMetadata is metadata about an object.
type Options ¶
type Options struct { // CustomDecoder allows users to supply a non-default decoder to parse k8s objects. This can be used // to allow the linter to create contexts for k8s custom resources CustomDecoder runtime.Decoder }
Options represent values that can be provided to modify how objects are parsed to create lint contexts