-
Notifications
You must be signed in to change notification settings - Fork 254
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
Import of gnostic-models and gnostic generated code leads to panic #397
Comments
For example, k8s.io/kube-openapi recently updated to switch to gnostic-models in kubernetes/kube-openapi#402. The latest release of https://github.com/kubernetes/apimachinery/releases/tag/v0.27.2 and https://github.com/kubernetes/apiserver/releases/tag/v0.27.2 are still using gnostic (although unreleased versions look like they're switching to use gnostic-models). |
This is a known issue. The latest releases of apimachinery v0.27.2 uses a corresponding version of kube-openapi that also uses gnostic instead of gnostic-models: https://github.com/kubernetes/apimachinery/blob/v0.27.2/go.mod#L26. Please stick to the pinned dependency versions to prevent drift in the modules. |
Ok - we hit this with an upgrade to kube-openapi (which has no tags so it picked up the latest commit). Hopefully over the next few releases of libraries things will stabilize to only depend on gnostic-models instead of a combination of gnostic-models and gnostic. |
apimachinery/api/client-go v0.27.3 dro inn gnostic-models, men vi avhenger av gnostic i client-go, så må vente til de spiller på lag. ``` panic: proto: file "extensions/extension.proto" is already registered previously from: "github.com/google/gnostic-models/extensions" currently from: "github.com/google/gnostic/extensions" See https://protobuf.dev/reference/go/faq#namespace-conflict ``` google/gnostic#397
Related: kubernetes/kube-openapi#404 |
Would you be open to a PR which updates the generated proto code to come from gnostic-models and provides type aliases for compatibility with existing code, i.e. replace package discovery_v1
import (
models "github.com/google/gnostic-models/discovery"
)
type Annotations = models.Annotations
type Any = models.Any
type Auth = models.Auth
...
type Simple = models.Simple
type StringArray = models.StringArray
var File_discovery_discovery_proto = models.File_discovery_discovery_proto This should allow for a Go module to depend on code both from gnostic and gnostic-models without panicing. |
Sounds like a great idea, do you want to go ahead with the PR? cc @timburks |
Summary of the issue: These issues should be fully resolved once kubernetes 1.28 is released and a workaround is not needed to use an alpha client. In the meantime, #400 is a generalized way of solving this for projects that do not have any kubernetes dependencies. |
see google/gnostic#397 and the workaround in kubernetes/client-go#1269 (comment)
kube-openapi pinned before the migration to google/gnostic kubernetes/kube-openapi#285 google/gnostic#397
kube-openapi pinned before the migration to google/gnostic kubernetes/kube-openapi#285 google/gnostic#397
kube-openapi pinned before the migration to google/gnostic kubernetes/kube-openapi#285 google/gnostic#397
import of gnostic-models along with gnostic was causing a panic due to protobuf namespace conflicts. See google/gnostic#397 for more info
import of gnostic-models along with gnostic was causing a panic due to protobuf namespace conflicts. See google/gnostic#397 for more info
- bump gnostic-models because of google/gnostic#397 - bump controller-tools v0.15.0 (for controller-gen command) - regenerate manifest/generated code Signed-off-by: Vicente Cheng <[email protected]>
- bump gnostic-models because of google/gnostic#397 - bump controller-tools v0.15.0 (for controller-gen command) - bump longhorn v1.5.5 - regenerate manifest/generated code Signed-off-by: Vicente Cheng <[email protected]>
- bump gnostic-models because of google/gnostic#397 - bump controller-tools v0.15.0 (for controller-gen command) - bump longhorn v1.5.5 - regenerate manifest/generated code Signed-off-by: Vicente Cheng <[email protected]>
- bump gnostic-models because of google/gnostic#397 - bump controller-tools v0.15.0 (for controller-gen command) - bump longhorn v1.5.5 - regenerate manifest/generated code Signed-off-by: Vicente Cheng <[email protected]> (cherry picked from commit ec4d7da)
- bump gnostic-models because of google/gnostic#397 - bump controller-tools v0.15.0 (for controller-gen command) - bump longhorn v1.5.5 - regenerate manifest/generated code Signed-off-by: Vicente Cheng <[email protected]> (cherry picked from commit ec4d7da)
- bump gnostic-models because of google/gnostic#397 - bump controller-tools v0.15.0 (for controller-gen command) - bump longhorn v1.5.5 - regenerate manifest/generated code Signed-off-by: Vicente Cheng <[email protected]> (cherry picked from commit ec4d7da)
- bump gnostic-models because of google/gnostic#397 - bump controller-tools v0.15.0 (for controller-gen command) - bump longhorn v1.5.5 - regenerate manifest/generated code Signed-off-by: Vicente Cheng <[email protected]> (cherry picked from commit ec4d7da)
We've encountered an issue in recent versions of upstream libraries that mix dependencies - sometimes pulling in
gnostic
and other timesgnostic-models
. This leads to a panic at runtime, and it causes golangci-lint to fail with an internal error.Here's a small example program illustrating the panic:
This leads to a panic:
Generated code should ideally only live in a single place - is it possible to update gnostic to pull generated code from gnostic-models so that it only exists in one go module?
The text was updated successfully, but these errors were encountered: