workload

package
v1.0.131 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKindNotSupported = errors.New("workload kind not supported")

Functions

func CalculateWorkloadRuntimeObjectName added in v1.0.93

func CalculateWorkloadRuntimeObjectName[T string | WorkloadKind | WorkloadKindLowerCase](workloadName string, workloadKind T) string

func ClientObjectFromWorkloadKind added in v1.0.93

func ClientObjectFromWorkloadKind(kind WorkloadKind) client.Object

ClientObjectFromWorkloadKind returns a new instance of the client object for the given workload kind the returned instance is empty and should be used to fetch the actual object from the k8s api server

func GetInstrumentationLabelTexts added in v1.0.124

func GetInstrumentationLabelTexts(workloadLabels map[string]string, workloadKind string, nsLabels map[string]string) (workloadText, nsText, decisionText string, sourceInstrumented bool)

func GetInstrumentationLabelValue added in v1.0.124

func GetInstrumentationLabelValue(labels map[string]string) *bool

func IgnoreErrorKindNotSupported added in v1.0.93

func IgnoreErrorKindNotSupported(err error) error

func IsErrorKindNotSupported added in v1.0.93

func IsErrorKindNotSupported(err error) bool

func IsInstrumentationDisabledExplicitly added in v1.0.82

func IsInstrumentationDisabledExplicitly(obj client.Object) bool

func IsObjectLabeledForInstrumentation added in v1.0.71

func IsObjectLabeledForInstrumentation(obj client.Object) bool

func IsWorkloadInstrumentationEffectiveEnabled added in v1.0.82

func IsWorkloadInstrumentationEffectiveEnabled(ctx context.Context, kubeClient client.Client, obj client.Object) (bool, error)

Types

type DaemonSetWorkload added in v1.0.71

type DaemonSetWorkload struct {
	*v1.DaemonSet
}

func (*DaemonSetWorkload) AvailableReplicas added in v1.0.71

func (d *DaemonSetWorkload) AvailableReplicas() int32

type DeploymentWorkload added in v1.0.71

type DeploymentWorkload struct {
	*v1.Deployment
}

func (*DeploymentWorkload) AvailableReplicas added in v1.0.71

func (d *DeploymentWorkload) AvailableReplicas() int32

type PodWorkload added in v1.0.93

type PodWorkload struct {
	Name      string       `json:"name"`
	Namespace string       `json:"namespace"`
	Kind      WorkloadKind `json:"kind"`
}

PodWorkload represents the higher-level controller managing a specific Pod within a Kubernetes cluster. It contains essential details about the controller such as its Name, Namespace, and Kind. 'Kind' refers to the type of controller, which can be a Deployment, StatefulSet, or DaemonSet. This struct is useful for identifying and interacting with the overarching entity that governs the lifecycle and behavior of a Pod, especially in contexts where understanding the relationship between a Pod and its controlling workload is crucial.

type StatefulSetWorkload added in v1.0.71

type StatefulSetWorkload struct {
	*v1.StatefulSet
}

func (*StatefulSetWorkload) AvailableReplicas added in v1.0.71

func (s *StatefulSetWorkload) AvailableReplicas() int32

type Workload added in v1.0.71

type Workload interface {
	client.Object
	AvailableReplicas() int32
}

func ObjectToWorkload added in v1.0.71

func ObjectToWorkload(obj client.Object) (Workload, error)

type WorkloadKind added in v1.0.93

type WorkloadKind string

1. the pascal case representation of the workload kind it is used in k8s api objects as the `Kind` field.

const (
	WorkloadKindDeployment  WorkloadKind = "Deployment"
	WorkloadKindDaemonSet   WorkloadKind = "DaemonSet"
	WorkloadKindStatefulSet WorkloadKind = "StatefulSet"
)

func ExtractWorkloadInfoFromRuntimeObjectName added in v1.0.93

func ExtractWorkloadInfoFromRuntimeObjectName(runtimeObjectName string) (workloadName string, workloadKind WorkloadKind, err error)

func GetWorkloadFromOwnerReference added in v1.0.93

func GetWorkloadFromOwnerReference(ownerReference metav1.OwnerReference) (workloadName string, workloadKind WorkloadKind, err error)

GetWorkloadFromOwnerReference retrieves both the workload name and workload kind from the provided owner reference.

func GetWorkloadNameAndKind added in v1.0.112

func GetWorkloadNameAndKind(ownerName, ownerKind string) (string, WorkloadKind, error)

func WorkloadKindFromClientObject added in v1.0.93

func WorkloadKindFromClientObject(w client.Object) WorkloadKind

func WorkloadKindFromLowerCase added in v1.0.93

func WorkloadKindFromLowerCase(lowerCase WorkloadKindLowerCase) WorkloadKind

func WorkloadKindFromString added in v1.0.93

func WorkloadKindFromString(kind string) WorkloadKind

type WorkloadKindLowerCase added in v1.0.93

type WorkloadKindLowerCase string

2. the lower case representation of the workload kind is used in odigos with the object name for instrumentation config and runtime details

const (
	WorkloadKindLowerCaseDeployment  WorkloadKindLowerCase = "deployment"
	WorkloadKindLowerCaseDaemonSet   WorkloadKindLowerCase = "daemonset"
	WorkloadKindLowerCaseStatefulSet WorkloadKindLowerCase = "statefulset"
)

func WorkloadKindLowerCaseFromKind added in v1.0.93

func WorkloadKindLowerCaseFromKind(pascalCase WorkloadKind) WorkloadKindLowerCase

Jump to

Keyboard shortcuts

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