manifest

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 13

Documentation

Index

Constants

View Source
const DefaultNameFormat = `{{ print .kind "_" .metadata.name | snakecase }}`

DefaultNameFormat to use when no nameFormat is supplied

Variables

View Source
var (
	ErrInvalidStr = fmt.Errorf("missing or not of string type")
	ErrInvalidMap = fmt.Errorf("missing or not an object")
)

Functions

func ListAsMap added in v0.13.0

func ListAsMap(list List, nameFormat string) (map[string]interface{}, error)

Types

type ErrorDuplicateName added in v0.13.0

type ErrorDuplicateName struct {
	// contains filtered or unexported fields
}

ErrorDuplicateName means two resources share the same name using the given nameFormat.

func (ErrorDuplicateName) Error added in v0.13.0

func (e ErrorDuplicateName) Error() string

type List

type List []Manifest

List of individual Manifests

func (List) Namespaces added in v0.15.1

func (m List) Namespaces() []string

func (List) String

func (m List) String() string

String returns the List as a yaml stream. In case of an error, it is returned as a string instead.

type Manifest

type Manifest map[string]interface{}

Manifest represents a Kubernetes API object. The fields `apiVersion` and `kind` are required, `metadata.name` should be present as well

func New

func New(raw map[string]interface{}) (Manifest, error)

New creates a new Manifest

func NewFromObj

func NewFromObj(raw objx.Map) (Manifest, error)

NewFromObj creates a new Manifest from an objx.Map

func (Manifest) APIVersion

func (m Manifest) APIVersion() string

APIVersion returns the version of the API this object uses

func (Manifest) IsList added in v0.11.0

func (m Manifest) IsList() bool

IsList returns whether the manifest is a List type, containing other manifests as children. Code based on https://github.com/kubernetes/apimachinery/blob/61490fe38e784592212b24b9878306b09be45ab0/pkg/apis/meta/v1/unstructured/unstructured.go#L54

func (Manifest) Items added in v0.11.0

func (m Manifest) Items() (List, error)

Items returns list items if the manifest is of List type

func (Manifest) Kind

func (m Manifest) Kind() string

Kind returns the kind of the API object

func (Manifest) KindName added in v0.11.0

func (m Manifest) KindName() string

KindName returns kind and metadata.name in the `<kind>/<name>` format

func (Manifest) Metadata

func (m Manifest) Metadata() Metadata

Metadata returns the metadata of this object

func (Manifest) String

func (m Manifest) String() string

String returns the Manifest in yaml representation

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(data []byte) error

UnmarshalJSON validates the Manifest during json parsing

func (*Manifest) UnmarshalYAML

func (m *Manifest) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML validates the Manifest during yaml parsing

func (Manifest) Verify

func (m Manifest) Verify() error

Verify checks whether the manifest is correctly structured

type Metadata

type Metadata map[string]interface{}

Metadata is the metadata object from the Manifest

func (Metadata) Annotations

func (m Metadata) Annotations() map[string]interface{}

Annotations of the manifest

func (Metadata) GenerateName added in v0.27.0

func (m Metadata) GenerateName() string

func (Metadata) HasNamespace

func (m Metadata) HasNamespace() bool

HasNamespace returns whether the manifest has a namespace set

func (Metadata) Labels

func (m Metadata) Labels() map[string]interface{}

Labels of the manifest

func (Metadata) ManagedFields added in v0.21.0

func (m Metadata) ManagedFields() []interface{}

Managed fields of the manifest

func (Metadata) Name

func (m Metadata) Name() string

Name of the manifest

func (Metadata) Namespace

func (m Metadata) Namespace() string

Namespace of the manifest

func (Metadata) UID added in v0.10.0

func (m Metadata) UID() string

type SampleString added in v0.11.0

type SampleString string

SampleString is used for displaying code samples for error messages. It truncates the output to 10 lines

func (SampleString) Indent added in v0.11.0

func (s SampleString) Indent(n int) string

func (SampleString) String added in v0.11.0

func (s SampleString) String() string

type SchemaError

type SchemaError struct {
	Fields   map[string]error
	Name     string
	Manifest Manifest
}

SchemaError means that some expected fields were missing

func (*SchemaError) Error

func (s *SchemaError) Error() string

Error returns the fields the manifest at the path is missing

Jump to

Keyboard shortcuts

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