k8s

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 16 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"
	DeploymentNameSeparator      = "/" // TODO(carlydf): change this to "." once the server accepts `.` in deployment names
	VersionIDSeparator           = "." // TODO(carlydf): change this to ":"
	K8sResourceNameSeparator     = "-"
	MaxBuildIdLen                = 63
	ConnectionSpecHashAnnotation = "temporal.io/connection-spec-hash"
)

Variables

This section is empty.

Functions

func CleanAndTruncateString

func CleanAndTruncateString(s string, n int) string

CleanAndTruncateString truncates string to the first n characters, and then replaces characters that can't be in a kubernetes resource name with a `-` character which can be. Pass n = -1 to skip truncation.

func ComputeConnectionSpecHash added in v0.1.5

func ComputeConnectionSpecHash(connection temporaliov1alpha1.TemporalConnectionSpec) string

func ComputeVersionID

ComputeVersionID generates a version ID from the worker deployment spec

func ComputeVersionedDeploymentName

func ComputeVersionedDeploymentName(baseName, buildID string) string

ComputeVersionedDeploymentName generates a name for a versioned deployment

func ComputeWorkerDeploymentName

func ComputeWorkerDeploymentName(w *temporaliov1alpha1.TemporalWorkerDeployment) string

ComputeWorkerDeploymentName generates the base worker deployment name

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 SplitVersionID

func SplitVersionID(versionID string) (deploymentName, buildID string, err error)

SplitVersionID splits a version ID into its components

Types

type DeploymentState

type DeploymentState struct {
	// Map of versionID to deployment
	Deployments map[string]*appsv1.Deployment
	// Sorted deployments by creation time
	DeploymentsByTime []*appsv1.Deployment
	// Map of 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