k8sutil

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package k8sutil contains utility functions for Kubernetes resources.

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient *kubernetes.Clientset

DefaultClient represents a client for performing raw CRUD operations against the Kubernetes API

Functions

func CreationSpecsEqual

func CreationSpecsEqual(m1 metav1.ObjectMeta, m2 metav1.ObjectMeta) bool

CreationSpecsEqual returns true if the two objects spec annotations are equal.

func GetDesktopLabels

func GetDesktopLabels(c *appv1.VDICluster, desktop *desktopsv1.Session) map[string]string

GetDesktopLabels returns the labels to apply to components for a desktop.

func GetThisPod

func GetThisPod(c client.Client) (*corev1.Pod, error)

GetThisPod attempts to return the full pod object of the requesting instance.

func GetThisPodName

func GetThisPodName() (string, error)

GetThisPodName attempts to return the name of the running pod from the environment.

func GetThisPodNamespace

func GetThisPodNamespace() (string, error)

GetThisPodNamespace attempts to return the namespace of the running pod from the environment.

func IsMarkedForDeletion

func IsMarkedForDeletion(cr *appv1.VDICluster) bool

IsMarkedForDeletion returns true if the given cluster is marked for deletion.

func LookupClusterByName

func LookupClusterByName(c client.Client, name string) (*appv1.VDICluster, error)

LookupClusterByName fetches the VDICluster with the given name

func SetCreationSpecAnnotation

func SetCreationSpecAnnotation(meta *metav1.ObjectMeta, obj runtime.Object) error

SetCreationSpecAnnotation sets an annotation with a checksum of the desired spec of the object.

Types

type LogFollower

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

LogFollower implements a ReadCloser for reading logs from a container in a pod.

func NewLogFollower

func NewLogFollower(pod *corev1.Pod, containerName string) *LogFollower

NewLogFollower returns a new LogFollower for the given pod and container.

func (*LogFollower) Close

func (l *LogFollower) Close() error

Close cancels the log stream

func (*LogFollower) Read

func (l *LogFollower) Read(p []byte) (int, error)

Read reads data from the log buffer

func (*LogFollower) Stream

func (l *LogFollower) Stream(follow bool) error

Stream will start the log stream

func (*LogFollower) Write

func (l *LogFollower) Write(p []byte) (int, error)

Write writes data to the log buffer

Jump to

Keyboard shortcuts

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