Closed knight42 closed 5 months ago
+1
@dio @howardjohn
It is not possible to import istio.io/api
It is necessary to start with a vX.Y.Z and not X.Y.Z
go mod download istio.io/api
go: istio.io/api@v1.11.2: reading istio.io/api/go.mod at revision v1.11.2: unknown revision v1.11.2
Possible workaround:
Track the git sha and replace it, go will complain on the timestamp, just replace it with the good one. Leave the verions v0.0.0-
istio.io/api v0.0.0-20210917144548-f167acc88a31
Close the issue - Import must come from https://github.com/istio/client-go/ eg. https://github.com/istio/client-go/tree/v1.11.2/pkg/apis/networking/v1beta1
@migounette I'm trying to create a VirtualService object. The Spec
part requires importing istio.io/api/networking/v1beta1
as indicated in Istio source code here. Is there a way to only import istio/client-go
in this case?
import (
networkingv1beta1 "istio.io/api/networking/v1beta1"
istioNetworking "istio.io/client-go/pkg/apis/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
virtualService := &istioNetworking.VirtualService{
ObjectMeta: metav1.ObjectMeta{
Name: workbench.Name,
Namespace: workbench.Namespace,
},
Spec: networkingv1beta1.VirtualService{
Gateways: []string{"spotify-system/hendrix-compute"},
Hosts: []string{fmt.Sprintf("%s.hendrix-compute.spotify.net", workbench.Name)},
Http: []*networkingv1beta1.HTTPRoute{
...
Unfortunately no. I have tried a way to make it so you can just use one while still being backwards compatible but struggled to make it work.
On Sun, May 14, 2023 at 8:19 AM David Xia @.***> wrote:
@migounette https://github.com/migounette I'm trying to create a VirtualService object. The Spec part requires importing istio.io/api/networking/v1beta1 as indicated in Istio source code here https://github.com/istio/client-go/blob/v1.17.1/pkg/apis/networking/v1beta1/types.gen.go#L316. Is there a way to only import istio/client-go in this case?
import ( networkingv1beta1 "istio.io/api/networking/v1beta1" istioNetworking "istio.io/client-go/pkg/apis/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" )
virtualService := &istioNetworking.VirtualService{ ObjectMeta: metav1.ObjectMeta{ Name: workbench.Name, Namespace: workbench.Namespace, }, Spec: networkingv1beta1.VirtualService{ Gateways: []string{"spotify-system/hendrix-compute"}, Hosts: []string{fmt.Sprintf("%s.hendrix-compute.spotify.net", workbench.Name)}, Http: []*networkingv1beta1.HTTPRoute{ ...
— Reply to this email directly, view it on GitHub https://github.com/istio/api/issues/1565#issuecomment-1546923318, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEYGXNF4ATE5GEAXNP2MJ3XGDZYLANCNFSM4PMZNIUA . You are receiving this because you were mentioned.Message ID: @.***>
This is done now, see https://github.com/istio/api/tree/v1.22.0 etc
Thanks a lot!
Describe the feature request Go module requires version to be started with "v" https://golang.org/ref/mod#tmp_3, but currently all the release tags are missing prefixed "v". If uses run
go get istio.io/api@1.6.6
, Go will save something like the following in go.modrather than
, which makes it hard to identify which version is using afterwards.
Describe alternatives you've considered
Affected product area (please put an X in all that apply)
[ ] Configuration Infrastructure [ ] Docs [ ] Installation [ ] Networking [ ] Performance and Scalability [ ] Policies and Telemetry [ ] Security [x] Test and Release [ ] User Experience
Additional context