temporal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package temporal contains Temporal-version-aware helpers: the supported version compatibility matrix and the server config-template renderer.

The matrix data lives in versions_gen.go, which is generated from hack/version-matrix.yaml by `make gen-version-matrix`. Edit the YAML, not the generated Go.

Index

Constants

This section is empty.

Variables

View Source
var ErrNamespaceNotFound = errors.New("namespace not found")

ErrNamespaceNotFound is returned by Describe when the namespace does not exist.

View Source
var ErrScheduleNotFound = errors.New("schedule not found")

ErrScheduleNotFound is returned by Describe when the schedule does not exist.

Functions

func AdminToolsImage

func AdminToolsImage(version string) string

AdminToolsImage returns the Temporal admin-tools image for a version, used to run schema setup and migrations.

func CanUpgrade

func CanUpgrade(from, to string) (bool, error)

CanUpgrade reports whether a cluster may move from version `from` to version `to`.

func DefaultServicePorts

func DefaultServicePorts() map[string]ServicePort

DefaultServicePorts returns the default ports for each Temporal service keyed by the service's component name (frontend, history, matching, worker, internal-frontend).

func DefaultUIVersion

func DefaultUIVersion(serverVersion string) string

DefaultUIVersion returns the known-good UI version for a server version, or an empty string when the server version is unknown.

func DevServerCLIVersion added in v0.8.0

func DevServerCLIVersion(serverVersion string) string

DevServerCLIVersion returns the temporalio/temporal CLI image tag that runs the given Temporal server version, or an empty string when the server version is unknown or has no dev-server mapping.

func IsSupported

func IsSupported(version string) bool

IsSupported reports whether the exact patch version is in the support matrix.

func LatestSupportedVersion added in v0.8.0

func LatestSupportedVersion() string

LatestSupportedVersion returns the highest supported Temporal server patch version in the matrix, or an empty string when the matrix is empty.

func RenderClusterConfig

func RenderClusterConfig(cluster *temporalv1alpha1.TemporalCluster, opts BuildOptions) (string, error)

RenderClusterConfig is a convenience that builds and renders in one step.

func RenderConfig

func RenderConfig(data *ConfigData) (string, error)

RenderConfig renders the resolved ConfigData into a Temporal server config YAML.

func RenderDynamicConfig

func RenderDynamicConfig(spec *temporalv1alpha1.DynamicConfigSpec, version string) (rendered string, warnings []string, err error)

RenderDynamicConfig renders a Temporal dynamicconfig.yaml document from the spec's dynamic config values. Keys are emitted in sorted order for deterministic output. Unknown keys (relative to the target version's matrix) are returned as warnings; keys removed in the target version cause an error.

func ResolveLatestPatch

func ResolveLatestPatch(minor string) (string, error)

ResolveLatestPatch returns the highest supported patch version for a minor.

func ServerImage

func ServerImage(version string) string

ServerImage returns the default Temporal server image for a version.

func SupportedVersions

func SupportedVersions() []string

SupportedVersions returns the sorted list of supported exact patch versions.

func ValidateUpgradePath

func ValidateUpgradePath(from, to string) error

ValidateUpgradePath returns nil if a cluster may move from version `from` to version `to` (both may be minor or exact).

Types

type ArchivalConfig

type ArchivalConfig struct {
	HistoryState    string
	VisibilityState string
}

ArchivalConfig holds resolved archival settings.

type AuthConfig

type AuthConfig struct {
	Authorizer  string
	ClaimMapper string
}

AuthConfig holds resolved authorization settings.

type BuildOptions

type BuildOptions struct {
	// BindOnIP is the address services bind to. Defaults to "0.0.0.0".
	BindOnIP string
	// BroadcastAddress is the membership broadcast address (typically the pod IP).
	BroadcastAddress string
	// DynamicConfigPath overrides the default dynamic config file path.
	DynamicConfigPath string
	// DefaultStorePassword / VisibilityStorePassword are the resolved passwords.
	DefaultStorePassword    string
	VisibilityStorePassword string
	// DefaultStorePasswordCommand / VisibilityStorePasswordCommand are used for
	// Temporal 1.31+ IAM auth instead of a static password.
	DefaultStorePasswordCommand    string
	VisibilityStorePasswordCommand string
	// PublicClientHostPort overrides the publicClient host:port.
	PublicClientHostPort string
}

BuildOptions carries runtime-resolved values that are not derivable from the CR alone (resolved secret values and pod-network details).

type ConfigData

type ConfigData struct {
	Version                  string
	LogLevel                 string
	NumHistoryShards         int32
	DefaultStoreName         string
	VisibilityStoreName      string
	DefaultStore             DatastoreConfig
	VisibilityStore          DatastoreConfig
	BindOnIP                 string
	BroadcastAddress         string
	MTLS                     MTLSConfig
	Metrics                  MetricsConfig
	Authorization            *AuthConfig
	Services                 map[string]ServicePort
	UseInternalFrontend      bool
	EnableGlobalNamespace    bool
	CurrentClusterName       string
	MasterClusterName        string
	FailoverVersionIncrement int
	InitialFailoverVersion   int
	DynamicConfigPath        string
	Archival                 *ArchivalConfig
	PublicClient             string
}

ConfigData is the fully-resolved input to the config template.

func BuildConfigData

func BuildConfigData(cluster *temporalv1alpha1.TemporalCluster, opts BuildOptions) (*ConfigData, error)

BuildConfigData resolves a TemporalCluster CR plus runtime options into a ConfigData ready for rendering.

type DatastoreConfig

type DatastoreConfig struct {
	// Kind is "sql", "cassandra", or "elasticsearch".
	Kind string

	// SQL fields.
	PluginName      string
	DatabaseName    string
	ConnectAddr     string
	User            string
	Password        string
	PasswordCommand string
	MaxConns        int32
	MaxIdleConns    int32
	MaxConnLifetime string

	// Cassandra fields.
	Hosts      string
	Keyspace   string
	Port       int32
	Datacenter string

	// Elasticsearch fields.
	ESVersion       string
	URLScheme       string
	URLHost         string
	VisibilityIndex string

	TLS *DatastoreTLS
}

DatastoreConfig is a fully-resolved datastore configuration.

type DatastoreTLS

type DatastoreTLS struct {
	Enabled                bool
	CAFile                 string
	CertFile               string
	KeyFile                string
	EnableHostVerification bool
	ServerName             string
}

DatastoreTLS holds TLS file paths for a datastore connection.

type IntervalParams added in v0.5.0

type IntervalParams struct {
	Every  time.Duration
	Offset *time.Duration
}

IntervalParams is an interval-based fire spec.

type MTLSConfig

type MTLSConfig struct {
	Enabled             bool
	RefreshInterval     string
	RequireClientAuth   bool
	InternodeServerCert string
	InternodeServerKey  string
	InternodeClientCA   string
	InternodeServerName string
	FrontendServerCert  string
	FrontendServerKey   string
	FrontendServerName  string
	SystemWorkerCert    string
	SystemWorkerKey     string
	SystemWorkerCA      string
	SystemWorkerName    string
}

MTLSConfig holds resolved mTLS file paths and settings.

type MetricsConfig

type MetricsConfig struct {
	Enabled       bool
	ListenAddress string
}

MetricsConfig holds resolved Prometheus settings.

type NamespaceClient

type NamespaceClient interface {
	Describe(ctx context.Context, name string) (*NamespaceInfo, error)
	Register(ctx context.Context, params NamespaceParams) error
	Update(ctx context.Context, params NamespaceParams) error
	// Failover changes only the namespace's active cluster. It must be a
	// standalone call: Temporal rejects an active-cluster change combined with
	// any other update parameters.
	Failover(ctx context.Context, name, activeCluster string) error
	Delete(ctx context.Context, name string) error
	Close() error
}

NamespaceClient manages namespaces in a Temporal cluster.

func NewNamespaceClient

func NewNamespaceClient(_ context.Context, address string, tlsConfig *tls.Config) (NamespaceClient, error)

NewNamespaceClient dials the frontend and returns a NamespaceClient.

type NamespaceClientFactory

type NamespaceClientFactory func(ctx context.Context, address string, tlsConfig *tls.Config) (NamespaceClient, error)

NamespaceClientFactory builds a NamespaceClient connected to a frontend address. A nil tlsConfig means an insecure connection.

type NamespaceInfo

type NamespaceInfo struct {
	ID              string
	Description     string
	OwnerEmail      string
	RetentionPeriod time.Duration
	IsGlobal        bool
	ActiveCluster   string
	Clusters        []string
}

NamespaceInfo is the observed state of a Temporal namespace.

type NamespaceParams

type NamespaceParams struct {
	Name            string
	Description     string
	OwnerEmail      string
	RetentionPeriod time.Duration
	IsGlobal        bool
	Clusters        []string
	ActiveCluster   string
}

NamespaceParams describes the desired state of a Temporal namespace.

type RangeParams added in v0.5.0

type RangeParams struct {
	Start int32
	End   int32
	Step  int32
}

RangeParams is an inclusive [Start,End] range with Step.

type RemoteClusterClient added in v0.9.0

type RemoteClusterClient interface {
	ListRemoteClusters(ctx context.Context) ([]RemoteClusterInfo, error)
	UpsertRemoteCluster(ctx context.Context, frontendAddress string, enableConnection bool) error
	RemoveRemoteCluster(ctx context.Context, name string) error
	Close() error
}

RemoteClusterClient manages remote-cluster connections on a Temporal cluster.

func NewRemoteClusterClient added in v0.9.0

func NewRemoteClusterClient(ctx context.Context, address string, tlsConfig *tls.Config) (RemoteClusterClient, error)

NewRemoteClusterClient dials the frontend and returns a RemoteClusterClient.

type RemoteClusterClientFactory added in v0.9.0

type RemoteClusterClientFactory func(ctx context.Context, address string, tlsConfig *tls.Config) (RemoteClusterClient, error)

RemoteClusterClientFactory builds a RemoteClusterClient connected to a frontend.

type RemoteClusterInfo added in v0.9.0

type RemoteClusterInfo struct {
	Name                   string
	Address                string
	InitialFailoverVersion int64
	ConnectionEnabled      bool
	HistoryShardCount      int32
}

RemoteClusterInfo is the observed state of a remote cluster connection.

type RetryParams added in v0.5.0

type RetryParams struct {
	InitialInterval        *time.Duration
	BackoffCoefficient     float64
	MaximumInterval        *time.Duration
	MaximumAttempts        int32
	NonRetryableErrorTypes []string
}

RetryParams is the started workflow's retry policy.

type ScheduleClient added in v0.5.0

type ScheduleClient interface {
	Describe(ctx context.Context, namespace, scheduleID string) (*ScheduleInfo, error)
	Create(ctx context.Context, params ScheduleParams) error
	Update(ctx context.Context, params ScheduleParams) error
	Pause(ctx context.Context, namespace, scheduleID, notes string) error
	Unpause(ctx context.Context, namespace, scheduleID, notes string) error
	Delete(ctx context.Context, namespace, scheduleID string) error
	Close() error
}

ScheduleClient manages schedules in a Temporal cluster.

func NewScheduleClient added in v0.5.0

func NewScheduleClient(_ context.Context, address string, tlsConfig *tls.Config) (ScheduleClient, error)

NewScheduleClient dials the frontend and returns a ScheduleClient.

type ScheduleClientFactory added in v0.5.0

type ScheduleClientFactory func(ctx context.Context, address string, tlsConfig *tls.Config) (ScheduleClient, error)

ScheduleClientFactory builds a ScheduleClient connected to a frontend address. A nil tlsConfig means an insecure connection.

type ScheduleInfo added in v0.5.0

type ScheduleInfo struct {
	Paused           bool
	Notes            string
	NextActionTimes  []time.Time
	RunningWorkflows int
}

ScheduleInfo is the observed state of a Temporal schedule.

type ScheduleParams added in v0.5.0

type ScheduleParams struct {
	ScheduleID string
	Namespace  string
	Spec       ScheduleSpecParams
	Action     StartWorkflowParams
	Policies   SchedulePolicyParams
	State      ScheduleStateParams
}

ScheduleParams is the operator-domain description of a Temporal schedule.

type SchedulePolicyParams added in v0.5.0

type SchedulePolicyParams struct {
	OverlapPolicy          string
	CatchupWindow          *time.Duration
	PauseOnFailure         bool
	KeepOriginalWorkflowID bool
}

SchedulePolicyParams tunes overlap/catchup behavior.

type ScheduleSpecParams added in v0.5.0

