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

hubble: switch to google.golang.org/protobuf #14635

Merged
merged 4 commits into from
Jan 19, 2021

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Jan 18, 2021

Use the google.golang.org/protobuf/* packages instead of their deprecated counterparts in github.com/golang/protobuf. Note that api/v1/hubble still uses the deprecated packages due to the fact that is uses an older version of protoc-gen-go. An attempt to update it is in progress in #13405. Still, we can already use the types from the new packages and assign them to the API fields because the deprecated package type aliases them to the new package's type, e.g.

See individual commit messages for more details.

As previously suggested in #14168 (comment). Following cilium/hubble#452 which did the same for the Hubble CLI.

Update v1.Event.Timestamp and various other code to use
google.golang.org/protobuf/types/known/timestamppb instead of of the
deprecated github.com/golang/protobuf/ptypes/timestamp package.

This works because github.com/golang/protobuf/ptypes/timestamp.Timestamp
is type aliased to
google.golang.org/protobuf/types/known/timestamppb.Timestamp, so they
can be used interchangeably.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Update Hubble code to use
google.golang.org/protobuf/types/known/wrapperspb instead of of the
deprecated github.com/golang/protobuf/ptypes/wrappers package.

This works because the github.com/golang/protobuf/ptypes/wrappers types are
type aliased to the respective types
google.golang.org/protobuf/types/known/wrapperspb, so they can be used
interchangeably.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
…onversions

Now that google.golang.org/protobuf/types/known/timestamppb.Timestamp is
used directly (see previous commits), use its methods to check timestamp
validity and convert it to time.Time.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Use google.golang.org/protobuf/encoding/protojson instead of the
deprecated github.com/golang/protobuf/jsonpb to unmarshal JSON to
protobuf.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
@tklauser tklauser added release-note/misc This PR makes changes that have no direct user impact. sig/hubble Impacts hubble server or relay labels Jan 18, 2021
@tklauser tklauser requested a review from a team as a code owner January 18, 2021 14:32
@tklauser tklauser requested review from a team and michi-covalent January 18, 2021 14:32
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.10.0 Jan 18, 2021
@tklauser tklauser requested a review from gandro January 18, 2021 14:33
@tklauser tklauser changed the title hubble: switch to google.golang.org/protobuf packages hubble: switch to google.golang.org/protobuf Jan 18, 2021
@tklauser
Copy link
Member Author

test-me-please

@tklauser
Copy link
Member Author

tklauser commented Jan 18, 2021

@tklauser
Copy link
Member Author

tklauser commented Jan 18, 2021

@tklauser
Copy link
Member Author

tklauser commented Jan 18, 2021

retest-net-next

looks like #12511 (https://jenkins.cilium.io/job/Cilium-PR-K8s-1.13-net-next/488/)

@rolinh rolinh merged commit 8674b1c into master Jan 19, 2021
@rolinh rolinh deleted the pr/tklauser/hubble-protobuf-apiv2 branch January 19, 2021 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact. sig/hubble Impacts hubble server or relay
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants