client

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT, MIT Imports: 39 Imported by: 0

Documentation

Overview

Package client contains the client to interact with Worker Controller Instance workflows

Index

Constants

View Source
const (
	ErrTooManyRequests                  = "too many requests issued to Worker Deployment Version '%s' '%s'. Please try again later"
	ErrWorkerControllerInstanceNotFound = "no Worker Controller Instance found for Worker Deployment with name '%s' %s"
)
View Source
const (
	WorkerControllerInstanceDelimiter        = ":"
	WorkerControllerInstanceWorkflowIDPrefix = "temporal-sys-worker-controller-instance"

	// SignalSyncValidationStatus is the signal name sent to the version workflow
	// when the WCI's ValidationStatus changes, so the deployment workflow can
	// maintain an up-to-date connectivity summary in its memo.
	SignalSyncValidationStatus = "sync-validation-status"
)
View Source
const (
	WorkerControllerPerNSWorkerTaskQueue = "temporal-sys-worker-controller-per-ns-tq"
)

Variables

View Source
var (
	WorkerControllerEnabled = dynamicconfig.NewNamespaceBoolSetting(
		"workercontroller.enabled",
		false,
		`WorkerControllerEnabled is a "feature enable" flag. When enabled it allows clients to configure compute providers.`,
	)
	WorkerControllerMaxInstances = dynamicconfig.NewNamespaceIntSetting(
		"workercontroller.maxInstances",
		100,
		`WorkerControllerMaxInstances represents the maximum number of worker controller instances that can be registered in a single namespace`,
	)
	WorkerControllerInstanceWorkflowVersion = dynamicconfig.NewNamespaceIntSetting(
		"workercontroller.instanceWorkflowVersion",
		2,
		`WorkerControllerInstanceWorkflowVersion controls what version of the logic should the manager workflows use.`,
	)
	WorkerControllerMinSignalIntervalNoSyncMatchMilliseconds = dynamicconfig.NewNamespaceIntSetting(
		"workercontroller.hook.min_signal_interval_no_sync_match",
		500,
		`WorkerControllerMinSignalIntervalNoSyncMatchMilliseconds controls the batching interval of no-sync matches grouped by WCI in milliseconds (per namespace). Each batch triggers a signal. `,
	)
	WorkerControllerMinSignalIntervalSyncMatchMilliseconds = dynamicconfig.NewNamespaceIntSetting(
		"workercontroller.hook.min_signal_interval_sync_match",
		60_000,
		`WorkerControllerMinSignalIntervalSyncMatchMilliseconds controls the batching interval of sync matches grouped by WCI in milliseconds (per namespace). Each batch triggers a signal.`,
	)
	WorkerControllerEnabledComputeProviders = dynamicconfig.NewNamespaceTypedSetting(
		"workercontroller.compute_providers.enabled",
		[]string(nil),
		`WorkerControllerEnabledComputeProviders defines the list of compute providers enabled for use. Namespace-scoped: a namespace-level value overrides the cell-wide (global) value, and namespaces without an entry inherit the cell value.`,
	)
)

Namespace-scoped settings.

View Source
var (
	WorkerControllerAWSIntermediaryRoles = dynamicconfig.NewGlobalTypedSetting(
		"workercontroller.compute_providers.aws.intermediary_roles",
		[][]AWSIAMRoleRequest(nil),
		`WorkerControllerAWSIntermediaryRoles defines the role chain to assume before assuming the per-provider role.`,
	)
	WorkerControllerGCPIntermediaryServiceAccounts = dynamicconfig.NewGlobalTypedSetting(
		"workercontroller.compute_providers.gcp.intermediary_service_accounts",
		[][]GCPIAMServiceAccountRequest(nil),
		`WorkerControllerGCPIntermediaryServiceAccounts defines the service account chaining to assume before assuming the per-provider role.`,
	)
	WorkerControllerGCPFirstDelegateAsBase = dynamicconfig.NewGlobalBoolSetting(
		"workercontroller.compute_providers.gcp.first_delegate_as_base",
		false,
		`WorkerControllerGCPFirstDelegateAsBase controls how the first entry of the resolved GCP impersonation chain is treated. `+
			`When true, the first delegate is the identity the pod's ambient Workload Identity can *directly* impersonate `+
			`(roles/iam.workloadIdentityUser -> getAccessToken): it is used as the base credential of the chain, and the remaining `+
			`delegates are passed as token-creator delegates to the target. When false, the entire chain is passed as token-creator `+
			`delegates starting from the ambient ADC (default), which requires the ambient identity to hold implicitDelegation on the first delegate.`,
	)
	WorkerControllerEnabledScalingAlgorithms = dynamicconfig.NewGlobalTypedSetting(
		"workercontroller.scaling_algorithms.enabled",
		[]string(nil),
		`WorkerControllerEnabledScalingAlgorithm defines the list of scaling algorithms enabled for use.`,
	)
	WorkerControllerAWSRequireRoleAndExternalID = dynamicconfig.NewGlobalBoolSetting(
		"workercontroller.compute_providers.aws.require_role_and_external_id",
		true,
		`WorkerControllerAWSRequireRoleAndExternalID controls whether AWS compute providers require a role ARN and external ID. Defaults to true. Set to false to allow configurations without these fields and accepting the associated security risks.`,
	)
	WorkerControllerPeriodicValidationIntervalSeconds = dynamicconfig.NewGlobalIntSetting(
		"workercontroller.periodic_validation_interval_s",
		int((6 * time.Hour).Seconds()),
		`WorkerControllerPeriodicValidationIntervalSeconds controls the interval between periodic spec validation checks in seconds.`,
	)
)