type ScheduleSpecParams struct {
	CronStrings      []string
	Intervals        []IntervalParams
	Calendars        []StructuredCalendarParams
	ExcludeCalendars []StructuredCalendarParams
	StartTime        *time.Time
	EndTime          *time.Time
	Jitter           *time.Duration
	TimezoneName     string
}

ScheduleSpecParams is when a schedule fires.

type ScheduleStateParams added in v0.5.0

type ScheduleStateParams struct {
	Paused           bool
	Notes            string
	LimitedActions   bool
	RemainingActions int64
}

ScheduleStateParams controls pause and action-limit state.

type SearchAttributeClient

type SearchAttributeClient interface {
	// List returns the custom search attributes for a namespace, keyed by name
	// with the CR-style type string as the value.
	List(ctx context.Context, namespace string) (map[string]string, error)
	Add(ctx context.Context, namespace, name, attrType string) error
	Remove(ctx context.Context, namespace, name string) error
	Close() error
}

SearchAttributeClient manages custom search attributes in a Temporal cluster.

func NewSearchAttributeClient

func NewSearchAttributeClient(ctx context.Context, address string, tlsConfig *tls.Config) (SearchAttributeClient, error)

NewSearchAttributeClient dials the frontend and returns a SearchAttributeClient.

type SearchAttributeClientFactory

type SearchAttributeClientFactory func(ctx context.Context, address string, tlsConfig *tls.Config) (SearchAttributeClient, error)

SearchAttributeClientFactory builds a SearchAttributeClient.

type ServicePort

type ServicePort struct {
	GRPCPort       int32
	MembershipPort int32
	HTTPPort       int32
}

ServicePort holds the ports for a single Temporal service.

type StartWorkflowParams added in v0.5.0

type StartWorkflowParams struct {
	WorkflowType     string
	TaskQueue        string
	WorkflowID       string
	Args             [][]byte
	ExecutionTimeout *time.Duration
	RunTimeout       *time.Duration
	TaskTimeout      *time.Duration
	IDReusePolicy    string
	Retry            *RetryParams
	Memo             map[string][]byte
	SearchAttributes map[string][]byte
}

StartWorkflowParams describes the workflow to start. Args/Memo/SearchAttributes hold raw JSON bytes that are encoded into json/plain payloads.

type StructuredCalendarParams added in v0.5.0

type StructuredCalendarParams struct {
	Second     []RangeParams
	Minute     []RangeParams
	Hour       []RangeParams
	DayOfMonth []RangeParams
	Month      []RangeParams
	Year       []RangeParams
	DayOfWeek  []RangeParams
	Comment    string
}

StructuredCalendarParams is a field-range calendar spec.

type VersionInfo

type VersionInfo struct {
	// Version is the minor version, e.g. "1.31".
	Version string
	// PatchVersions are the exact supported patch releases, e.g. "1.31.1".
	PatchVersions []string
	// MinSchemaSQL is the minimum SQL schema version required.
	MinSchemaSQL string
	// MinSchemaCassandra is the minimum Cassandra schema version required.
	MinSchemaCassandra string
	// MinSchemaES is the minimum Elasticsearch schema/index template version.
	MinSchemaES string
	// AllowedFromVersions are the minor versions a cluster may upgrade from.
	AllowedFromVersions []string
	// UISeries is the compatible temporal-ui minor series, e.g. "2.34".
	UISeries string
	// DefaultUIVersion is the known-good exact temporal-ui version to pair with.
	DefaultUIVersion string
	// DevServerCLIVersion is the temporalio/temporal CLI image tag whose bundled
	// server is in this line, used to run a dev server for this server version.
	DevServerCLIVersion string
	// CassandraVisibilitySupported reports whether Cassandra may be used as a
	// visibility store on this version.
	CassandraVisibilitySupported bool
	// RemovedDynamicConfig lists dynamic config keys removed in this version.
	RemovedDynamicConfig []string
	// AddedDynamicConfig lists dynamic config keys added in this version.
	AddedDynamicConfig []string
}

VersionInfo describes a single supported Temporal minor version.

func Get

func Get(version string) (VersionInfo, bool)

Get returns the VersionInfo covering an exact patch version.

func LookupVersion

func LookupVersion(version string) (*VersionInfo, error)

LookupVersion returns the VersionInfo for a version, which may be a minor ("1.31") or an exact patch ("1.31.1").

Jump to

Keyboard shortcuts

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