resource

package
v0.4.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromFiles

func FromFiles(ctx context.Context, paths []string, ignoreFilePatterns []string) (<-chan Resource, <-chan error)

func FromStream

func FromStream(ctx context.Context, path string, r io.Reader) (<-chan Resource, <-chan error)

FromStream reads resources from a byte stream, usually here stdin

func SplitYAMLDocument

func SplitYAMLDocument(data []byte, atEOF bool) (advance int, token []byte, err error)

SplitYAMLDocument is a bufio.SplitFunc for splitting a YAML document into individual documents.

This is from Kubernetes' 'pkg/util/yaml'.splitYAMLDocument, which is unfortunately not exported.

Types

type DiscoveryError

type DiscoveryError struct {
	Path string
	Err  error
}

func (DiscoveryError) Error

func (de DiscoveryError) Error() string

type Resource

type Resource struct {
	Path  string
	Bytes []byte
	// contains filtered or unexported fields
}

Resource represents a Kubernetes resource within a file

func (*Resource) Resources

func (res *Resource) Resources() []Resource

Resources returns a list of resources if the resource is of type List, a single resource otherwise See https://github.com/icyxp/kubeconform/issues/53

func (*Resource) Signature

func (res *Resource) Signature() (*Signature, error)

Signature computes a signature for a resource, based on its Kind, Version, Namespace & Name

func (*Resource) SignatureFromMap

func (res *Resource) SignatureFromMap(m map[string]interface{}) (*Signature, error)

type Signature

type Signature struct {
	Kind, Version, Namespace, Name string
}

Signature is a key representing a Kubernetes resource

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL