e2e-framework icon indicating copy to clipboard operation
e2e-framework copied to clipboard

Importing "sigs.k8s.io/e2e-framework/klient/conf" causes: ` k8s.io/api/flowcontrol/v1alpha1: module k8s.io/api@latest found (v0.29.3), but does not contain package k8s.io/api/flowcontrol/v1alpha1`

Open pmalek opened this issue 10 months ago • 5 comments

Problem statement

Trying to import sigs.k8s.io/e2e-framework/klient/conf fails with the following message:

go mod tidy
go: finding module for package k8s.io/api/flowcontrol/v1alpha1
go: e2e-framework-bug-352 tested by
        e2e-framework-bug-352.test imports
        sigs.k8s.io/e2e-framework/klient/conf imports
        k8s.io/client-go/rest tested by
        k8s.io/client-go/rest.test imports
        k8s.io/client-go/kubernetes/scheme imports
        k8s.io/api/flowcontrol/v1alpha1: module k8s.io/api@latest found (v0.29.3), but does not contain package k8s.io/api/flowcontrol/v1alpha1

This seems to be caused by https://pkg.go.dev/k8s.io/[email protected]/flowcontrol now having v1alpha1 package anymore.

Not sure why there's a problem though since https://github.com/kubernetes/client-go/tree/v0.29.3/rest doesn't seem to import flowcontrol v1alpha1 🤔

How to reproduce:

package main

import (
	"testing"

	_ "sigs.k8s.io/e2e-framework/klient/conf"
)

func TestX(m *testing.T) {
}

go.mod

module e2e-framework-bug-352

go 1.22.2

require (
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/go-logr/logr v1.3.0 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/golang/protobuf v1.5.4 // indirect
	github.com/google/gofuzz v1.2.0 // indirect
	github.com/imdario/mergo v0.3.15 // indirect
	github.com/json-iterator/go v1.1.12 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.2 // indirect
	github.com/spf13/pflag v1.0.5 // indirect
	golang.org/x/net v0.19.0 // indirect
	golang.org/x/oauth2 v0.7.0 // indirect
	golang.org/x/sys v0.15.0 // indirect
	golang.org/x/term v0.15.0 // indirect
	golang.org/x/text v0.14.0 // indirect
	golang.org/x/time v0.3.0 // indirect
	google.golang.org/appengine v1.6.7 // indirect
	google.golang.org/protobuf v1.33.0 // indirect
	gopkg.in/inf.v0 v0.9.1 // indirect
	gopkg.in/yaml.v2 v2.4.0 // indirect
	k8s.io/api v0.29.3 // indirect
	k8s.io/apimachinery v0.29.3 // indirect
	k8s.io/client-go v0.27.4 // indirect
	k8s.io/klog/v2 v2.110.1 // indirect
	k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
	sigs.k8s.io/e2e-framework v0.3.0 // indirect
	sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
	sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
	sigs.k8s.io/yaml v1.3.0 // indirect
)

Workaround

replace k8s.io/api => k8s.io/api v0.28.8

pmalek avatar Apr 16 '24 10:04 pmalek

/kind bug

pmalek avatar Apr 16 '24 10:04 pmalek

@pmalek

module stuff

go 1.21.6

require sigs.k8s.io/e2e-framework v0.3.0

require (
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/go-logr/logr v1.2.4 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/golang/protobuf v1.5.3 // indirect
	github.com/google/gofuzz v1.2.0 // indirect
	github.com/imdario/mergo v0.3.15 // indirect
	github.com/json-iterator/go v1.1.12 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.2 // indirect
	github.com/spf13/pflag v1.0.5 // indirect
	golang.org/x/net v0.10.0 // indirect
	golang.org/x/oauth2 v0.7.0 // indirect
	golang.org/x/sys v0.8.0 // indirect
	golang.org/x/term v0.8.0 // indirect
	golang.org/x/text v0.9.0 // indirect
	golang.org/x/time v0.3.0 // indirect
	google.golang.org/appengine v1.6.7 // indirect
	google.golang.org/protobuf v1.30.0 // indirect
	gopkg.in/inf.v0 v0.9.1 // indirect
	gopkg.in/yaml.v2 v2.4.0 // indirect
	k8s.io/apimachinery v0.27.4 // indirect
	k8s.io/client-go v0.27.4 // indirect
	k8s.io/klog/v2 v2.100.1 // indirect
	k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
	sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
	sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
	sigs.k8s.io/yaml v1.3.0 // indirect
)
package main

import (
	"os"
	"testing"

	_ "sigs.k8s.io/e2e-framework/klient/conf"
)

func TestMain(m *testing.M) {
	os.Exit(m.Run())
}

❯ go test .
ok  	stuff	0.295s [no tests to run]

❯ go mod why k8s.io/api/flowcontrol/v1alpha1
go: downloading github.com/rogpeppe/go-internal v1.11.0
# k8s.io/api/flowcontrol/v1alpha1
stuff
stuff.test
sigs.k8s.io/e2e-framework/klient/conf
k8s.io/client-go/rest
k8s.io/client-go/rest.test
k8s.io/client-go/kubernetes/scheme
k8s.io/api/flowcontrol/v1alpha1

Seem to be working fine for me though. Did not have to do a go mod replace

harshanarayana avatar Apr 21 '24 15:04 harshanarayana

in the latest k8s..io/api which is now v0.30.0, the flowcontrol/v1alpha api is no longer present as of this commit

this resulted in the same issue for me k8s.io/api/flowcontrol/v1alpha1: module k8s.io/api@latest found (v0.30.0), but does not contain package k8s.io/api/flowcontrol/v1alpha1

however, i can confirm that adding require sigs.k8s.io/e2e-framework v0.3.0 to my go.mod successfully executes go mod tidy

davidgamero avatar Apr 22 '24 22:04 davidgamero

Changes required to enable v0.30.0 of k/* packages is still under way. xref: https://github.com/kubernetes-sigs/e2e-framework/pull/401

harshanarayana avatar Apr 23 '24 19:04 harshanarayana

Can this one be closed then @davidgamero @harshanarayana ?

vladimirvivien avatar Apr 30 '24 11:04 vladimirvivien

I believe so. @vladimirvivien

harshanarayana avatar May 06 '24 15:05 harshanarayana

That seems to be fixed now (perhaps via 0.4.0 release?)

go mod tidy
go: finding module for package sigs.k8s.io/e2e-framework/klient/conf
go: found sigs.k8s.io/e2e-framework/klient/conf in sigs.k8s.io/e2e-framework v0.4.0
go: downloading github.com/imdario/mergo v0.3.15
go: downloading google.golang.org/appengine v1.6.7
go: downloading gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405

pmalek avatar May 31 '24 16:05 pmalek