You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem with the injection code logic where if a type ReferencePolicyList struct contains an item such as the first one below the generated code will work, but if the included item is of a different type, then the code generated is of one type but expects the other.
Items []ReferencePolicy - works as an element of type ReferencePolicyList struct
Items []ReferenceGrant - does not work as an element of type ReferencePolicyList struct
type [ReferencePolicyList](https://github.com/kubernetes-sigs/gateway-api/blob/v0.4.0/apis/v1alpha2/referencepolicy_types.go#L54) [¶](https://pkg.go.dev/sigs.k8s.io/gateway-api@v0.4.0/apis/v1alpha2?utm_source=gopls#ReferencePolicyList)
type ReferencePolicyList struct {
[metav1](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1).[TypeMeta](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#TypeMeta) `json:",inline"`
[metav1](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1).[ListMeta](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#ListMeta) `json:"metadata,omitempty"`
Items [][ReferencePolicy](https://pkg.go.dev/sigs.k8s.io/gateway-api@v0.4.0/apis/v1alpha2?utm_source=gopls#ReferencePolicy) `json:"items"`
}
This does not work:
type [ReferencePolicyList](https://github.com/kubernetes-sigs/gateway-api/blob/v0.5.0-rc1/apis/v1alpha2/referencepolicy_types.go#L58) [¶](https://pkg.go.dev/sigs.k8s.io/gateway-api@v0.5.0-rc1/apis/v1alpha2?utm_source=gopls#ReferencePolicyList)
type ReferencePolicyList struct {
[metav1](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1).[TypeMeta](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#TypeMeta) `json:",inline"`
[metav1](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1).[ListMeta](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#ListMeta) `json:"metadata,omitempty"`
Items [][ReferenceGrant](https://pkg.go.dev/sigs.k8s.io/gateway-api@v0.5.0-rc1/apis/v1alpha2?utm_source=gopls#ReferenceGrant) `json:"items"`
}
# knative.dev/net-gateway-api/pkg/client/gatewayapi/injection/informers/apis/v1alpha2/referencepolicy
pkg/client/gatewayapi/injection/informers/apis/v1alpha2/referencepolicy/referencepolicy.go:107:15: cannot use &lo.Items[idx] (type *"sigs.k8s.io/gateway-api/apis/v1alpha2".ReferenceGrant) as type *"sigs.k8s.io/gateway-api/apis/v1alpha2".ReferencePolicy in append
# knative.dev/net-gateway-api/pkg/client/gatewayapi/injection/informers/apis/v1alpha2/referencepolicy/filtered
pkg/client/gatewayapi/injection/informers/apis/v1alpha2/referencepolicy/filtered/referencepolicy.go:126:15: cannot use &lo.Items[idx] (type *"sigs.k8s.io/gateway-api/apis/v1alpha2".ReferenceGrant) as type *"sigs.k8s.io/gateway-api/apis/v1alpha2".ReferencePolicy in append
There is a problem with the injection code logic where if a
type ReferencePolicyList struct
contains an item such as the first one below the generated code will work, but if the included item is of a different type, then the code generated is of one type but expects the other.Items []ReferencePolicy
- works as an element oftype ReferencePolicyList struct
Items []ReferenceGrant
- does not work as an element oftype ReferencePolicyList struct
We got to see this happening in this PR:
⬆️ Bump Gateway API version to v0.5.0-rc1 by carlisia · Pull Request #315 · knative-sandbox/net-gateway-api
We "fixed" it by deleting this piece of the generated code after the script was run, since it wasn't actually being used.
/area networking
/kind bug
This works:
pkg/informer.go at 177751338ddc41979885ecf39679f5a900c00111 · knative/pkg
This does not work:
/assign @dprotaso
Expected Behavior
Actual Behavior
Steps to Reproduce the Problem
Additional Info
The text was updated successfully, but these errors were encountered: