workload

package
v0.0.0-...-b3aaee5 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package workload Copyright 2022 VMware, Inc. SPDX-License-Identifier: Apache-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	// Deployment represents the Deployment workload.
	Deployment = "Deployment"
	// ReplicaSet represents the ReplicaSet workload.
	ReplicaSet = "ReplicaSet"
	// StatefulSet represents the StatefulSet workload.
	StatefulSet = "StatefulSet"
	// DaemonSet represents the DaemonSet workload.
	DaemonSet = "DaemonSet"
	// CronJob represents the CronJob workload.
	CronJob = "CronJob"
	// Job represents the Job workload.
	Job = "Job"
)

Variables

AllWorkloads ...

Functions

This section is empty.

Types

type Collector

type Collector interface {
	// CollectNamespaces scans all the namespaces matching the selector and
	// excluded by the skips slice.
	CollectNamespaces(ctx context.Context, selector *metav1.LabelSelector, skips []string) ([]corev1.ObjectReference, error)
	// CollectWorkloads scans all the workloads that matches the selector under the namespace.
	CollectWorkloads(ctx context.Context, namespace corev1.LocalObjectReference, selector *metav1.LabelSelector) ([]*Workload, error)
	// CollectOtherResource scans any kind resource that matches the selector under the namespace.
	CollectOtherResource(ctx context.Context, namespace corev1.LocalObjectReference, selector *metav1.LabelSelector, list client.ObjectList) error
}

Collector used to scan workloads of the cluster.

type Container

type Container struct {
	// Name of the container.
	Name string `json:"name"`
	// ID of the container.
	ID string `json:"id"`
	// Image of the container.
	Image string `json:"image"`
	// ImageID of the container.
	ImageID string `json:"imageID"`
	// IsInit indicate if the container is an init container.
	IsInit bool `json:"isInit"`
}

Container for representing kubernetes Container.

type DefaultCollector

type DefaultCollector struct {
	client.Client
	// contains filtered or unexported fields
}

DefaultCollector implements the interface Collector

func NewCollector

func NewCollector() *DefaultCollector

NewCollector news a default collector.

func (*DefaultCollector) CollectNamespaces

func (dc *DefaultCollector) CollectNamespaces(ctx context.Context, selector *metav1.LabelSelector, skips []string) ([]corev1.ObjectReference, error)

CollectNamespaces implements inspection.Collectner.

func (*DefaultCollector) CollectOtherResource

func (dc *DefaultCollector) CollectOtherResource(ctx context.Context, namespace corev1.LocalObjectReference,
	selector *metav1.LabelSelector, list client.ObjectList) error

CollectOtherResource implements inspection.Collectner.

func (*DefaultCollector) CollectWorkloads

func (dc *DefaultCollector) CollectWorkloads(ctx context.Context, namespace corev1.LocalObjectReference, selector *metav1.LabelSelector) ([]*Workload, error)

CollectWorkloads implements inspection.Collectner.

func (*DefaultCollector) Complete

func (dc *DefaultCollector) Complete() Collector

Complete returns the collector interface.

func (*DefaultCollector) UseClient

func (dc *DefaultCollector) UseClient(client client.Client) *DefaultCollector

UseClient uses the client.

func (*DefaultCollector) WithScheme

func (dc *DefaultCollector) WithScheme(scheme *runtime.Scheme) *DefaultCollector

WithScheme sets schema.

type Pod

type Pod struct {
	corev1.ObjectReference `json:"metadata"`
	// Containers of the pod.
	Containers []*Container `json:"containers"`
}

Pod for representing kubernetes Pod.

type Workload

type Workload struct {
	// For pure Pod, no object reference.
	corev1.ObjectReference `json:"metadata"`
	// Pods of this workload.
	Pods []*Pod `json:"pods"`
}

Workload is the kubernetes workload, including: Deployment,ReplicaSet,StatefulSet,DaemonSet,CronJob and Job. The workload is described with the following structure: workload -> pod -> containers (+images) For the kubernetes native resources, use ObjectReference to refer.

Jump to

Keyboard shortcuts

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