Skip to content

Commit 2dbc4fd

Browse files
committed
feat: add Teardown and TeardownAndDestroy RPCs to the State service
Allow clients to mark a resource as being destroyed and to delete it atomically without intermediate reads. Teardown marks a resource as being destroyed in a single round-trip, without first reading it back. The response indicates whether the resource has no pending finalizers and is ready to be destroyed. TeardownAndDestroy deletes a resource as a single atomic operation. The call marks the resource as being destroyed, blocks until it has no pending finalizers, and then destroys it. This avoids needing to watch the resource between teardown and destroy, which is useful for resources that callers can destroy but not read. Two new optional interfaces, Teardowner and TeardownAndDestroyer, let CoreState implementations provide native versions of these operations that bypass the default fallback paths. The state wrapper picks them up via type assertion, with the existing logic retained as the fallback for implementations that do not satisfy them. The gRPC client adapter implements both interfaces so that one round-trip reaches the server, transparently falling back when the server returns Unimplemented. Also rekres the project and bump dependencies. Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
1 parent e4881ea commit 2dbc4fd

30 files changed

Lines changed: 3524 additions & 869 deletions

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2025-09-01T12:59:11Z by kres 784fa1f.
3+
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
44

55
*
66
!api
@@ -12,3 +12,4 @@
1212
!README.md
1313
!.markdownlint.json
1414
!hack/govulncheck.sh
15+
!.disvulncheck.yaml

.github/workflows/ci.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-02-11T22:34:44Z by kres f3ab59e.
3+
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
44

55
concurrency:
66
group: ${{ github.head_ref || github.run_id }}
@@ -55,17 +55,25 @@ jobs:
5555
done
5656
continue-on-error: true
5757
- name: checkout
58-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # version: v6.0.1
58+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # version: v6.0.2
5959
- name: Unshallow
6060
run: |
6161
git fetch --prune --unshallow
6262
- name: Set up Docker Buildx
6363
id: setup-buildx
64-
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # version: v3.12.0
64+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # version: v4.0.0
6565
with:
6666
driver: remote
6767
endpoint: tcp://buildkit-amd64.ci.svc.cluster.local:1234
6868
timeout-minutes: 10
69+
- name: CI temp release tag
70+
if: github.event_name == 'pull_request'
71+
run: |
72+
make ci-temp-release-tag
73+
- name: Check dirty
74+
if: github.event_name == 'pull_request'
75+
run: |
76+
make check-dirty
6977
- name: base
7078
run: |
7179
make base
@@ -74,7 +82,7 @@ jobs:
7482
make runtime
7583
- name: Login to registry
7684
if: github.event_name != 'pull_request'
77-
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # version: v3.6.0
85+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # version: v4.1.0
7886
with:
7987
password: ${{ secrets.GITHUB_TOKEN }}
8088
registry: ghcr.io
@@ -106,7 +114,7 @@ jobs:
106114
make release-notes
107115
- name: Release
108116
if: startsWith(github.ref, 'refs/tags/')
109-
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # version: v2.5.0
117+
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # version: v3.0.0
110118
with:
111119
body_path: _out/RELEASE_NOTES.md
112120
draft: "true"
@@ -146,13 +154,13 @@ jobs:
146154
done
147155
continue-on-error: true
148156
- name: checkout
149-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # version: v6.0.1
157+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # version: v6.0.2
150158
- name: Unshallow
151159
run: |
152160
git fetch --prune --unshallow
153161
- name: Set up Docker Buildx
154162
id: setup-buildx
155-
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # version: v3.12.0
163+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # version: v4.0.0
156164
with:
157165
driver: remote
158166
endpoint: tcp://buildkit-amd64.ci.svc.cluster.local:1234
@@ -193,13 +201,13 @@ jobs:
193201
done
194202
continue-on-error: true
195203
- name: checkout
196-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # version: v6.0.1
204+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # version: v6.0.2
197205
- name: Unshallow
198206
run: |
199207
git fetch --prune --unshallow
200208
- name: Set up Docker Buildx
201209
id: setup-buildx
202-
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # version: v3.12.0
210+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # version: v4.0.0
203211
with:
204212
driver: remote
205213
endpoint: tcp://buildkit-amd64.ci.svc.cluster.local:1234
@@ -211,7 +219,7 @@ jobs:
211219
run: |
212220
make unit-tests-race
213221
- name: coverage
214-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # version: v5.5.2
222+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # version: v6.0.0
215223
with:
216224
files: _out/coverage-unit-tests.txt
217225
flags: unit-tests

.github/workflows/slack-notify-ci-failure.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-02-11T22:21:54Z by kres f3ab59e.
3+
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
44

55
"on":
66
workflow_run:
@@ -18,7 +18,7 @@ jobs:
1818
if: github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event != 'pull_request'
1919
steps:
2020
- name: Slack Notify
21-
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # version: v2.1.1
21+
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # version: v3.0.2
2222
with:
2323
method: chat.postMessage
2424
payload: |

.github/workflows/slack-notify.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-02-11T22:21:54Z by kres f3ab59e.
3+
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
44

55
"on":
66
workflow_run:
@@ -23,7 +23,7 @@ jobs:
2323
run: |
2424
echo pull_request_number=$(gh pr view -R ${{ github.repository }} ${{ github.event.workflow_run.head_repository.owner.login }}:${{ github.event.workflow_run.head_branch }} --json number --jq .number) >> $GITHUB_OUTPUT
2525
- name: Slack Notify
26-
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # version: v2.1.1
26+
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # version: v3.0.2
2727
with:
2828
method: chat.postMessage
2929
payload: |

.github/workflows/stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-02-11T22:21:54Z by kres f3ab59e.
3+
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
44

55
"on":
66
schedule:
@@ -15,7 +15,7 @@ jobs:
1515
- ubuntu-latest
1616
steps:
1717
- name: Close stale issues and PRs
18-
uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # version: v10.1.1
18+
uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # version: v10.2.0
1919
with:
2020
close-issue-message: This issue was closed because it has been stalled for 7 days with no activity.
2121
days-before-issue-close: "5"

.kres.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ spec:
55
- --experimental_allow_proto3_optional
66
vtProtobufEnabled: true
77
specs:
8-
- source: https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/resource.proto
8+
- source: https://raw.githubusercontent.com/cosi-project/specification/09c012d09660f694167adc12ec8a1e81cdc1bb41/proto/v1alpha1/resource.proto
99
subdirectory: v1alpha1/
1010
genGateway: true
1111
external: false
12-
- source: https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/state.proto
12+
- source: https://raw.githubusercontent.com/cosi-project/specification/09c012d09660f694167adc12ec8a1e81cdc1bb41/proto/v1alpha1/state.proto
1313
subdirectory: v1alpha1/
1414
genGateway: true
1515
external: false
16-
- source: https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/meta.proto
16+
- source: https://raw.githubusercontent.com/cosi-project/specification/09c012d09660f694167adc12ec8a1e81cdc1bb41/proto/v1alpha1/meta.proto
1717
subdirectory: v1alpha1/
1818
genGateway: true
1919
external: false

Dockerfile

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# syntax = docker/dockerfile-upstream:1.20.0-labs
1+
# syntax = docker/dockerfile-upstream:1.23.0-labs
22

33
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
44
#
5-
# Generated on 2026-02-11T22:34:44Z by kres f3ab59e.
5+
# Generated on 2026-05-10T22:33:29Z by kres 1762ab2.
66

77
ARG TOOLCHAIN=scratch
88

9-
FROM ghcr.io/siderolabs/ca-certificates:v1.12.0 AS image-ca-certificates
9+
FROM ghcr.io/siderolabs/ca-certificates:v1.13.0 AS image-ca-certificates
1010

11-
FROM ghcr.io/siderolabs/fhs:v1.12.0 AS image-fhs
11+
FROM ghcr.io/siderolabs/fhs:v1.13.0 AS image-fhs
1212

1313
# runs markdownlint
14-
FROM docker.io/oven/bun:1.3.6-alpine AS lint-markdown
14+
FROM docker.io/oven/bun:1.3.13-alpine AS lint-markdown
1515
WORKDIR /src
16-
RUN bun i markdownlint-cli@0.47.0 sentences-per-line@0.5.0
16+
RUN bun i markdownlint-cli@0.48.0 sentences-per-line@0.5.2
1717
COPY .markdownlint.json .
1818
COPY ./README.md ./README.md
1919
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules markdownlint-sentences-per-line .
2020

2121
# collects proto specs
2222
FROM scratch AS proto-specs
23-
ADD https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/resource.proto /api/v1alpha1/
24-
ADD https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/state.proto /api/v1alpha1/
25-
ADD https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/meta.proto /api/v1alpha1/
23+
ADD https://raw.githubusercontent.com/cosi-project/specification/09c012d09660f694167adc12ec8a1e81cdc1bb41/proto/v1alpha1/resource.proto /api/v1alpha1/
24+
ADD https://raw.githubusercontent.com/cosi-project/specification/09c012d09660f694167adc12ec8a1e81cdc1bb41/proto/v1alpha1/state.proto /api/v1alpha1/
25+
ADD https://raw.githubusercontent.com/cosi-project/specification/09c012d09660f694167adc12ec8a1e81cdc1bb41/proto/v1alpha1/meta.proto /api/v1alpha1/
2626
ADD api/key_storage/key_storage.proto /api/key_storage/
2727

2828
# base toolchain image
@@ -65,6 +65,9 @@ RUN --mount=type=cache,target=/root/.cache/go-build,id=runtime/root/.cache/go-bu
6565
&& mv /go/bin/golangci-lint /bin/golangci-lint
6666
RUN --mount=type=cache,target=/root/.cache/go-build,id=runtime/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=runtime/go/pkg go install golang.org/x/vuln/cmd/govulncheck@latest \
6767
&& mv /go/bin/govulncheck /bin/govulncheck
68+
ARG DIS_VULNCHECK_VERSION
69+
RUN --mount=type=cache,target=/root/.cache/go-build,id=runtime/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=runtime/go/pkg go install github.com/shanduur/dis-vulncheck@${DIS_VULNCHECK_VERSION} \
70+
&& mv /go/bin/dis-vulncheck /bin/dis-vulncheck
6871
ARG GOFUMPT_VERSION
6972
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
7073
&& mv /go/bin/gofumpt /bin/gofumpt
@@ -116,8 +119,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build,id=runtime/root/.cache/go-bu
116119
# runs govulncheck
117120
FROM base AS lint-govulncheck
118121
WORKDIR /src
119-
COPY --chmod=0755 hack/govulncheck.sh ./hack/govulncheck.sh
120-
RUN --mount=type=cache,target=/root/.cache/go-build,id=runtime/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=runtime/go/pkg ./hack/govulncheck.sh ./...
122+
RUN --mount=type=cache,target=/root/.cache/go-build,id=runtime/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=runtime/go/pkg dis-vulncheck -tool=false ./...
121123

122124
# runs unit-tests with race detector
123125
FROM base AS unit-tests-race

Makefile

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-02-11T22:34:44Z by kres f3ab59e.
3+
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
44

55
# common variables
66

77
SHA := $(shell git describe --match=none --always --abbrev=8 --dirty)
8-
TAG := $(shell git describe --tag --always --dirty --match v[0-9]\*)
8+
TAG ?= $(shell git describe --tag --always --dirty --match v[0-9]\*)
99
TAG_SUFFIX ?=
10-
ABBREV_TAG := $(shell git describe --tags >/dev/null 2>/dev/null && git describe --tag --always --match v[0-9]\* --abbrev=0 || echo 'undefined')
10+
ABBREV_TAG ?= $(shell git describe --tags >/dev/null 2>/dev/null && git describe --tag --always --match v[0-9]\* --abbrev=0 || echo 'undefined')
1111
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
1212
ARTIFACTS := _out
1313
IMAGE_TAG ?= $(TAG)$(TAG_SUFFIX)
1414
OPERATING_SYSTEM := $(shell uname -s | tr '[:upper:]' '[:lower:]')
1515
GOARCH := $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
16+
CI_RELEASE_TAG := $(shell git log --oneline --format=%B -n 1 HEAD^2 -- 2>/dev/null | head -n 1 | sed -r "/^release\(.*\)/ s/^release\((.*)\):.*$$/\\1/; t; Q")
1617
WITH_DEBUG ?= false
1718
WITH_RACE ?= false
1819
REGISTRY ?= ghcr.io
1920
USERNAME ?= cosi-project
2021
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
2122
PROTOBUF_GO_VERSION ?= 1.36.11
22-
GRPC_GO_VERSION ?= 1.6.0
23-
GRPC_GATEWAY_VERSION ?= 2.27.4
23+
GRPC_GO_VERSION ?= 1.6.1
24+
GRPC_GATEWAY_VERSION ?= 2.29.0
2425
VTPROTOBUF_VERSION ?= 0.6.0
25-
GOIMPORTS_VERSION ?= 0.41.0
26+
GOIMPORTS_VERSION ?= 0.44.0
2627
GOMOCK_VERSION ?= 0.6.0
2728
DEEPCOPY_VERSION ?= v0.5.8
28-
GOLANGCILINT_VERSION ?= v2.8.0
29+
GOLANGCILINT_VERSION ?= v2.11.4
2930
GOFUMPT_VERSION ?= v0.9.2
30-
GO_VERSION ?= 1.25.6
31+
GO_VERSION ?= 1.26.2
32+
DIS_VULNCHECK_VERSION ?= v0.0.0-20260409114749-05440f84fe69
3133
GO_BUILDFLAGS ?=
3234
GO_BUILDTAGS ?= ,
3335
GO_LDFLAGS ?=
@@ -75,8 +77,9 @@ COMMON_ARGS += --build-arg=GOMOCK_VERSION="$(GOMOCK_VERSION)"
7577
COMMON_ARGS += --build-arg=DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)"
7678
COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
7779
COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
80+
COMMON_ARGS += --build-arg=DIS_VULNCHECK_VERSION="$(DIS_VULNCHECK_VERSION)"
7881
COMMON_ARGS += --build-arg=TESTPKGS="$(TESTPKGS)"
79-
TOOLCHAIN ?= docker.io/golang:1.25-alpine
82+
TOOLCHAIN ?= docker.io/golang:1.26-alpine
8083

8184
# help menu
8285

@@ -153,6 +156,14 @@ $(ARTIFACTS): ## Creates artifacts directory.
153156
clean: ## Cleans up all artifacts.
154157
@rm -rf $(ARTIFACTS)
155158

159+
.PHONY: ci-temp-release-tag
160+
ci-temp-release-tag: ## Generates a temporary release tag for CI run.
161+
@if [ -n "$(CI_RELEASE_TAG)" -a -n "$${GITHUB_ENV}" ]; then \
162+
echo Setting temporary release tag "$(CI_RELEASE_TAG)"; \
163+
echo "TAG=$(CI_RELEASE_TAG)" >> "$${GITHUB_ENV}"; \
164+
echo "ABBREV_TAG=$(CI_RELEASE_TAG)" >> "$${GITHUB_ENV}"; \
165+
fi
166+
156167
target-%: ## Builds the specified target defined in the Dockerfile. The build result will only remain in the build cache.
157168
@$(BUILD) --target=$* $(COMMON_ARGS) $(TARGET_ARGS) $(CI_ARGS) .
158169

@@ -172,7 +183,7 @@ local-%: ## Builds the specified target defined in the Dockerfile using the loc
172183
done'
173184

174185
.PHONY: check-dirty
175-
check-dirty:
186+
check-dirty: generate
176187
@if test -n "`git status --porcelain`"; then echo "Source tree is dirty"; git status; git diff; exit 1 ; fi
177188

178189
generate: ## Generate .proto definitions.
@@ -253,3 +264,15 @@ conformance:
253264
@docker pull $(CONFORMANCE_IMAGE)
254265
@docker run --rm -it -v $(PWD):/src -w /src $(CONFORMANCE_IMAGE) enforce
255266

267+
.PHONY: renovate-local
268+
renovate-local: ## runs renovate locally to check syntax and test configuration
269+
@docker run --rm \
270+
--user $(shell id -u):$(shell id -g) \
271+
-v $(PWD):/src \
272+
-w /src \
273+
-e GITHUB_TOKEN \
274+
-e LOG_LEVEL=debug \
275+
-e RENOVATE_PLATFORM=local \
276+
-e RENOVATE_DRY_RUN=full \
277+
renovate/renovate
278+

0 commit comments

Comments
 (0)