-
Notifications
You must be signed in to change notification settings - Fork 38
CRD rename: TemporalWorkerDeployment → WorkerDeployment, TemporalConnection → Connection #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
fcdbe86
use latest server, which has rate limit
carlydf 4291119
backoff on serviceerror.ResourceExhausted from Temporal and add integ…
carlydf e5c1340
doc: release policy and versioning
jaypipes b1a1dda
fix: deleting a TWD leaves stale versioning data on Temporal server, …
anujagrawal380 0027f6b
fix: persist connection until twd deletes for cleanup
anujagrawal380 95b3661
fix: add else log for no ramping version
anujagrawal380 7050931
fix: use single temporal.io/delete-protection finalizer
anujagrawal380 8d91494
fix: integration tests
anujagrawal380 9fd0c74
fix: add deletion timeout, strict retry, and RBAC markers for connect…
anujagrawal380 3b53e05
pull new packages, make pod spec hashing stable across k8s version ch…
carlydf 060c413
fmt
carlydf beb3a83
only set rate limit to 1 for rate limit test
carlydf bf4dadd
bump go version in demo file
carlydf c7487d5
fix lint
carlydf 6f9aede
remove rate limit changes, other PR
carlydf 848062f
changelog
carlydf a5ef521
remove rate limit test
carlydf 1a290cb
fmt-imports
carlydf 96fb177
backoff on rate limit to avoid spamming server
carlydf 10d78ee
fmt
carlydf a979ede
add cross-namespace events permissions, and sync permissions correctl…
carlydf 75fd92f
add space after comment for lint
carlydf d593790
Validate TWD spec via CRD CEL rules instead of reconciler
carlydf ef1c54d
Fix CRD CEL rule cost violations caught by envtest
carlydf 4a72bc2
Enforce webhook-only spec checks in reconciler with event+condition
carlydf e02aec8
Don't requeue on invalid spec — watch triggers on spec update
carlydf 4eff7d8
Remove webhook checks now enforced by CRD CEL rules
carlydf 7fb0ab5
Add envtest integration tests for TWD CRD CEL validation rules
carlydf bc15997
Test that >20 Progressive steps are rejected by the CRD maxItems cons…
carlydf 30af982
fmt
carlydf e5d64f8
Merge branch 'pr-288' into crd-rename
carlydf d56d4dd
Merge branch 'pr-290' into crd-rename
carlydf 77db015
Merge branch 'pr-292' into crd-rename
carlydf c161b11
Merge branch 'pr-293' into crd-rename
carlydf e736ef8
Merge branch 'pr-291' into crd-rename
carlydf 46692bd
Merge branch 'pr-240' into crd-rename
carlydf 326c634
Rename TemporalWorkerDeployment→WorkerDeployment, TemporalConnection→…
carlydf 4694690
helm: add WorkerDeployment/Connection CRDs; simplify deprecated CRDs;…
carlydf a649017
test: update tests for renamed types; add migration and dual-field tests
carlydf c4c1bed
test: fix missed type rename in clientpool_test.go
carlydf c65408d
fmt-imports
carlydf 6258639
remove header from new files
carlydf 578a558
address cyclomatic complexity
carlydf bada148
make fmt-imports
carlydf 30b79b2
revert chart.yaml
carlydf 0a0ff52
fix nits
carlydf d35d56f
replace makeTWD -> makeWD in reconciler events tests
carlydf 2ff8503
replace MakeTWD -> MakeWD in test helpers
carlydf 259ac79
replace markWRTsTWDNotFound with markWRTsWDNotFound
carlydf 044774d
replace markWRTsTWDNotFound with markWRTsWDNotFound - pt 2
carlydf 2337e95
more rename
carlydf 2d3f7da
merge
carlydf 12101e3
fix tests
carlydf 6e13826
remove go.work
carlydf f05dc48
fmt-imports
carlydf f287a2e
remove conn shortname
carlydf 77d5f9b
use .spec.workerDeploymentRef.name in wrt list columns
carlydf 1de6687
fix make manifests: pipe rbac to helm directly, add missing temporalw…
carlydf f3a345b
enforce wrt ref constraints via CRD CEL validation
carlydf 65f95fc
add rbac and reconciler for temporalconnections
carlydf a14d3c8
minimal rbac changes
carlydf 4033453
no need to change hack/sync-rbac-rules.py in this PR
carlydf 59ca6e5
drop WD mutating webhook; apply defaults in controller
carlydf 1a6ad0b
remove redundant ApplyDefaults; CRD defaults handle nil delays
carlydf 6814091
minimal change to webhook
carlydf 9267bd0
remove webhook permission notes
carlydf 8d929f5
add part back
carlydf e1f1588
improve comment on WorkerResourceTemplateSpec
carlydf 3303469
fix merge artifact: remove duplicate deletion block; fix temporal.io.…
carlydf f31fcd6
remove duplicate temporalconnection check
carlydf 68a42fa
restore workerDeploy.Default
carlydf 44eef62
remove extra files
carlydf 1d8b55f
remove extra files
carlydf 8c0bc32
skip flaky tests while we handle everything else
carlydf 426397c
edit docs and add migration instructions doc
carlydf a1e52b6
docs: correct deprecated CRD behavior — not actively managed in v1.7
carlydf 821945d
keep all deprecated crd fields and statuses, and hand-write the depre…
carlydf 394c57b
don't refer to a specific release in deprecation warning
carlydf 6fef525
migration guide
carlydf c23d500
redefine deprecated CRDs in Go
carlydf e7e9d4f
Add Condition to TemporalConnection so we can say Ready=False, and ge…
carlydf 9b74643
Add migration-guard finalizer to deprecated TWD and TC resources
carlydf 83c8c97
add new internal/controller/deprecated_tc_reconciler_test.go file
carlydf 737f0ee
Resolve merge conflicts from main
carlydf cc7a170
don't add config directory that we don't use
carlydf 6c6ff4e
reorder migration guide to emphasize simplicity
carlydf e5523d1
put flaky tests back
carlydf 6a98ebd
fmt-imports
carlydf 1811c44
Merge branch 'main' of github.com:temporalio/temporal-worker-controll…
carlydf 889261a
rename occurrences in demo
carlydf 2cb15e5
replace TemporalConnection and TemporalWorkerDeployment in docs and c…
carlydf 6e8045e
remove stale PROJECT file
carlydf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. | ||
| // | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc. | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| corev1 "k8s.io/api/core/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
|
||
| // SecretReference contains the name of a Secret resource in the same namespace. | ||
| type SecretReference struct { | ||
| // Name of the Secret resource. | ||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` | ||
| Name string `json:"name"` | ||
| } | ||
|
|
||
| // ConnectionSpec defines the desired state of Connection | ||
| // +kubebuilder:validation:XValidation:rule="!(has(self.mutualTLSSecretRef) && has(self.apiKeySecretRef))",message="Only one of mutualTLSSecretRef or apiKeySecretRef may be set" | ||
| type ConnectionSpec struct { | ||
| // The host and port of the Temporal server. | ||
| // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9.-]+:[0-9]+$` | ||
| HostPort string `json:"hostPort"` | ||
|
|
||
| // MutualTLSSecretRef is the name of the Secret that contains the TLS certificate and key | ||
| // for mutual TLS authentication. The secret must be `type: kubernetes.io/tls` or | ||
| // `type: Opaque` and exist in the same Kubernetes namespace as the Connection | ||
| // resource. Opaque secrets are useful when bundling tls.crt, tls.key, and ca.crt into | ||
| // a single secret (e.g. multi-file cert-manager outputs). | ||
| // | ||
| // More information about creating a TLS secret: | ||
| // https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets | ||
| // +optional | ||
| MutualTLSSecretRef *SecretReference `json:"mutualTLSSecretRef,omitempty"` | ||
|
|
||
| // APIKeySecretRef selects the Secret key that contains the API key used for authentication. | ||
| // The Secret must be `type: kubernetes.io/opaque` and exist in the same Kubernetes namespace as | ||
| // the Connection resource. This is a corev1.SecretKeySelector and encodes both: | ||
| // - LocalObjectReference.Name: the name of the Secret resource | ||
| // - Key: the data key within Secret.Data whose value is the API key token | ||
| // +optional | ||
| APIKeySecretRef *corev1.SecretKeySelector `json:"apiKeySecretRef,omitempty"` | ||
| } | ||
|
|
||
| // ConnectionStatus defines the observed state of Connection | ||
| type ConnectionStatus struct { | ||
| // TODO(jlegrone): Add additional status fields following Kubernetes API conventions | ||
| // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status | ||
| } | ||
|
|
||
| //+kubebuilder:object:root=true | ||
| //+kubebuilder:subresource:status | ||
| //+kubebuilder:printcolumn:name="Host",type="string",JSONPath=".spec.hostPort",description="Temporal server endpoint" | ||
| //+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age" | ||
|
|
||
| // Connection is the Schema for the connection API | ||
| type Connection struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec ConnectionSpec `json:"spec,omitempty"` | ||
| Status ConnectionStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| //+kubebuilder:object:root=true | ||
|
|
||
| // ConnectionList contains a list of Connection | ||
| type ConnectionList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []Connection `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&Connection{}, &ConnectionList{}) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
184 changes: 184 additions & 0 deletions
184
api/v1alpha1/deprecated_temporalworkerdeployment_types.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,184 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. | ||
| // | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc. | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| corev1 "k8s.io/api/core/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
|
||
| // TemporalConnectionReference contains the name of a TemporalConnection resource | ||
| // in the same namespace as the TemporalWorkerDeployment. | ||
| type TemporalConnectionReference struct { | ||
| // Name of the TemporalConnection resource. | ||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` | ||
| Name string `json:"name"` | ||
| } | ||
|
|
||
| type DeprecatedWorkerOptions struct { | ||
| // The name of a TemporalConnection in the same namespace as the TemporalWorkerDeployment. | ||
| TemporalConnectionRef TemporalConnectionReference `json:"connectionRef"` | ||
| // The Temporal namespace for the worker to connect to. | ||
| // +kubebuilder:validation:MinLength=1 | ||
| TemporalNamespace string `json:"temporalNamespace"` | ||
| // UnsafeCustomBuildID optionally overrides the auto-generated build ID for this worker deployment. | ||
| // When set, the controller uses this value instead of computing a build ID from the | ||
| // pod template hash. This enables rolling updates for non-workflow code changes | ||
| // (bug fixes, config changes) while preserving the same build ID. | ||
| // | ||
| // WARNING: Using a custom build ID requires careful management. If workflow code changes | ||
| // but UnsafeCustomBuildID stays the same, pinned workflows may execute on workers running incompatible | ||
| // code. Only use this when you have a reliable way to detect changes in your workflow | ||
| // definitions (e.g., hashing workflow source files in CI/CD). | ||
| // | ||
| // When the UnsafeCustomBuildID is stable but pod template spec changes, the controller triggers | ||
| // a rolling update instead of creating a new deployment version. The controller uses | ||
| // a hash of the user-provided pod template spec to detect ANY changes, including | ||
| // container images, env vars, commands, volumes, resources, and all other fields. | ||
| // +optional | ||
| // +kubebuilder:validation:MaxLength=63 | ||
| // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?$` | ||
| UnsafeCustomBuildID string `json:"unsafeCustomBuildID,omitempty"` | ||
| } | ||
|
|
||
| // TemporalWorkerDeploymentSpec defines the desired state of TemporalWorkerDeployment | ||
| type TemporalWorkerDeploymentSpec struct { | ||
|
|
||
| // Number of desired pods. When set, the controller manages replicas for all active | ||
| // worker versions. When omitted (nil), the controller creates versioned Deployments | ||
| // with nil replicas and never calls UpdateScale on active versions — following the | ||
| // Kubernetes-recommended pattern for HPA and other external autoscalers | ||
| // (https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#migrating-deployments-and-statefulsets-to-horizontal-autoscaling). | ||
| // The controller still scales drained versions (and inactive versions that are not | ||
| // the rollout target) to zero regardless. | ||
| // This field makes TemporalWorkerDeploymentSpec implement the scale subresource, which is compatible with auto-scalers. | ||
| // +optional | ||
| Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` | ||
|
|
||
| // Template describes the pods that will be created. | ||
| // The only allowed template.spec.restartPolicy value is "Always". | ||
| Template corev1.PodTemplateSpec `json:"template"` | ||
|
|
||
| // Minimum number of seconds for which a newly created pod should be ready | ||
| // without any of its container crashing, for it to be considered available. | ||
| // Defaults to 0 (pod will be considered available as soon as it is ready) | ||
| // +optional | ||
| // +kubebuilder:default=0 | ||
| MinReadySeconds int32 `json:"minReadySeconds,omitempty"` | ||
|
|
||
| // The maximum time in seconds for a deployment to make progress before it | ||
| // is considered to be failed. The deployment controller will continue to | ||
| // process failed deployments and a condition with a ProgressDeadlineExceeded | ||
| // reason will be surfaced in the deployment status. Note that progress will | ||
| // not be estimated during the time a deployment is paused. Defaults to 600s. | ||
| // +kubebuilder:default=600 | ||
| ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"` | ||
|
|
||
| // How to rollout new workflow executions to the target version. | ||
| RolloutStrategy RolloutStrategy `json:"rollout"` | ||
|
|
||
| // How to manage sunsetting drained versions. | ||
| SunsetStrategy SunsetStrategy `json:"sunset"` | ||
|
|
||
| // WorkerOptions configures the worker's connection to Temporal. | ||
| WorkerOptions DeprecatedWorkerOptions `json:"workerOptions"` | ||
| } | ||
|
|
||
| // Condition reason constants for TemporalWorkerDeployment. | ||
| // | ||
| // These strings appear in status.conditions[].reason and are part of the CRD's | ||
| // status API. Operators, monitoring rules, and scripts may depend on them. | ||
| // They should be treated as stable within an API version and renamed only with | ||
| // a corresponding version bump. | ||
| const ( | ||
| // ReasonTemporalConnectionNotFound is set on ConditionProgressing=False when the | ||
| // referenced TemporalConnection resource cannot be found. | ||
| ReasonTemporalConnectionNotFound = "TemporalConnectionNotFound" | ||
|
|
||
| // Deprecated: Use ReasonRolloutComplete on ConditionReady instead. | ||
| ReasonTemporalConnectionHealthy = "TemporalConnectionHealthy" | ||
| ) | ||
|
|
||
| // TemporalWorkerDeploymentStatus defines the observed state of TemporalWorkerDeployment | ||
| type TemporalWorkerDeploymentStatus struct { | ||
| // Remember, status should be able to be reconstituted from the state of the world, | ||
| // so it's generally not a good idea to read from the status of the root object. | ||
| // Instead, you should reconstruct it every run. | ||
|
|
||
| // TargetVersion is the desired next version. If TargetVersion.Deployment is nil, | ||
| // then the controller should create it. If not nil, the controller should | ||
| // wait for it to become healthy and then move it to the CurrentVersion. | ||
| TargetVersion TargetWorkerDeploymentVersion `json:"targetVersion"` | ||
|
|
||
| // CurrentVersion is the version that is currently registered with | ||
| // Temporal as the current version of its worker deployment. This will be nil | ||
| // during initial bootstrap until a version is registered and set as current. | ||
| CurrentVersion *CurrentWorkerDeploymentVersion `json:"currentVersion,omitempty"` | ||
|
|
||
| // DeprecatedVersions are deployment versions that are no longer the default. Any | ||
| // deployment versions that are unreachable should be deleted by the controller. | ||
| DeprecatedVersions []*DeprecatedWorkerDeploymentVersion `json:"deprecatedVersions,omitempty"` | ||
|
|
||
| // VersionConflictToken prevents concurrent modifications to the deployment status. | ||
| // It ensures reconciliation operations don't inadvertently override changes made | ||
| // by external systems while processing is underway. | ||
| VersionConflictToken []byte `json:"versionConflictToken,omitempty"` | ||
|
|
||
| // LastModifierIdentity is the identity of the client that most recently modified the worker deployment. | ||
| // +optional | ||
| LastModifierIdentity string `json:"lastModifierIdentity,omitempty"` | ||
|
|
||
| // ManagerIdentity is the identity that has exclusive rights to modify this Worker Deployment's routing config. | ||
| // When set, clients whose identity does not match will be blocked from making routing changes. | ||
| // Empty by default. Use `temporal worker deployment manager-identity set/unset` to change. | ||
| // +optional | ||
| ManagerIdentity string `json:"managerIdentity,omitempty"` | ||
|
|
||
| // VersionCount is the total number of versions currently known by the worker deployment. | ||
| // This includes current, target, ramping, and deprecated versions. | ||
| // +optional | ||
| // +kubebuilder:validation:Minimum=0 | ||
| VersionCount int32 `json:"versionCount,omitempty"` | ||
|
|
||
| // Conditions represent the latest available observations of the TemporalWorkerDeployment's current state. | ||
| // +optional | ||
| Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
| } | ||
|
|
||
| //+kubebuilder:object:root=true | ||
| //+kubebuilder:subresource:status | ||
| // +kubebuilder:resource:shortName=twd;twdeployment;tworkerdeployment | ||
| //+kubebuilder:printcolumn:name="Current",type="string",JSONPath=".status.currentVersion.buildID",description="Current build ID" | ||
| //+kubebuilder:printcolumn:name="Target",type="string",JSONPath=".status.targetVersion.buildID",description="Target build ID" | ||
| //+kubebuilder:printcolumn:name="Ramp %",type="number",JSONPath=".status.targetVersion.rampPercentage",description="Ramp percentage" | ||
| //+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age" | ||
| // +kubebuilder:validation:XValidation:rule="size(self.metadata.name) <= 63",message="name cannot be more than 63 characters" | ||
| // +kubebuilder:validation:XValidation:rule="oldSelf != null",message="TemporalWorkerDeployment is deprecated and cannot be created. Use WorkerDeployment instead." | ||
| // +kubebuilder:deprecatedversion:warning="TemporalWorkerDeployment is deprecated. Use WorkerDeployment instead." | ||
|
|
||
| // TemporalWorkerDeployment is the Schema for the temporalworkerdeployments API | ||
| type TemporalWorkerDeployment struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec TemporalWorkerDeploymentSpec `json:"spec,omitempty"` | ||
| Status TemporalWorkerDeploymentStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| //+kubebuilder:object:root=true | ||
|
|
||
| // TemporalWorkerDeploymentList contains a list of TemporalWorkerDeployment | ||
| type TemporalWorkerDeploymentList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []TemporalWorkerDeployment `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&TemporalWorkerDeployment{}, &TemporalWorkerDeploymentList{}) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.