k8s

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KindOrder = []string{
	"Namespace",
	"NetworkPolicy",
	"ResourceQuota",
	"LimitRange",
	"PodSecurityPolicy",
	"PodDisruptionBudget",
	"ServiceAccount",
	"Secret",
	"SecretList",
	"ConfigMap",
	"StorageClass",
	"PersistentVolume",
	"PersistentVolumeClaim",
	"CustomResourceDefinition",
	"ClusterRole",
	"ClusterRoleList",
	"ClusterRoleBinding",
	"ClusterRoleBindingList",
	"Role",
	"RoleList",
	"RoleBinding",
	"RoleBindingList",
	"Service",
	"DaemonSet",
	"Pod",
	"ReplicationController",
	"ReplicaSet",
	"Deployment",
	"HorizontalPodAutoscaler",
	"StatefulSet",
	"Job",
	"CronJob",
	"IngressClass",
	"Ingress",
	"APIService",
}

Functions

func MatchesObject

func MatchesObject(obj Object, selector types.Selector) (bool, error)

func SelectorFromObject

func SelectorFromObject(o Object) types.Selector

func SelectorFromTarget

func SelectorFromTarget(t Target) types.Selector

func ValidateObject

func ValidateObject(o Object) error

Validate that the Object has a few required fields set

Types

type JsonPatch

type JsonPatch struct {
	YamlPatch interface{}     `yaml:"patch"`
	Patch     json.RawMessage `json:"patch" yaml:"-"`
	Target    Target          `json:"target" yaml:"target"`
}

type Object

type Object = yaml.RNode

Alias Object to kyaml.RNode

func FromMap

func FromMap(m map[string]interface{}, validate bool) (Object, error)

Convert from map[string]interface{} to Object and validate

type ObjectStore

type ObjectStore []Object

func (*ObjectStore) AddObject

func (s *ObjectStore) AddObject(yamlBytes []byte) error

Add object to store

func (*ObjectStore) AddObjectFromPath

func (s *ObjectStore) AddObjectFromPath(path string) error

Read Object from Path

func (*ObjectStore) AddObjectFromURL

func (s *ObjectStore) AddObjectFromURL(url string) error

Read Object from a URL

func (*ObjectStore) AddObjectsFromDir

func (s *ObjectStore) AddObjectsFromDir(path string) error

Read Object/s from a Directory

func (*ObjectStore) FilterByKind

func (s *ObjectStore) FilterByKind(kind string) (ObjectStore, error)

Filter ObjectStore by kind

func (*ObjectStore) JsonPatch

func (s *ObjectStore) JsonPatch(p []byte, t Target) error

JsonPatch applies a json patch to selected Objects in the store.

func (*ObjectStore) Print

func (s *ObjectStore) Print(sort bool) error

Print all Objects in store

func (*ObjectStore) StrategicPatch

func (s *ObjectStore) StrategicPatch(p Object, t Target) error

StrategicPatch applies a strategic patch to selected Objects in the store.

type Target

type Target struct {
	Group              string `json:"group" yaml:"group"`
	Version            string `json:"version" yaml:"version"`
	Kind               string `json:"kind" yaml:"kind"`
	Name               string `json:"name" yaml:"name"`
	Namespace          string `json:"namespace" yaml:"namespace"`
	AnnotationSelector string `json:"annotationSelector" yaml:"annotationSelector"`
	LabelSelector      string `json:"labelSelector" yaml:"labelSelector"`
}

Jump to

Keyboard shortcuts

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