Skip to content

Commit 5cdd104

Browse files
authored
Merge pull request #83 from ecordell/state
state: add new state package as a foundation for v2
2 parents e508a12 + c14a40e commit 5cdd104

15 files changed

Lines changed: 5219 additions & 282 deletions

File tree

.github/workflows/build-test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
---
22
name: "Build & Test"
3-
on: # yamllint disable-line rule:truthy
3+
on: # yamllint disable-line rule:truthy
44
push:
55
branches:
66
- "main"
77
pull_request:
88
branches:
99
- "*"
1010
env:
11-
GO_VERSION: "~1.24"
11+
GO_VERSION: "~1.25"
1212
jobs:
1313
unit:
1414
name: "Unit"
1515
runs-on: "ubuntu-latest"
1616
steps:
17-
- uses: "actions/checkout@v3"
17+
- uses: "actions/checkout@v4"
1818
- uses: "authzed/actions/setup-go@main"
1919
with:
2020
go-version: "${{ env.GO_VERSION }}"
21-
- uses: "magefile/mage-action@v2"
21+
- uses: "magefile/mage-action@v3"
2222
with:
2323
version: "latest"
2424
args: "test:unit"
2525
integration:
2626
name: "integration"
2727
runs-on: "ubuntu-latest"
2828
steps:
29-
- uses: "actions/checkout@v3"
29+
- uses: "actions/checkout@v4"
3030
- uses: "authzed/actions/setup-go@main"
3131
with:
3232
go-version: "${{ env.GO_VERSION }}"
33-
- uses: "magefile/mage-action@v2"
33+
- uses: "magefile/mage-action@v3"
3434
with:
3535
version: "latest"
3636
args: "test:integration"

.github/workflows/lint.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
---
22
name: "Lint"
3-
on: # yamllint disable-line rule:truthy
3+
on: # yamllint disable-line rule:truthy
44
push:
55
branches:
66
- "!dependabot/*"
77
- "main"
88
pull_request:
99
branches: ["*"]
1010
env:
11-
GO_VERSION: "~1.24"
11+
GO_VERSION: "~1.25"
1212
jobs:
1313
go-lint:
1414
name: "Lint Go"
1515
runs-on: "ubuntu-latest"
1616
steps:
17-
- uses: "actions/checkout@v3"
17+
- uses: "actions/checkout@v4"
1818
- uses: "authzed/actions/setup-go@main"
1919
with:
2020
go-version: "${{ env.GO_VERSION }}"
21-
- uses: "magefile/mage-action@v2"
21+
- uses: "magefile/mage-action@v3"
2222
with:
2323
version: "latest"
2424
args: "lint:go"
@@ -30,11 +30,11 @@ jobs:
3030
name: "Lint YAML & Markdown"
3131
runs-on: "ubuntu-latest"
3232
steps:
33-
- uses: "actions/checkout@v3"
33+
- uses: "actions/checkout@v4"
3434
- uses: "authzed/actions/setup-go@main"
3535
with:
3636
go-version: "${{ env.GO_VERSION }}"
37-
- uses: "magefile/mage-action@v2"
37+
- uses: "magefile/mage-action@v3"
3838
with:
3939
version: "latest"
4040
args: "lint:extra"

cachekeys/keys.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ func GVRMetaNamespaceKeyFunc(gvr schema.GroupVersionResource, obj interface{}) (
3434
func SplitGVRMetaNamespaceKey(key string) (gvr *schema.GroupVersionResource, namespace, name string, err error) {
3535
before, after, ok := strings.Cut(key, "::")
3636
if !ok {
37-
err = fmt.Errorf("error parsing key: %s", key)
38-
return
37+
return nil, "", "", fmt.Errorf("error parsing key: %s", key)
3938
}
4039
gvr, _ = schema.ParseResourceArg(before)
4140
if gvr == nil {
42-
err = fmt.Errorf("error parsing gvr from key: %s", before)
43-
return
41+
return nil, "", "", fmt.Errorf("error parsing gvr from key: %s", before)
4442
}
4543
namespace, name, err = cache.SplitMetaNamespaceKey(after)
46-
return
44+
return gvr, namespace, name, err
4745
}

client/fake/fake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
dynamicfake "k8s.io/client-go/dynamic/fake"
2424
clientgotesting "k8s.io/client-go/testing"
2525
"k8s.io/kube-openapi/pkg/validation/spec"
26-
"sigs.k8s.io/structured-merge-diff/v4/typed"
26+
"sigs.k8s.io/structured-merge-diff/v6/typed"
2727
)
2828

2929
// defaultKubernetesOpenAPISpec contains the embedded Kubernetes OpenAPI schema (v1.33.2).

component/component.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (c *Component[K]) List(ctx context.Context, indexValue fmt.Stringer) (out [
5858
ownedObjects, err := c.indexer.ByIndex(c.indexName, indexValue.String())
5959
if err != nil {
6060
utilruntime.HandleError(err)
61-
return
61+
return out
6262
}
6363
for _, d := range ownedObjects {
6464
ls := d.GetLabels()

go.mod

Lines changed: 82 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,136 @@
11
module github.com/authzed/controller-idioms
22

3-
go 1.24.0
4-
5-
toolchain go1.24.4
3+
go 1.25.0
64

75
require (
6+
github.com/authzed/ctxkey v0.0.0-20260210154927-ca132876f62c
87
github.com/cespare/xxhash/v2 v2.3.0
98
github.com/davecgh/go-spew v1.1.1
109
github.com/fsnotify/fsnotify v1.9.0
11-
github.com/go-logr/logr v1.4.2
10+
github.com/go-logr/logr v1.4.3
1211
github.com/maxbrunsfeld/counterfeiter/v6 v6.7.0
13-
github.com/prometheus/client_golang v1.22.0
14-
github.com/stretchr/testify v1.10.0
15-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
16-
golang.org/x/sync v0.12.0
17-
k8s.io/api v0.34.0-alpha.2
18-
k8s.io/apiextensions-apiserver v0.34.0-alpha.2
19-
k8s.io/apimachinery v0.34.0-alpha.2
20-
k8s.io/apiserver v0.34.0-alpha.2
21-
k8s.io/cli-runtime v0.34.0-alpha.2
22-
k8s.io/client-go v0.34.0-alpha.2
23-
k8s.io/component-base v0.34.0-alpha.2
24-
k8s.io/controller-manager v0.34.0-alpha.2
12+
github.com/prometheus/client_golang v1.23.2
13+
github.com/stretchr/testify v1.11.1
14+
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a
15+
golang.org/x/sync v0.19.0
16+
k8s.io/api v0.35.1
17+
k8s.io/apiextensions-apiserver v0.35.1
18+
k8s.io/apimachinery v0.35.1
19+
k8s.io/apiserver v0.35.1
20+
k8s.io/cli-runtime v0.35.1
21+
k8s.io/client-go v0.35.1
22+
k8s.io/component-base v0.35.1
23+
k8s.io/controller-manager v0.35.1
2524
k8s.io/klog/v2 v2.130.1
26-
k8s.io/kube-openapi v0.0.0-20250610211856-8b98d1ed966a
27-
k8s.io/kubectl v0.34.0-alpha.2
28-
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
25+
k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4
26+
k8s.io/kubectl v0.35.1
27+
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2
28+
sigs.k8s.io/structured-merge-diff/v6 v6.3.2
2929
)
3030

3131
require (
3232
github.com/NYTimes/gziphandler v1.1.1 // indirect
3333
github.com/beorn7/perks v1.0.1 // indirect
3434
github.com/blang/semver/v4 v4.0.0 // indirect
35-
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
3635
github.com/coreos/go-semver v0.3.1 // indirect
37-
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
38-
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
36+
github.com/coreos/go-systemd/v22 v22.7.0 // indirect
37+
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
3938
github.com/felixge/httpsnoop v1.0.4 // indirect
4039
github.com/go-logr/stdr v1.2.2 // indirect
4140
github.com/gogo/protobuf v1.3.2 // indirect
4241
github.com/golang/protobuf v1.5.4 // indirect
43-
github.com/google/cel-go v0.25.0 // indirect
42+
github.com/google/cel-go v0.27.0 // indirect
4443
github.com/google/go-cmp v0.7.0 // indirect
4544
github.com/google/uuid v1.6.0 // indirect
4645
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
47-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
46+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
4847
github.com/inconshreveable/mousetrap v1.1.0 // indirect
49-
github.com/josharian/intern v1.0.0 // indirect
5048
github.com/json-iterator/go v1.1.12 // indirect
51-
github.com/mailru/easyjson v0.7.7 // indirect
5249
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5350
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
5451
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
55-
github.com/pkg/errors v0.9.1 // indirect
5652
github.com/pmezard/go-difflib v1.0.0 // indirect
57-
github.com/prometheus/client_model v0.6.1 // indirect
58-
github.com/prometheus/common v0.62.0 // indirect
59-
github.com/prometheus/procfs v0.15.1 // indirect
60-
github.com/spf13/cobra v1.9.1 // indirect
61-
github.com/spf13/pflag v1.0.6 // indirect
62-
github.com/stoewer/go-strcase v1.3.0 // indirect
53+
github.com/prometheus/client_model v0.6.2 // indirect
54+
github.com/prometheus/common v0.67.5 // indirect
55+
github.com/prometheus/procfs v0.19.2 // indirect
56+
github.com/spf13/cobra v1.10.2 // indirect
57+
github.com/spf13/pflag v1.0.10 // indirect
6358
github.com/stretchr/objx v0.5.2 // indirect
64-
go.etcd.io/etcd/api/v3 v3.6.1 // indirect
65-
go.etcd.io/etcd/client/pkg/v3 v3.6.1 // indirect
66-
go.etcd.io/etcd/client/v3 v3.6.1 // indirect
59+
go.etcd.io/etcd/api/v3 v3.6.8 // indirect
60+
go.etcd.io/etcd/client/pkg/v3 v3.6.8 // indirect
61+
go.etcd.io/etcd/client/v3 v3.6.8 // indirect
6762
go.uber.org/multierr v1.11.0 // indirect
68-
go.uber.org/zap v1.27.0 // indirect
69-
golang.org/x/crypto v0.36.0 // indirect
70-
golang.org/x/net v0.38.0 // indirect
71-
golang.org/x/oauth2 v0.27.0 // indirect
72-
golang.org/x/sys v0.31.0 // indirect
73-
golang.org/x/term v0.30.0 // indirect
74-
golang.org/x/text v0.23.0 // indirect
75-
golang.org/x/time v0.9.0 // indirect
76-
golang.org/x/tools v0.26.0 // indirect
77-
google.golang.org/grpc v1.72.1 // indirect
78-
google.golang.org/protobuf v1.36.5 // indirect
63+
go.uber.org/zap v1.27.1 // indirect
64+
golang.org/x/crypto v0.48.0 // indirect
65+
golang.org/x/net v0.50.0 // indirect
66+
golang.org/x/oauth2 v0.35.0 // indirect
67+
golang.org/x/sys v0.41.0 // indirect
68+
golang.org/x/term v0.40.0 // indirect
69+
golang.org/x/text v0.34.0 // indirect
70+
golang.org/x/time v0.14.0 // indirect
71+
golang.org/x/tools v0.42.0 // indirect
72+
google.golang.org/grpc v1.79.1 // indirect
73+
google.golang.org/protobuf v1.36.11 // indirect
7974
gopkg.in/inf.v0 v0.9.1 // indirect
8075
gopkg.in/yaml.v3 v3.0.1 // indirect
81-
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
82-
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
83-
sigs.k8s.io/structured-merge-diff/v4 v4.7.0
84-
sigs.k8s.io/yaml v1.5.0 // indirect
76+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect
77+
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
78+
sigs.k8s.io/yaml v1.6.0 // indirect
8579
)
8680

8781
require (
88-
cel.dev/expr v0.23.1 // indirect
82+
cel.dev/expr v0.25.1 // indirect
8983
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
9084
github.com/MakeNowJust/heredoc v1.0.0 // indirect
91-
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
85+
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
86+
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
9287
github.com/chai2010/gettext-go v1.0.2 // indirect
9388
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
94-
github.com/fxamacker/cbor/v2 v2.8.0 // indirect
89+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
9590
github.com/go-errors/errors v1.4.2 // indirect
96-
github.com/go-openapi/jsonpointer v0.21.0 // indirect
97-
github.com/go-openapi/jsonreference v0.21.0 // indirect
98-
github.com/go-openapi/swag v0.23.0 // indirect
91+
github.com/go-openapi/jsonpointer v0.22.4 // indirect
92+
github.com/go-openapi/jsonreference v0.21.4 // indirect
93+
github.com/go-openapi/swag v0.25.4 // indirect
94+
github.com/go-openapi/swag/cmdutils v0.25.4 // indirect
95+
github.com/go-openapi/swag/conv v0.25.4 // indirect
96+
github.com/go-openapi/swag/fileutils v0.25.4 // indirect
97+
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
98+
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
99+
github.com/go-openapi/swag/loading v0.25.4 // indirect
100+
github.com/go-openapi/swag/mangling v0.25.4 // indirect
101+
github.com/go-openapi/swag/netutils v0.25.4 // indirect
102+
github.com/go-openapi/swag/stringutils v0.25.4 // indirect
103+
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
104+
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
99105
github.com/google/btree v1.1.3 // indirect
100-
github.com/google/gnostic-models v0.6.9 // indirect
101-
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
102-
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
106+
github.com/google/gnostic-models v0.7.1 // indirect
103107
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
104108
github.com/kylelemons/godebug v1.1.0 // indirect
105109
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
106110
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
107-
github.com/moby/spdystream v0.5.0 // indirect
108111
github.com/moby/term v0.5.0 // indirect
109112
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
110-
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
111113
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
112114
github.com/russross/blackfriday/v2 v2.1.0 // indirect
113115
github.com/x448/float16 v0.8.4 // indirect
114116
github.com/xlab/treeprint v1.2.0 // indirect
115-
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
116-
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
117-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect
118-
go.opentelemetry.io/otel v1.35.0 // indirect
119-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
120-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
121-
go.opentelemetry.io/otel/metric v1.35.0 // indirect
122-
go.opentelemetry.io/otel/sdk v1.34.0 // indirect
123-
go.opentelemetry.io/otel/trace v1.35.0 // indirect
124-
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
125-
go.yaml.in/yaml/v2 v2.4.2 // indirect
126-
go.yaml.in/yaml/v3 v3.0.3 // indirect
127-
golang.org/x/mod v0.21.0 // indirect
128-
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
129-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
130-
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
131-
sigs.k8s.io/kustomize/api v0.19.0 // indirect
132-
sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect
117+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
118+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 // indirect
119+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect
120+
go.opentelemetry.io/otel v1.40.0 // indirect
121+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect
122+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect
123+
go.opentelemetry.io/otel/metric v1.40.0 // indirect
124+
go.opentelemetry.io/otel/sdk v1.40.0 // indirect
125+
go.opentelemetry.io/otel/trace v1.40.0 // indirect
126+
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
127+
go.yaml.in/yaml/v2 v2.4.3 // indirect
128+
go.yaml.in/yaml/v3 v3.0.4 // indirect
129+
golang.org/x/mod v0.33.0 // indirect
130+
google.golang.org/genproto/googleapis/api v0.0.0-20260217215200-42d3e9bedb6d // indirect
131+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260217215200-42d3e9bedb6d // indirect
132+
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
133+
sigs.k8s.io/kustomize/api v0.20.1 // indirect
134+
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
133135
sigs.k8s.io/randfill v1.0.0 // indirect
134136
)

0 commit comments

Comments
 (0)