Skip to content

Commit

Permalink
feat: implement correct watch restart for controller runtime
Browse files Browse the repository at this point in the history
Controller runtime does `WatchKind` on all controller input resources,
but initial bookmark value is only delivered if there is any update
received (on each of the watches).

If resource cache is used, `BootstrapContents` will deliver the
bookmark, but if the cache is not used, and there are no updates, no
bookmark is ever sent, so watch can't be restarted.

Fix this by adding yet another option to send 'Noop' events which carry
only the bookmark allowing watch retry code to handle it.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Dec 27, 2024
1 parent eea1d62 commit 2d42e3e
Show file tree
Hide file tree
Showing 21 changed files with 518 additions and 405 deletions.
6 changes: 3 additions & 3 deletions .kres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ spec:
- --experimental_allow_proto3_optional
vtProtobufEnabled: true
specs:
- source: https://raw.githubusercontent.com/cosi-project/specification/3a4d5d04bea01b9549af4e8c0d593ace09a7ebd3/proto/v1alpha1/resource.proto
- source: https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/resource.proto
subdirectory: v1alpha1/
genGateway: true
external: false
- source: https://raw.githubusercontent.com/cosi-project/specification/3a4d5d04bea01b9549af4e8c0d593ace09a7ebd3/proto/v1alpha1/state.proto
- source: https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/state.proto
subdirectory: v1alpha1/
genGateway: true
external: false
- source: https://raw.githubusercontent.com/cosi-project/specification/3a4d5d04bea01b9549af4e8c0d593ace09a7ebd3/proto/v1alpha1/meta.proto
- source: https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/meta.proto
subdirectory: v1alpha1/
genGateway: true
external: false
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# syntax = docker/dockerfile-upstream:1.12.0-labs
# syntax = docker/dockerfile-upstream:1.12.1-labs

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-12-17T14:42:24Z by kres b9507d6.
# Generated on 2024-12-27T11:10:43Z by kres fcff05e.

ARG TOOLCHAIN

Expand All @@ -11,7 +11,7 @@ FROM ghcr.io/siderolabs/ca-certificates:v1.9.0 AS image-ca-certificates
FROM ghcr.io/siderolabs/fhs:v1.9.0 AS image-fhs

# runs markdownlint
FROM docker.io/oven/bun:1.1.38-alpine AS lint-markdown
FROM docker.io/oven/bun:1.1.40-alpine AS lint-markdown
WORKDIR /src
RUN bun i markdownlint-cli@0.43.0 sentences-per-line@0.3.0
COPY .markdownlint.json .
Expand All @@ -20,9 +20,9 @@ RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ig

# collects proto specs
FROM scratch AS proto-specs
ADD https://raw.githubusercontent.com/cosi-project/specification/3a4d5d04bea01b9549af4e8c0d593ace09a7ebd3/proto/v1alpha1/resource.proto /api/v1alpha1/
ADD https://raw.githubusercontent.com/cosi-project/specification/3a4d5d04bea01b9549af4e8c0d593ace09a7ebd3/proto/v1alpha1/state.proto /api/v1alpha1/
ADD https://raw.githubusercontent.com/cosi-project/specification/3a4d5d04bea01b9549af4e8c0d593ace09a7ebd3/proto/v1alpha1/meta.proto /api/v1alpha1/
ADD https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/resource.proto /api/v1alpha1/
ADD https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/state.proto /api/v1alpha1/
ADD https://raw.githubusercontent.com/cosi-project/specification/a25fac056c642b32468b030387ab94c17bc3ba1d/proto/v1alpha1/meta.proto /api/v1alpha1/
ADD api/key_storage/key_storage.proto /api/key_storage/

# base toolchain image
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-12-09T13:31:00Z by kres 8183c20.
# Generated on 2024-12-27T11:10:43Z by kres fcff05e.

# common variables

Expand All @@ -17,7 +17,7 @@ WITH_RACE ?= false
REGISTRY ?= ghcr.io
USERNAME ?= cosi-project
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
PROTOBUF_GO_VERSION ?= 1.35.2
PROTOBUF_GO_VERSION ?= 1.36.0
GRPC_GO_VERSION ?= 1.5.1
GRPC_GATEWAY_VERSION ?= 2.24.0
VTPROTOBUF_VERSION ?= 0.6.0
Expand Down
24 changes: 11 additions & 13 deletions api/key_storage/key_storage.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 13 additions & 16 deletions api/v1alpha1/meta.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 35 additions & 41 deletions api/v1alpha1/resource.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2d42e3e

Please sign in to comment.