kubernetes

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FailIfClusterIsNotReachable

func FailIfClusterIsNotReachable(kubeContext string) error

FailIfClusterIsNotReachable checks that Kubernetes is reachable. This gives a clear early error when the cluster can't be reached.

func HasKubernetesFileExtension

func HasKubernetesFileExtension(n string) bool

HasKubernetesFileExtension is for determining if a file under a glob pattern is deployable file format. It makes no attempt to check whether or not the file is actually deployable or has the correct contents.

func IsKubernetesManifest

func IsKubernetesManifest(file string) bool

IsKubernetesManifest is for determining if a file is a valid Kubernetes manifest

func ParseImagesFromKubernetesYaml

func ParseImagesFromKubernetesYaml(filepath string) ([]string, error)

ParseImagesFromKubernetesYaml parses the kubernetes yamls, and if it finds at least one valid Kubernetes object, it will return the images referenced in them.

func ParseKubernetesObjects added in v2.4.0

func ParseKubernetesObjects(filepath string) ([]yamlObject, error)

ParseKubernetesObjects uses required fields from the k8s spec to determine if a provided yaml file is a valid k8s manifest, as detailed in https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields. If so, it will return the parsed objects.

func TopLevelOwnerKey

func TopLevelOwnerKey(ctx context.Context, obj metav1.Object, kubeContext string, kind string) string

TopLevelOwnerKey returns a key associated with the top level owner of a Kubernetes resource in the form Kind-Name

func WaitForDeploymentToStabilize

func WaitForDeploymentToStabilize(ctx context.Context, c kubernetes.Interface, ns, name string, timeout time.Duration) error

WaitForDeploymentToStabilize waits until the Deployment has a matching generation/replica count between spec and status.

func WaitForPodInitialized

func WaitForPodInitialized(ctx context.Context, pods corev1.PodInterface, podName string) error

WaitForPodInitialized waits until init containers have started running

func WaitForPodSucceeded

func WaitForPodSucceeded(ctx context.Context, pods corev1.PodInterface, podName string, timeout time.Duration) error

WaitForPodSucceeded waits until the Pod status is Succeeded.

Types

type ImageList

type ImageList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ImageList implements PodSelector based on a list of images names.

func NewImageList

func NewImageList() *ImageList

NewImageList creates a new ImageList.

func (*ImageList) Add

func (l *ImageList) Add(image string)

Add adds an image to the list.

func (*ImageList) Select

func (l *ImageList) Select(pod *v1.Pod) bool

Select returns true if one of the pod's images is in the list.

type ImageListMux

type ImageListMux []*ImageList

TODO(nkubala): remove this when podSelector is moved entirely into Deployer

func (ImageListMux) Select

func (l ImageListMux) Select(pod *v1.Pod) bool

type PodEvent

type PodEvent struct {
	Type watch.EventType
	Pod  *v1.Pod
}

type PodSelector

type PodSelector interface {
	Select(pod *v1.Pod) bool
}

PodSelector is used to choose which pods to log.

type PodWatcher

type PodWatcher interface {
	Register(receiver chan<- PodEvent)
	Deregister(receiver chan<- PodEvent)
	Start(ctx context.Context, kubeContext string, ns []string) (func(), error)
}

func NewPodWatcher

func NewPodWatcher(podSelector PodSelector) PodWatcher

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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