temporal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 25 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.

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 IsSupported

func IsSupported(version string) bool

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

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
	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 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
	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
}

NamespaceInfo is the observed state of a Temporal namespace.

type NamespaceParams

type NamespaceParams struct {
	Name            string
	Description     string
	OwnerEmail      string
	RetentionPeriod time.Duration
}

NamespaceParams describes the desired state of a Temporal namespace.

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 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
	// 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