kubemanifest

package
v1.28.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 101

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHostPathMapping added in v1.24.0

func AddHostPathMapping(pod *v1.Pod, container *v1.Container, name, path string, options ...HostPathMappingOption)

AddHostPathMapping is a helper function for mapping a host path into a container It returns a HostPathMapping for tweaking the defaults (which are notably read-only)

func AddHostPathSELinuxContext added in v1.28.0

func AddHostPathSELinuxContext(pod *v1.Pod, cfg *nodeup.Config)

AddHostPathSELinuxContext allows a non-privileged pod to access any file on the Host via HostPath volumes when SELinux is enabled.

func KubeObjectToApplyYAML added in v1.23.0

func KubeObjectToApplyYAML(data runtime.Object) (string, error)

KubeObjectToApplyYAML returns the kubernetes object converted to YAML, with "noisy" fields removed.

We remove:

  • status (can't be applied, shouldn't be specified)
  • metadata.creationTimestamp (can't be applied, shouldn't be specified)

func MarkPodAsClusterCritical added in v1.15.1

func MarkPodAsClusterCritical(pod *v1.Pod)

MarkPodAsClusterCritical sets the pod priority to system-cluster-critical

func MarkPodAsCritical

func MarkPodAsCritical(pod *v1.Pod)

MarkPodAsCritical adds the required annotations for a pod to be considered critical

func MarkPodAsNodeCritical added in v1.15.1

func MarkPodAsNodeCritical(pod *v1.Pod)

MarkPodAsNodeCritical sets the pod priority to system-node-critical

Types

type ContainerVisitorFunction added in v1.27.0

type ContainerVisitorFunction func(container map[string]interface{}) error

type HostPathMappingOption added in v1.27.0

type HostPathMappingOption func(volumeMount *v1.VolumeMount, volume *v1.Volume)

HostPathMappingOption implements the "functional options pattern" for named variable parameters.

func WithHostPath added in v1.27.0

func WithHostPath(p string) HostPathMappingOption

WithHostPath changes the host path (the path in the host)

func WithMountPath added in v1.27.0

func WithMountPath(p string) HostPathMappingOption

WithMountPath changes the mount path (the path in the container)

func WithReadWrite added in v1.27.0

func WithReadWrite() HostPathMappingOption

WithReadWrite changes the hostpath mapping to be read-write (the default is read-only)

func WithType added in v1.27.0

WithType changes the hostpath mount type

type ImageRemapFunction

type ImageRemapFunction func(image string) (string, error)

type Object added in v1.19.0

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

Object holds arbitrary untyped kubernetes objects; it is used when we don't have the type definitions for them

func FromRuntimeObject added in v1.24.0

func FromRuntimeObject(obj runtime.Object) (*Object, error)

FromRuntimeObject converts from a runtime.Object.

func NewObject added in v1.21.3

func NewObject(data map[string]interface{}) *Object

NewObject returns an Object wrapping the provided data

func (*Object) APIVersion added in v1.19.0

func (m *Object) APIVersion() string

APIVersion returns the apiVersion field of the object, or "" if it cannot be found or is invalid

func (*Object) GetName added in v1.23.0

func (m *Object) GetName() string

GetName returns the namespace field of the object, or "" if it cannot be found or is invalid

func (*Object) GetNamespace added in v1.23.0

func (m *Object) GetNamespace() string

GetNamespace returns the namespace field of the object, or "" if it cannot be found or is invalid

func (*Object) GroupVersionKind added in v1.25.0

func (o *Object) GroupVersionKind() schema.GroupVersionKind

GroupVersionKind returns the group/version/kind information for the object

func (*Object) IsEmptyObject added in v1.19.0

func (m *Object) IsEmptyObject() bool

IsEmptyObject checks if the object has no keys set (i.e. `== {}`)

func (*Object) Kind added in v1.19.0

func (m *Object) Kind() string

Kind returns the kind field of the object, or "" if it cannot be found or is invalid

func (*Object) MarshalJSON added in v1.25.0

func (m *Object) MarshalJSON() ([]byte, error)

func (*Object) RemapImages added in v1.19.0

func (m *Object) RemapImages(mapper ImageRemapFunction) error

func (*Object) Reparse added in v1.19.0

func (m *Object) Reparse(obj interface{}, fields ...string) error

Reparse parses a subfield from an object

func (*Object) Set added in v1.19.0

func (m *Object) Set(newValue interface{}, fieldPath ...string) error

Set mutates a subfield to the newValue

func (*Object) ToUnstructured added in v1.23.0

func (o *Object) ToUnstructured() *unstructured.Unstructured

ToUnstructured converts the object to an unstructured.Unstructured

func (*Object) ToYAML added in v1.19.0

func (m *Object) ToYAML() ([]byte, error)

func (*Object) VisitContainers added in v1.27.0

func (m *Object) VisitContainers(visitorFn ContainerVisitorFunction) error

type ObjectList added in v1.19.0

type ObjectList []*Object

ObjectList describes a list of objects, allowing us to add bulk-methods

func LoadObjectsFrom added in v1.19.0

func LoadObjectsFrom(contents []byte) (ObjectList, error)

LoadObjectsFrom parses multiple objects from a yaml file

func (ObjectList) ToYAML added in v1.19.0

func (l ObjectList) ToYAML() ([]byte, error)

ToYAML serializes a list of objects back to bytes; it is the opposite of LoadObjectsFrom

type Visitor

type Visitor interface {
	VisitBool(path []string, v bool, mutator func(bool)) error
	VisitString(path []string, v string, mutator func(string)) error
	VisitFloat64(path []string, v float64, mutator func(float64)) error
	VisitMap(path []string, v map[string]interface{}) error
}

Jump to

Keyboard shortcuts

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