Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breakout kgateway from gloo/solo deps #10492

Merged
merged 10 commits into from
Jan 23, 2025
Merged

breakout kgateway from gloo/solo deps #10492

merged 10 commits into from
Jan 23, 2025

Conversation

lgadban
Copy link
Contributor

@lgadban lgadban commented Jan 23, 2025

Removes all dependencies on existing gloo code to allow the kgateway controller (current under projects/gateway2) to build on its own.

This is a prerequisite to purging the no longer needed Gloo Edge code that primarily serves the classic Gloo Edge API.

The organization and abstractions of the helper code/packages that were copied out from the Gloo Edge code was not given much thought as the primary goal here is to get a buildable unit that passes all tests. We will need to audit and cleanup the way the previously shared code is organized and factored in a fast-follow.

There is some leftover work from when I initially was going to delete many of the existing project dirs, notably including envoyinit. Since this PR doesn't remove envoyinit, the related changes are not completely necessary. But they do not hurt anything and will be fixed in the PR in this series, I am tempted to leave them in as-is.

@lgadban lgadban marked this pull request as ready for review January 23, 2025 04:13
@lgadban lgadban changed the title breakout kgateway from gloo/solo deps [wip] breakout kgateway from gloo/solo deps Jan 23, 2025
Comment on lines +55 to +57
registry: quay.io/solo-io
repository: gloo-envoy-wrapper
tag: 1.18.5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hack to get a reliable envoy image while we prepare for revamping envoy-init

alternatively we could delay this PR and get envoyinit broken out as well in prep for the mass purge

see also #10491

_ "github.com/solo-io/gloo/projects/gloo/pkg/translator"
// _ "github.com/solo-io/gloo/projects/gloo/pkg/translator"
//
// TODO: these imports are effectively copied over from envoyinit/filter_types.gen.go
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see also #10491

TEST_PKG: "./projects/gateway2/... ./test/kubernetes/testutils/helper"
TEST_PKG: "./projects/gateway2/..."
# TODO: remove this once we delete gloo
GOLANG_PROTOBUF_REGISTRATION_CONFLICT: "ignore"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed until we remove gloo, dupe protos from gloo and envoy-gloo/go

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i hate that variable haha :) happy to see a path to remove it

Comment on lines +262 to +263
- name: GOLANG_PROTOBUF_REGISTRATION_CONFLICT
value: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed until we remove gloo, dupe protos from gloo and envoy-gloo/go

@lgadban lgadban changed the title [wip] breakout kgateway from gloo/solo deps breakout kgateway from gloo/solo deps Jan 23, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a copy/paste of projects/gloo/pkg/plugins/staged_filters.go

needs to be figured out as part of #10491

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a copy/paste of gloo's filter stage proto-based api
(ref: projects/gloo/pkg/api/v1/filters/stages.pb.go)

the actual plan for this should be figured out in #10491

// MessageToAny takes any given proto message msg and returns the marshalled bytes of the proto, and a url to the type
// definition for the proto in the form of a *pany.Any, errors if nil or if the proto type doesnt exist or if there is
// a marshalling error
func MessageToAny(msg proto.Message) (*pany.Any, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once we get rid old protos we can get rid of this and just do anypb.New

}, nil
}

func AnyToMessage(a *pany.Any) (proto.Message, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above but with any.UnmarshalTo

Copy link
Contributor

@yuval-k yuval-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; will wait with approval to give a chance to others to comment

@@ -338,9 +338,10 @@ generate-cli-docs: clean-cli-docs ## Removes existing CLI docs and re-generates
GO111MODULE=on go run projects/gloo/cli/cmd/docs/main.go

# Ensures that accesses for fields which have "getter" functions are exclusively done via said "getter" functions
# TODO: do we still want this?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the answer is likely yes?

I kinda hate the Format of .GetSomething but having panics due to bad accessors is super painful and people seem to be good at writing that kind of bug.
Therefore I am marginally on the side of keeping it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm in favor of getter checks, but iirc this only works with protobuf-generated go types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my reasoning here is that we are going away from proto generated APIs so this is much less likely of a concern.
but thinking a bit more, we still will interact with envoy protos and in general it doesn't hurt to keep it around!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we replace this tool in favor of https://golangci-lint.run/usage/linters/#protogetter? or remove it entirely until there's a need?

Copy link
Contributor

@nfuden nfuden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.
The only parts where i started digging in and was about to comment ended up just being copied code so n oneed to relitigate them now!
Thanks for doing this!

@nfuden nfuden added this pull request to the merge queue Jan 23, 2025
- name: Install Test Utils
shell: bash
run: make -C ./projects/gateway2/ install-go-tools
- name: Run Tests
shell: bash
env:
TEST_PKG: "./projects/gateway2/... ./test/kubernetes/testutils/helper"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we no longer need to use/test whatever's under ./test/kubernetes/testutils/helper?

K8S_GATEWAY_DIR=projects/gateway2
GLOO_SOURCES=$(call get_sources,$(GLOO_DIR))
# GLOO_SOURCES=$(call get_sources,$(GLOO_DIR))
EDGE_GATEWAY_SOURCES=$(call get_sources,$(EDGE_GATEWAY_DIR))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

Merged via the queue into main with commit 3f28616 Jan 23, 2025
6 checks passed
@nfuden nfuden deleted the law/kgw-breakout branch January 23, 2025 15:13
@lgadban lgadban linked an issue Jan 24, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove old gloo code
5 participants