utils

package
v0.1.1 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: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNamespaceConflict = errors.New("provided namespace conflicts with YAML object")
View Source
var ErrNoNamespace = errors.New("could not determine namespace for namespace-scoped entity")
View Source
var ErrOperatorNotDeployed = errors.New("the ClickHouse Operator is not fully deployed")

Functions

func DecodeYAMLToObject

func DecodeYAMLToObject(yaml string) (*unstructured.Unstructured, error)

func InitK8s

func InitK8s(kubeconfig string) error

func ReadFilesToStrings

func ReadFilesToStrings(fs *embed.FS, reqs []FileToString) error

func SplitYAMLDocs

func SplitYAMLDocs(yaml string) ([]string, error)

Types

type FileToString

type FileToString struct {
	Filename string
	Dest     *string
}

type K8s

type K8s struct {
	Config          *rest.Config
	Clientset       *kubernetes.Clientset
	ChopClientset   *chopclientset.Clientset
	DiscoveryClient *discovery.DiscoveryClient
	RESTMapper      *restmapper.DeferredDiscoveryRESTMapper
	DynamicClient   dynamic.Interface
	// contains filtered or unexported fields
}

func GetK8s

func GetK8s() *K8s

GetK8s gets a reference to the global Kubernetes instance. The caller must call ReleaseK8s.

func (*K8s) MultiYamlApply

func (k *K8s) MultiYamlApply(yaml string, namespace string) error

MultiYamlApply does a server-side apply of a given YAML string, which may contain multiple documents

func (*K8s) MultiYamlApplySelectively

func (k *K8s) MultiYamlApplySelectively(yaml string, namespace string, selector SelectorFunc) error

MultiYamlApplySelectively does a selective server-side apply of multiple docs from a given YAML string

func (*K8s) MultiYamlDelete

func (k *K8s) MultiYamlDelete(yaml string, namespace string) error

MultiYamlDelete deletes the resources identified in a given YAML string

func (*K8s) Reinit

func (k *K8s) Reinit() error

Reinit reinitializes Kubernetes. The caller must not hold an open GetK8s() reference.

func (*K8s) ReleaseK8s

func (k *K8s) ReleaseK8s()

ReleaseK8s releases the reference held by the caller.

func (*K8s) SingleObjectCreate

func (k *K8s) SingleObjectCreate(obj *unstructured.Unstructured, namespace string) error

SingleObjectCreate creates a new resource from a single unstructured object

func (*K8s) SingleObjectUpdate

func (k *K8s) SingleObjectUpdate(obj *unstructured.Unstructured, namespace string) error

SingleObjectUpdate updates an existing object from a single unstructured object

type SelectorFunc

type SelectorFunc func([]*unstructured.Unstructured) []*unstructured.Unstructured

Jump to

Keyboard shortcuts

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