pingcap / pingcap/tidb-operator
Upgrade dependency versions
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.3k
- Forks
- 540
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 18
Description
Bug Report
What version of Kubernetes are you using?
Client Version: v1.24.1
Kustomize Version: v4.5.4
Server Version: v1.24.17
What version of TiDB Operator are you using?
v1.4.1
What storage classes exist in the Kubernetes cluster and what are used for PD/TiKV pods?
NA
What's the status of the TiDB cluster pods?
NA
What did you do?
I am trying to develop a new operator using operator-sdk which needs to get and update tidb cluster resource. For that reason I am trying to add github.com/pingcap/tidb-operator/pkg/apis as dep in my project. However, it's failing my builds with below error
BLRETV-C02GL33D:maintenance-operator raj.suvariya$ go build -a -o manager cmd/main.go
# github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:449:11: cannot use spec.Schema{…} (value of type "github.com/go-openapi/spec".Schema) as "k8s.io/kube-openapi/pkg/validation/spec".Schema value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:457:21: cannot use ref("k8s.io/apimachinery/pkg/api/resource.Quantity") (value of type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as "github.com/go-openapi/spec".Ref value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:463:21: cannot use ref("k8s.io/apimachinery/pkg/api/resource.Quantity") (value of type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as "github.com/go-openapi/spec".Ref value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:469:21: cannot use ref("k8s.io/apimachinery/pkg/api/resource.Quantity") (value of type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as "github.com/go-openapi/spec".Ref value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:490:11: cannot use spec.Schema{…} (value of type "github.com/go-openapi/spec".Schema) as "k8s.io/kube-openapi/pkg/validation/spec".Schema value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:532:11: cannot use spec.Schema{…} (value of type "github.com/go-openapi/spec".Schema) as "k8s.io/kube-openapi/pkg/validation/spec".Schema value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:580:11: cannot use spec.Schema{…} (value of type "github.com/go-openapi/spec".Schema) as "k8s.io/kube-openapi/pkg/validation/spec".Schema value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:699:11: cannot use spec.Schema{…} (value of type "github.com/go-openapi/spec".Schema) as "k8s.io/kube-openapi/pkg/validation/spec".Schema value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:720:13: cannot use ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BackupSpec") (value of type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as "github.com/go-openapi/spec".Ref value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:759:16: cannot use ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.Backup") (value of type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as "github.com/go-openapi/spec".Ref value in struct literal
../../../../pkg/mod/github.com/pingcap/tidb-operator/pkg/apis@v1.4.1/pingcap/v1alpha1/openapi_generated.go:759:16: too many errors
This is happening because the controller-runtime needs higher version of k8s.io/kube-openapi which also comes with package k8s.io/kube-openapi/spec and it's conflicting with tidb-operator's spec.Ref from github.com/go-openapi/spec.
What did you expect to see?
No error, tidb-operator using the latest version of dependencies.
What did you see instead?
Errors, due to older version of dependencies getting conflict errors.
Can you fix this by upgrading the dependencies to latest versions?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with go build -a -o manager cmd/main.go and inspect the dependency versions involved in pkg/apis/pingcap/v1alpha1/openapi_generated.go. Trace the conflicting spec.Schema and spec.Ref types, then verify that a consumer importing the TiDB Operator APIs builds successfully without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100