Skip to content

Commit f52f614

Browse files
committed
rebase
2 parents b5f5de0 + 02e0483 commit f52f614

12 files changed

Lines changed: 50 additions & 2354 deletions

File tree

.github/workflows/linters.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
with:
1616
go-version-file: 'go.mod'
1717
check-latest: true
18+
cache: true
1819

1920
- name: lint actions
2021
run: |
@@ -33,6 +34,7 @@ jobs:
3334
with:
3435
go-version-file: 'go.mod'
3536
check-latest: true
37+
cache: true
3638

3739
- name: format golang import statements
3840
run: |
@@ -58,6 +60,7 @@ jobs:
5860
with:
5961
go-version-file: 'go.mod'
6062
check-latest: true
63+
cache: true
6164

6265
- name: lint code
6366
run: |
@@ -72,12 +75,29 @@ jobs:
7275
exit 1
7376
fi
7477
78+
go-vet:
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v4
82+
with:
83+
fetch-depth: 0
84+
85+
- uses: actions/setup-go@v5
86+
with:
87+
go-version-file: 'go.mod'
88+
check-latest: true
89+
cache: true
90+
91+
- name: Run go vet
92+
run: go vet ./...
93+
7594
linters-succeed:
7695
name: All Linters Succeed
7796
needs:
7897
- lint-actions
7998
- fmt-imports
8099
- golangci
100+
- go-vet
81101
runs-on: ubuntu-latest
82102
if: always()
83103
env:

.github/workflows/test-integration.yml

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,17 @@ jobs:
6161
steps:
6262
- name: Checkout code
6363
uses: actions/checkout@v4
64-
64+
65+
- name: setup go workspace
66+
run: go work init && go work use -r .
67+
6568
- name: Set up Go
66-
uses: actions/setup-go@v5
69+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
6770
with:
68-
go-version-file: 'go.mod'
71+
go-version-file: go.work
72+
cache-dependency-path: |
73+
go.work.sum
74+
**/go.sum
6975
check-latest: true
7076
cache: true
7177

@@ -115,11 +121,17 @@ jobs:
115121
steps:
116122
- name: Checkout code
117123
uses: actions/checkout@v4
124+
125+
- name: setup go workspace
126+
run: go work init && go work use -r .
118127

119128
- name: Set up Go
120-
uses: actions/setup-go@v5
129+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
121130
with:
122-
go-version-file: 'go.mod'
131+
go-version-file: go.work
132+
cache-dependency-path: |
133+
go.work.sum
134+
**/go.sum
123135
check-latest: true
124136
cache: true
125137

@@ -144,24 +156,3 @@ jobs:
144156
cover.out
145157
bin/
146158
retention-days: 7
147-
148-
go-vet:
149-
name: Run Go Vet
150-
runs-on: ubuntu-latest
151-
152-
steps:
153-
- name: Checkout code
154-
uses: actions/checkout@v4
155-
156-
- name: Set up Go
157-
uses: actions/setup-go@v5
158-
with:
159-
go-version-file: 'go.mod'
160-
check-latest: true
161-
cache: true
162-
163-
- name: Download dependencies
164-
run: go mod download
165-
166-
- name: Run go vet
167-
run: go vet ./...

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ certs
1212
cover.out
1313

1414
.claude
15-
config
15+
configinternal/demo/worker
16+
internal/demo/helloworld/worker
17+
go.work
18+
go.work.sum

