planner

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveGateInput added in v1.1.1

func ResolveGateInput(gate *temporaliov1alpha1.GateWorkflowConfig, namespace string, configMapData map[string]string, configMapBinaryData map[string][]byte, secretData map[string][]byte) ([]byte, bool, error)

ResolveGateInput resolves the gate input from inline JSON or from a referenced ConfigMap/Secret Returns the input bytes and a boolean indicating whether the input came from a Secret

Types

type Config

type Config struct {
	// RolloutStrategy to use
	RolloutStrategy temporaliov1alpha1.RolloutStrategy
}

Config holds the configuration for planning

type Plan

type Plan struct {
	// Which actions to take
	DeleteDeployments      []*appsv1.Deployment
	ScaleDeployments       map[*corev1.ObjectReference]uint32
	UpdateDeployments      []*appsv1.Deployment
	ShouldCreateDeployment bool
	VersionConfig          *VersionConfig
	TestWorkflows          []WorkflowConfig

	// ApplyWorkerResources holds resources to apply via SSA, one per (WRT × Build ID) pair.
	ApplyWorkerResources []WorkerResourceApply
	// DeleteWorkerResources lists rendered WRT resource copies to delete explicitly.
	// Populated when a versioned Deployment is being deleted (version sunset), since
	// rendered resources are now owned by the WRT (not the Deployment) and therefore
	// are not GC'd automatically when the Deployment is removed.
	DeleteWorkerResources []WorkerResourceRef
	// EnsureWRTOwnerRefs holds (base, patched) pairs for WRTs that need a
	// controller owner reference added, ready for client.MergeFrom patching.
	// These point from each WRT → the TWD, so the WRT is GC'd when the TWD is
	// deleted. The controller sets this (rather than the webhook) because the owner
	// ref requires the TWD's UID, resolved from spec.temporalWorkerDeploymentRef.
	EnsureWRTOwnerRefs []WRTOwnerRefPatch
}

Plan holds the actions to execute during reconciliation

func GeneratePlan

func GeneratePlan(
	l logr.Logger,
	k8sState *k8s.DeploymentState,
	status *temporaliov1alpha1.TemporalWorkerDeploymentStatus,
	spec *temporaliov1alpha1.TemporalWorkerDeploymentSpec,
	temporalState *temporal.TemporalWorkerState,
	connection temporaliov1alpha1.TemporalConnectionSpec,
	config *Config,
	workerDeploymentName string,
	maxVersionsIneligibleForDeletion int32,
	gateInput []byte,
	isGateInputSecret bool,
	wrts []temporaliov1alpha1.WorkerResourceTemplate,
	twdName string,
	twdUID types.UID,
) (*Plan, error)

GeneratePlan creates a plan for updating the worker deployment

type VersionConfig

type VersionConfig struct {
	// Token to use for conflict detection
	ConflictToken []byte
	// Build ID for the version
	BuildID string

	// Set this as the build ID for all new executions
	SetCurrent bool
	// Acceptable values [0,100]
	RampPercentage int32

	// ManagerIdentity is the current manager identity of the worker deployment in Temporal.
	// An empty string indicates the controller should claim the identity before applying
	// any routing config changes.
	ManagerIdentity string
}

VersionConfig defines version configuration for Temporal

type WRTOwnerRefPatch added in v1.5.0

WRTOwnerRefPatch holds a WRT pair for a single merge-patch: Base is the unmodified object (used as the patch base), Patched has the controller owner reference already appended.

type WorkerResourceApply added in v1.5.0

type WorkerResourceApply struct {
	Resource     *unstructured.Unstructured
	WRTName      string
	WRTNamespace string
	BuildID      string
	// RenderError is set when rendering spec.template failed. No SSA apply is attempted;
	// the error is recorded in the per-BuildID status entry and reflected in the Ready condition.
	RenderError error
	// RenderedHash is the hash of the rendered Resource object (see k8s.ComputeRenderedObjectHash).
	// Empty string means hashing failed; the apply will proceed unconditionally.
	RenderedHash string
	// LastAppliedHash is the hash recorded in the WRT status from the last successful apply.
	// If RenderedHash == LastAppliedHash (and both are non-empty), the controller skips the
	// SSA apply because the rendered output is identical to what is already on the cluster.
	LastAppliedHash string
}

WorkerResourceApply holds a rendered worker resource template to apply via Server-Side Apply. If RenderError is non-nil, Resource is nil and the apply must be skipped; the error is surfaced in the WRT status and Ready condition just like an SSA apply failure.

type WorkerResourceRef added in v1.5.0

type WorkerResourceRef struct {
	Namespace  string
	Name       string
	APIVersion string
	Kind       string
}

WorkerResourceRef identifies a single rendered WRT resource copy to delete.

type WorkflowConfig

type WorkflowConfig struct {
	WorkflowType string
	WorkflowID   string
	BuildID      string
	TaskQueue    string
	GateInput    string
	// IsInputSecret indicates whether the GateInput came from a Secret reference
	// and should be treated as sensitive (not logged)
	IsInputSecret bool
}

WorkflowConfig defines a workflow to be started

Jump to

Keyboard shortcuts

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