k8s

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeployOwnerKey = ".metadata.controller"
	// BuildIDLabel is the label that identifies the build ID for a deployment
	BuildIDLabel = "temporal.io/build-id"

	WorkerDeploymentNameSeparator = "/"
	ResourceNameSeparator         = "-"
	MaxBuildIDLen                 = 63
	MaxDeploymentNameLen          = 47
	ConnectionSpecHashAnnotation  = "temporal.io/connection-spec-hash"
	PodTemplateSpecHashAnnotation = "temporal.io/pod-template-spec-hash"
)

Variables

This section is empty.

Functions

func ApplyControllerPodSpecModifications added in v1.2.0

func ApplyControllerPodSpecModifications(
	podSpec *corev1.PodSpec,
	connection temporaliov1alpha1.TemporalConnectionSpec,
	temporalNamespace string,
	workerDeploymentName string,
	buildID string,
)

ApplyControllerPodSpecModifications applies controller-managed environment variables and volume mounts to a pod spec. This is used both when creating new deployments and when updating existing deployments for drift detection.

func CleanStringForDNS added in v1.0.0

func CleanStringForDNS(s string) string

func ComputeConnectionSpecHash added in v0.1.5

func ComputeConnectionSpecHash(connection temporaliov1alpha1.TemporalConnectionSpec) string

TODO (Shivam): Change hash when secret name is updated as well.

func ComputePodTemplateSpecHash added in v1.2.0

func ComputePodTemplateSpecHash(template corev1.PodTemplateSpec) string

ComputePodTemplateSpecHash computes a SHA256 hash of the user-provided pod template spec. This hash is used to detect drift when the build ID is stable but the pod spec has changed. The hash captures ALL user-controllable fields in the pod template spec.

func ComputeVersionedDeploymentName

func ComputeVersionedDeploymentName(baseName, buildID string) string

ComputeVersionedDeploymentName generates a name for a versioned deployment Name will be <=47 characters and unique for that Worker Deployment Version within the namespace.

func ComputeWorkerDeploymentName

func ComputeWorkerDeploymentName(w *temporaliov1alpha1.TemporalWorkerDeployment) string

ComputeWorkerDeploymentName generates the base worker deployment name

func HashString added in v1.3.0

func HashString(s string) string

func IsDeploymentHealthy

func IsDeploymentHealthy(deployment *appsv1.Deployment) (bool, *metav1.Time)

IsDeploymentHealthy checks if a deployment is in the "Available" state

func NewDeploymentWithControllerRef

func NewDeploymentWithControllerRef(
	w *temporaliov1alpha1.TemporalWorkerDeployment,
	buildID string,
	connection temporaliov1alpha1.TemporalConnectionSpec,
	reconcilerScheme *runtime.Scheme,
) (*appsv1.Deployment, error)

func NewDeploymentWithOwnerRef

func NewDeploymentWithOwnerRef(
	typeMeta *metav1.TypeMeta,
	objectMeta *metav1.ObjectMeta,
	spec *temporaliov1alpha1.TemporalWorkerDeploymentSpec,
	workerDeploymentName string,
	buildID string,
	connection temporaliov1alpha1.TemporalConnectionSpec,
) *appsv1.Deployment

NewDeploymentWithOwnerRef creates a new deployment resource, including owner references

func NewObjectRef

func NewObjectRef(obj client.Object) *corev1.ObjectReference

NewObjectRef creates a reference to a Kubernetes object

func TruncateString added in v1.0.0

func TruncateString(s string, n int) string

TruncateString truncates string to the first n characters. Pass n = -1 to skip truncation.

Types

type DeploymentState

type DeploymentState struct {
	// Map of buildID to deployment
	Deployments map[string]*appsv1.Deployment
	// Sorted deployments by creation time
	DeploymentsByTime []*appsv1.Deployment
	// Map of buildID to deployment references
	DeploymentRefs map[string]*corev1.ObjectReference
}

DeploymentState represents the Kubernetes state of all deployments for a temporal worker deployment

func GetDeploymentState

func GetDeploymentState(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	ownerName string,
	workerDeploymentName string,
) (*DeploymentState, error)

GetDeploymentState queries Kubernetes to get the state of all deployments associated with a TemporalWorkerDeployment

Jump to

Keyboard shortcuts

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