cmd/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ func main() {
121121
setupLog.Error(nil, "POD_NAMESPACE environment variable must be set")
122122
os.Exit(1)
123123
}
124-
if os.Getenv(controller.IdentityEnvKey) == "" {
124+
125+
if os.Getenv(controller.IdentityPrefixEnvKey) == "" {
125126
setupLog.Error(nil, "CONTROLLER_IDENTITY environment variable must be set")
126127
os.Exit(1)
127128
}
129+
128130
var ns corev1.Namespace
129131
if err := mgr.GetAPIReader().Get(context.Background(), types.NamespacedName{Name: podNamespace}, &ns); err != nil {
130132
setupLog.Error(err, "unable to fetch namespace UID for controller identity suffix")

go.work

Lines changed: 0 additions & 7 deletions
This file was deleted.

go.work.sum

Lines changed: 0 additions & 2313 deletions
This file was deleted.

internal/controller/execplan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (r *TemporalWorkerDeploymentReconciler) claimManagerIdentity(
211211
// This should never happen, but this is the extra fallback in case somehow
212212
// the check in main() and Reconcile() are not sufficient.
213213
return errors.New(fmt.Sprintf("%s and %s are not set; refusing to call SetManagerIdentity to avoid clearing the manager identity field",
214-
IdentityEnvKey, IdentitySuffixEnvKey))
214+
IdentityPrefixEnvKey, IdentitySuffixEnvKey))
215215
}
216216
resp, err := deploymentHandler.SetManagerIdentity(ctx, sdkclient.WorkerDeploymentSetManagerIdentityOptions{
217217
Self: true,

internal/controller/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var k8sClient client.Client
2828
var testEnv *envtest.Environment
2929

3030
func TestMain(m *testing.M) {
31-
_ = os.Setenv(IdentityEnvKey, "test-controller-identity")
31+
_ = os.Setenv(IdentityPrefixEnvKey, "test-controller-identity")
3232
_ = os.Setenv(IdentitySuffixEnvKey, "123")
3333
os.Exit(m.Run())
3434
}

internal/controller/util.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
VersionMetadataKey = "temporal.io/controller-version"
3636

3737
VersionEnvKey = "CONTROLLER_VERSION"
38-
IdentityEnvKey = "CONTROLLER_IDENTITY"
38+
IdentityPrefixEnvKey = "CONTROLLER_IDENTITY"
3939
IdentitySuffixEnvKey = "CONTROLLER_IDENTITY_SUFFIX"
4040
MaxDeploymentVersionsIneligibleForDeletionEnvKey = "CONTROLLER_MAX_DEPLOYMENT_VERSIONS_INELIGIBLE_FOR_DELETION"
4141

@@ -61,7 +61,7 @@ func getControllerVersion() string {
6161
// getDeprecatedControllerIdentity is used for smooth identity reclamation when rolling
6262
// forward to the new identity format.
6363
func getDeprecatedControllerIdentity() string {
64-
if identity := os.Getenv(IdentityEnvKey); identity != "" {
64+
if identity := os.Getenv(IdentityPrefixEnvKey); identity != "" {
6565
return identity
6666
}
6767
return defaults.DeprecatedDefaultControllerIdentity
@@ -70,7 +70,7 @@ func getDeprecatedControllerIdentity() string {
7070
// getControllerIdentity returns the identity with controller env var and namespace uid suffix.
7171
// Presence of both are ensured by main() and in Reconcile() for users of the controller as a library.
7272
func getControllerIdentity() string {
73-
id := os.Getenv(IdentityEnvKey)
73+
id := os.Getenv(IdentityPrefixEnvKey)
7474
suffix := os.Getenv(IdentitySuffixEnvKey)
7575
if id != "" && suffix != "" {
7676
return id + "/" + suffix

internal/controller/worker_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (r *TemporalWorkerDeploymentReconciler) Reconcile(ctx context.Context, req
140140
// faster feedback in normal Helm-based deployments.
141141
if getControllerIdentity() == "" {
142142
return ctrl.Result{}, errors.New(fmt.Sprintf("%s and %s are not set",
143-
IdentityEnvKey, IdentitySuffixEnvKey))
143+
IdentityPrefixEnvKey, IdentitySuffixEnvKey))
144144
}
145145

146146
l.V(1).Info("Running Reconcile loop")

0 commit comments

Comments
 (0)