Global settings.

Functions

func ClientProvider

func ClientProvider(
	logger log.Logger,
	historyClient resource.HistoryClient,
	visibilityManager manager.VisibilityManager,
	dc *dynamicconfig.Collection,
	testHooks testhooks.TestHooks,
	metricsHandler metrics.Handler,
) fxOut

func GenerateWorkerControllerInstanceWorkflowID

func GenerateWorkerControllerInstanceWorkflowID(version *deploymentpb.WorkerDeploymentVersion) string

GenerateWorkerControllerInstanceWorkflowID is a helper that generates a system accepted workflowID which are used in our Worker Controller Instance workflows

func GetDeploymentNameBuildIdFromWorkflowID

func GetDeploymentNameBuildIdFromWorkflowID(workflowId string) *deploymentpb.WorkerDeploymentVersion

GetDeploymentNameBuildIdFromWorkflowID parses the system accepted workflowID of a Worker Controller Instance workflow into its parts

Types

type AWSIAMRoleRequest

type AWSIAMRoleRequest struct {
	RoleARN         string
	RoleSessionName string
	ExternalID      *string
}

type Client

type Client interface {
	UpdateTaskQueueName(
		ctx context.Context,
		newTaskQueueName string,
	) error
	WorkerControllerInstanceExists(
		ctx context.Context,
		namespaceEntry *namespace.Namespace,
		version *deploymentpb.WorkerDeploymentVersion,
	) (bool, error)

	DescribeWorkerControllerInstance(
		ctx context.Context,
		namespaceEntry *namespace.Namespace,
		version *deploymentpb.WorkerDeploymentVersion,
	) (*iface.QueryDescribeWorkerControllerInstanceResponse, []byte, error)

	ListWorkerControllerInstances(
		ctx context.Context,
		namespaceEntry *namespace.Namespace,
		pageSize int,
		nextPageToken []byte,
	) ([]*WorkerControllerInstanceSummary, []byte, error)

	UpdateWorkerControllerInstance(
		ctx context.Context,
		namespaceEntry *namespace.Namespace,
		version *deploymentpb.WorkerDeploymentVersion,
		conflictToken []byte,
		identity string,
		upsertScalingGroups map[string]iface.ScalingGroupSpecUpdate,
		removeScalingGroups []string,
	) (*iface.UpdateWorkerControllerInstanceResponse, error)

	ValidateWorkerControllerInstanceSpec(
		ctx context.Context,
		namespaceEntry *namespace.Namespace,
		version *deploymentpb.WorkerDeploymentVersion,
		identity string,
		upsertScalingGroups map[string]iface.ScalingGroupSpecUpdate,
		removeScalingGroups []string,
	) error

	DeleteWorkerControllerInstance(
		ctx context.Context,
		namespaceEntry *namespace.Namespace,
		version *deploymentpb.WorkerDeploymentVersion,
		identity string,
	) error

	SignalTaskAddEvent(
		ctx context.Context,
		namespaceEntry *namespace.Namespace,
		version *deploymentpb.WorkerDeploymentVersion,
		request *iface.SignalTaskAddRequest,
	) error
}

type ComputeProviderSpec

type ComputeProviderSpec = iface.ComputeProviderSpec

type ComputeProviderType

type ComputeProviderType = iface.ComputeProviderType

type GCPIAMServiceAccountRequest

type GCPIAMServiceAccountRequest struct {
	ServiceAccountEmail string
}

type ScalingAlgorithmSpec

type ScalingAlgorithmSpec = iface.ScalingAlgorithmSpec

type ScalingAlgorithmType

type ScalingAlgorithmType = iface.ScalingAlgorithmType

type ScalingGroupSpec

type ScalingGroupSpec = iface.ScalingGroupSpec

type WorkerControllerInstanceSummary

type WorkerControllerInstanceSummary struct {
	DeploymentName string
	BuildId        string
	CreateTime     *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
}

Jump to

Keyboard shortcuts

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