Skip to content

Go Structs for GEP-91 #2953

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

Merged
merged 4 commits into from
Apr 11, 2024
Merged

Go Structs for GEP-91 #2953

merged 4 commits into from
Apr 11, 2024

Conversation

arkodg
Copy link
Contributor

@arkodg arkodg commented Apr 9, 2024

/kind documentation
/kind feature
/kind gep

What this PR does / why we need it:

Takes #2759 forward and implements the go structs described in GEP-91 https://gateway-api.sigs.k8s.io/geps/gep-91/

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

Adds support for a new FrontendValidation field with the Gateway Listener TLS field to support validation of client certificates using a CA Certificate as a trust anchor

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. kind/gep PRs related to Gateway Enhancement Proposal(GEP) cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 9, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 9, 2024
@arkodg
Copy link
Contributor Author

arkodg commented Apr 9, 2024

cc @robscott

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 9, 2024
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @arkodg! This mostly LGTM, just looks like some codegen issues in presubmit.

@arkodg
Copy link
Contributor Author

arkodg commented Apr 10, 2024

/retest

@arkodg
Copy link
Contributor Author

arkodg commented Apr 10, 2024

not seeing any failures when running ./hack/verify-all.sh -v locally
except for this one, unsure how its related to this PR

Verifying docker images
./hack/../hack/verify-docker-build.sh: line 25: BUILDX_CONTEXT: unbound variable
Test FAILED: ./hack/../hack/verify-docker-build.sh 

@robscott
Copy link
Member

robscott commented Apr 10, 2024

@arkodg I tried running hack/update-codegen.sh from your PR and ended up with changes to a couple generated GRPC pb files:

diff --git a/conformance/echo-basic/grpcechoserver/grpcecho.pb.go b/conformance/echo-basic/grpcechoserver/grpcecho.pb.go
index 81135b30..9585b776 100644
--- a/conformance/echo-basic/grpcechoserver/grpcecho.pb.go
+++ b/conformance/echo-basic/grpcechoserver/grpcecho.pb.go
@@ -14,7 +14,7 @@

 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-//     protoc-gen-go v1.28.0
+//     protoc-gen-go v1.28.1
 //     protoc        v4.22.2
 // source: grpcecho.proto

diff --git a/conformance/echo-basic/grpcechoserver/grpcecho_grpc.pb.go b/conformance/echo-basic/grpcechoserver/grpcecho_grpc.pb.go
index 67d46680..f367cb66 100644
--- a/conformance/echo-basic/grpcechoserver/grpcecho_grpc.pb.go
+++ b/conformance/echo-basic/grpcechoserver/grpcecho_grpc.pb.go
@@ -1,4 +1,8 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.2.0
+// - protoc             v4.22.2
+// source: grpcecho.proto

 package grpcechoserver

@@ -11,6 +15,7 @@ import (

 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
 const _ = grpc.SupportPackageIsVersion7

 // GrpcEchoClient is the client API for GrpcEcho service.
@@ -95,8 +100,8 @@ type UnsafeGrpcEchoServer interface {
        mustEmbedUnimplementedGrpcEchoServer()
 }

-func RegisterGrpcEchoServer(s *grpc.Server, srv GrpcEchoServer) {
-       s.RegisterService(&_GrpcEcho_serviceDesc, srv)
+func RegisterGrpcEchoServer(s grpc.ServiceRegistrar, srv GrpcEchoServer) {
+       s.RegisterService(&GrpcEcho_ServiceDesc, srv)
 }

 func _GrpcEcho_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
@@ -153,7 +158,10 @@ func _GrpcEcho_EchoThree_Handler(srv interface{}, ctx context.Context, dec func(
        return interceptor(ctx, in, info, handler)
 }

-var _GrpcEcho_serviceDesc = grpc.ServiceDesc{
+// GrpcEcho_ServiceDesc is the grpc.ServiceDesc for GrpcEcho service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var GrpcEcho_ServiceDesc = grpc.ServiceDesc{
        ServiceName: "gateway_api_conformance.echo_basic.grpcecho.GrpcEcho",
        HandlerType: (*GrpcEchoServer)(nil),
        Methods: []grpc.MethodDesc{
~
~
~

I think that would resolve the failing presubmit, I'm guessing you're not seeing the same diff when you run codegen?

@arkodg
Copy link
Contributor Author

arkodg commented Apr 10, 2024

ha thanks @robscott !

bumping protoc-gen-go & protoc-gen-go-grpc did the trick

go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]

do we have a philosophy on how we pin dev tools in this project ? for e.g. in some projects these tools are prefetched and saved in a local tools/bin dir to ensure tooling consistency (and use dependabot to keep bumping them ) for all,

@arkodg arkodg requested a review from robscott April 10, 2024 16:18
@robscott
Copy link
Member

Oh good catch, thanks!

do we have a philosophy on how we pin dev tools in this project ? for e.g. in some projects these tools are prefetched and saved in a local tools/bin dir to ensure tooling consistency (and use dependabot to keep bumping them ) for all,

We do have this for roughly that purpose, we should probably add those dependencies to pkg/tools to ensure we're all on the same version (cc @gnossen in case I'm missing something):

import (
_ "github.com/ahmetb/gen-crd-api-reference-docs"
_ "k8s.io/code-generator/cmd/client-gen"
_ "k8s.io/code-generator/cmd/deepcopy-gen"
_ "k8s.io/code-generator/cmd/informer-gen"
_ "k8s.io/code-generator/cmd/lister-gen"
_ "k8s.io/code-generator/cmd/register-gen"
_ "sigs.k8s.io/controller-runtime/pkg/scheme"
_ "sigs.k8s.io/controller-tools/cmd/controller-gen"
)

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @arkodg!

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: arkodg, robscott

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2024
Copy link
Member

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

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

After existing comments are resolved, this generally LGTM to me.

/lgtm

But hold just so it doesn't immediately merge.

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 10, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 10, 2024
@robscott
Copy link
Member

@arkodg looks like another PR beat this one in, will LGTM once you rebase.

/hold cancel

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Apr 10, 2024
Takes kubernetes-sigs#2759
forward and implements the go structs described in GEP-91
https://gateway-api.sigs.k8s.io/geps/gep-91/

Signed-off-by: Arko Dasgupta <[email protected]>
arkodg added 3 commits April 10, 2024 22:04
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 11, 2024
@arkodg arkodg requested review from robscott and shaneutt April 11, 2024 05:17
@robscott
Copy link
Member

Thanks @arkodg!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 11, 2024
@k8s-ci-robot k8s-ci-robot merged commit 400e36d into kubernetes-sigs:main Apr 11, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. kind/gep PRs related to Gateway Enhancement Proposal(GEP) lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants