You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: migrate protobuf codegen to protoc-gen-go and grpc-gateway v2
Replace gogo/protobuf codegen (protoc-gen-gogofast) with the official
protoc-gen-go + protoc-gen-go-grpc. Migrate grpc-gateway from v1 to v2
and replace protoc-gen-swagger with protoc-gen-openapiv2. Drop
go-grpc-middleware v1 in favor of grpc.ChainUnaryInterceptor.
BREAKING CHANGE: the /api/v1/stream/events/{namespace} stream now wraps
each event as {"type", "object"}; some OpenAPI definitions are renamed
(e.g. WorkflowCreateRequest -> CreateWorkflowBody), renaming generated
SDK classes; HTTP error bodies use google.rpc.Status. See
docs/upgrading.md.
Key changes:
- Bump k8s.io/code-generator and proto deps to v0.35.4, aligned with
go.mod's k8s.io libraries
- protoc-gen-go generates .pb.go (messages), protoc-gen-go-grpc
generates _grpc.pb.go (service stubs)
- grpc-gateway v2 runtime in argoserver.go
- New leaf package util/grpc/gateway holds the gateway glue shared by
the server and the generated pkg/apiclient code: an SSE/fields-aware
stream forwarder (reusing util/fields.Cleaner) and gateway.MessageV2Of,
which bridges gogo-generated v1alpha1 types to grpc-gateway v2's
proto.Message while preserving their encoding/json wire format
- Vendor patch (hack/vendor-patches.sh) for K8s types losing
ProtoMessage() in k8s 1.36+: changes panic to return nil in
protoMessageV2Of (anchored to that one function, fails loudly if it
no longer applies), letting aberrantLoadMessageDesc handle them; the
kubernetes_protomessage_one_more_release build tag stays exported for
builds that do not use the vendor tree
- Add `make vendor` target (go mod vendor + vendor patches) wired as
prerequisite to all proto/build/test targets
- Wrap WatchEvents RPC in EventWatchEvent (matching the *WatchEvent
naming of the other streams) and update the UI events panel for the
new shape
- HTTP request contexts carry the server logger; the gateway stream
forwarder falls back to a default logger rather than panicking from
its keepalive goroutine when one is missing
- pkg/apiclient probes at startup that Kubernetes types can be
marshalled, turning the unprotected-module-consumer panic into an
immediate, actionable error (pkg/apiclient/protocompat.go)
- HTTP round-trip test (bufconn gRPC + gateway mux + httptest, sharing
the production mux configuration) pinning unary JSON bodies, unary and
in-stream google.rpc.Status error shapes, SSE streaming/flush, the
{"result": ...} envelope, and ?fields filtering
- Update swaggify.sh for protoc-gen-openapiv2 naming conventions
- Artifact endpoints in _.primary.swagger.json moved to the
google.rpc.Status error model used everywhere else
- Migrate the nix dev env (dev/nix/flake.nix, devenv.nix) to the new
toolchain
- Renovate managers for the codegen tool pins, including the nix copies
(annotated, never automerged)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Alan Clucas <alan@clucas.org>
Claude-Session: https://claude.ai/code/session_01HDe5nzNL4WzD4CTAWZT5Et
Description: Migrate protobuf codegen from gogo/protobuf to protoc-gen-go and grpc-gateway v2
2
+
Authors: [Alan Clucas](https://github.com/Joibel)
3
+
Component: Build and Development
4
+
Issues: 7400 16595
5
+
6
+
The API client and server stubs under `pkg/apiclient` are now generated with the officially maintained `protoc-gen-go` and `protoc-gen-go-grpc` instead of the unmaintained gogo/protobuf fork.
7
+
The HTTP gateway moved from grpc-gateway v1 to v2, and `protoc-gen-openapiv2` replaces `protoc-gen-swagger`.
8
+
9
+
This is largely internal, but has some API-visible effects:
10
+
11
+
- The `/api/v1/stream/events/{namespace}` stream now wraps each event as `{"result": {"type": ..., "object": ...}}` instead of `{"result": <Event>}`, matching the other watch streams.
12
+
- Some OpenAPI definition names changed (for example `WorkflowCreateRequest` is now `CreateWorkflowBody`), which renames the corresponding generated SDK classes.
13
+
- HTTP error bodies now use the standard `google.rpc.Status` shape instead of grpc-gateway v1's error types.
- Vendoring: use `make vendor`, never plain `go mod vendor` — the make target also runs `hack/vendor-patches.sh`, which patches vendored `google.golang.org/protobuf` so messages embedding Kubernetes types keep marshalling once Kubernetes v1.36 removes `ProtoMessage()`.
18
+
Builds driven through make are also covered by the `kubernetes_protomessage_one_more_release` build tag the Makefile exports, but plain `go build`/`go test`/gopls get no tag and rely on the patched vendor tree — plain `go mod vendor` silently reverts the patch, and the only runtime safety net is the startup probe in `pkg/apiclient/protocompat.go`.
0 commit comments