This repository was archived by the owner on May 3, 2023. It is now read-only.
Replace k8s dependency to resolve protobuf version mismatch error #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been attempting to use
go-cachein conjunction with a gin service instrumented with prometheus and have been running up against the following issue described in this issue:This is due to the
github.com/ericchiang/k8spackage used inredispool.go->inCluster()usingv1.2ofgithub.com/golang/protobuf. After versionv1.4, there's some changes that result in the above error, andv1.4is a requirement of github.com/prometheus/client_golang. The issue on github.com/ericchiang/k8s has been open for a couple months, so I do not think it is likely it will be addressed in a timely fashion.Comparing rest.InClusterConfig() to k8s.NewInClusterClient()/k8s.newCluster(), they both behave similarly and should be equivalent in determining cluster presence.
I've solved this by replacing the protobuf-based k8s client with a portion of the official k8s client that has near-equivalent functionality.
The downside of this is that
github.com/kubernetes/client-gohas more dependencies than thegithub.com/ericchiang/k8sclient.(Useful bookmark to hide vendor files:
javascript:document.querySelectorAll("*[data-path*='vendor']").forEach(el => el.parentElement.remove()); undefined;)