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

Add gloo federation go types #106

Closed
amiramw opened this issue Jun 2, 2021 · 11 comments
Closed

Add gloo federation go types #106

amiramw opened this issue Jun 2, 2021 · 11 comments
Assignees
Labels

Comments

@amiramw
Copy link

amiramw commented Jun 2, 2021

There seems to be missing go types for gloo federation such as FederatedUpstream, FederatedVirtualService, etc.
They will make it easier operating gloo fed CRDs programmatically.

@chrisgaun chrisgaun added the enhancement New feature or request label Jun 3, 2021
@sam-heilbron
Copy link
Collaborator

Hi @amiramw , I believe the types you are referring to are defined here:

FederatedUpstream:

type FederatedUpstream struct {

FederatedVirtualService:

type FederatedVirtualService struct {

@amiramw
Copy link
Author

amiramw commented Jun 21, 2021

@sam-heilbron

Those types don't seem to implement k8s.io\apimachinery@v0.21.0\pkg\apis\meta\v1\Object so it is not possible to use them with k8s APIs. The gloo edge types are ok, like this one:

type Upstream struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec UpstreamSpec `json:"spec,omitempty"`
Status UpstreamStatus `json:"status,omitempty"`
}

Also fed.rpc package is missing the AddToScheme API. It exists here for example:

func AddToScheme(s *runtime.Scheme) error {

@amiramw
Copy link
Author

amiramw commented Jun 23, 2021

@sam-heilbron can you reopen this issue or should i create a new one?

@sam-heilbron
Copy link
Collaborator

My mistake @amiramw and sorry for the delay in getting back to you. I'll re-open and we can re-prioritize within the team.

@benbooth493
Copy link

I am experiencing the same problem trying to use FailoverScheme within an operator I am building.
Do we have an ETA for when this is likely to be resolved?

@jenshu
Copy link
Contributor

jenshu commented Sep 27, 2021

Note, the fed.rpc package referenced above is used internally only, we should remove that from solo-apis.
The ones we should be exporting are the ones under fed.gateway, fed.gloo, etc

@sam-heilbron
Copy link
Collaborator

Hi @benbooth493 and @amiramw , I believe this should be supported in a recent release of solo-apis: gloo-v1.9.0. Can you checkout that version and confirm with me that this is resolved? I will leave the issue as open until I hear confirmation.

@amiramw
Copy link
Author

amiramw commented Oct 12, 2021

Hi @sam-heilbron with latest version everything seems to compile.

However I get the following panic in my controller env test:

      Test Panicked
      an unexported field was encountered, nested like this: *v1.FederatedUpstream -> v1.FederatedUpstream -> types.FederatedUpstreamSpec -> int32
      /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:96

      Full Stack Trace
      k8s.io/apimachinery/third_party/forked/golang/reflect.makeUsefulPanic(0x1cda500, 0xc000887980, 0x16)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:96 +0x213
      panic(0x1a9cb80, 0xc00069d1d0)
        /usr/local/go/src/runtime/panic.go:971 +0x499
      k8s.io/apimachinery/third_party/forked/golang/reflect.makeUsefulPanic(0x1ba4c20, 0xc000887980, 0x199)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:96 +0x213
      panic(0x1a9cb80, 0xc00069d1b8)
        /usr/local/go/src/runtime/panic.go:971 +0x499
      k8s.io/apimachinery/third_party/forked/golang/reflect.makeUsefulPanic(0x1bc3780, 0xc000887a98, 0x199)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:96 +0x213
      panic(0x1a9cb80, 0xc00069d1a0)
        /usr/local/go/src/runtime/panic.go:971 +0x499
      k8s.io/apimachinery/third_party/forked/golang/reflect.makeUsefulPanic(0x19fbde0, 0xc000887aa0, 0x1a5)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:96 +0x213
      panic(0x1a9cb80, 0xc00069d188)
        /usr/local/go/src/runtime/panic.go:971 +0x499
      k8s.io/apimachinery/third_party/forked/golang/reflect.Equalities.deepValueEqual(0xc000373bc0, 0x19fbde0, 0xc000887aa0, 0x1a5, 0x19fbde0, 0xc00087d1a0, 0x1a5, 0xc000566088, 0x3, 0xc000586400)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:219 +0x189f
      k8s.io/apimachinery/third_party/forked/golang/reflect.Equalities.deepValueEqual(0xc000373bc0, 0x1bc3780, 0xc000887a98, 0x199, 0x1bc3780, 0xc00087d198, 0x199, 0xc000566088, 0x2, 0xc000586600)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:186 +0xa2f
      k8s.io/apimachinery/third_party/forked/golang/reflect.Equalities.deepValueEqual(0xc000373bc0, 0x1ba4c20, 0xc000887980, 0x199, 0x1ba4c20, 0xc00087d080, 0x199, 0xc000566088, 0x1, 0x411800)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:186 +0xa2f
      k8s.io/apimachinery/third_party/forked/golang/reflect.Equalities.deepValueEqual(0xc000373bc0, 0x1cda500, 0xc000887980, 0x16, 0x1cda500, 0xc00087d080, 0x16, 0xc000566088, 0x0, 0x1bf6100)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:183 +0x154a
      k8s.io/apimachinery/third_party/forked/golang/reflect.Equalities.DeepEqual(0xc000373bc0, 0x1cda500, 0xc000887980, 0x1cda500, 0xc00087d080, 0x1fe9da8)
        /mnt/c/SAPDevelop/go/pkg/mod/k8s.io/apimachinery@v0.21.0/third_party/forked/golang/reflect/deep_equal.go:243 +0x2d5
      sigs.k8s.io/controller-runtime/pkg/controller/controllerutil.CreateOrUpdate(0x1fc7a10, 0xc0000520c0, 0x1fd9cc0, 0xc0002cef40, 0x1fe9da8, 0xc00087d080, 0xc0005662e8, 0x40, 0x48, 0x7f86696a25b8, ...)
        /mnt/c/SAPDevelop/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/controller/controllerutil/controllerutil.go:217 +0x3e5

The panic comes from:
https://github.com/kubernetes/kubernetes/blob/ea0764452222146c47ec826977f49d7001b0ea8c/third_party/forked/golang/reflect/deep_equal.go#L76-L78

Do you have any idea if there is something unexported on your side?

@sam-heilbron
Copy link
Collaborator

Hi @amiramw

This is actually due to changes around protobuf equality: golang/protobuf#1173 causing Reflect.DeepEqual to no longer work for later proto objects (solo-io/skv2#180).

This work was resolved in our skv2 implementation of DeepEqual.

Instead of relying on the controller-runtime CreateOrUpdate (https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/controller/controllerutil/controllerutil.go#L195), could you uses Solo's implementation from the skv2 library:

https://github.com/solo-io/skv2/blob/master/pkg/controllerutils/upsert.go#L25

@amiramw
Copy link
Author

amiramw commented Oct 14, 2021

thanks @sam-heilbron!
Your suggestion seems to work.

From my side this issue can be closed.

@sam-heilbron
Copy link
Collaborator

Thanks for the update @amiramw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants