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

chore: remove the dependency with k8s.io/kubernetes #5

Merged
merged 5 commits into from
Jul 27, 2022

Conversation

STRRL
Copy link
Contributor

@STRRL STRRL commented Jul 25, 2022

Signed-off-by: STRRL im@strrl.dev

What type of PR is this?

enhancements

What this PR does / why we need it:

  • remove the dependency with k8s.io/kubernetes
  • append one more replace statement in go.mod: github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.3.1

Which issue(s) this PR fixes:

#4

Special notes for your reviewer:

No other notes.

Signed-off-by: STRRL <im@strrl.dev>
@CLAassistant
Copy link

CLAassistant commented Jul 25, 2022

CLA assistant check
All committers have signed the CLA.

@divanodestiny
Copy link
Collaborator

@STRRL Thx~ It would be great if you can remove the replacement here, and run go mod tidy to refresh the file go.sum

k8s.io/kubernetes => k8s.io/kubernetes v1.14.8

Signed-off-by: STRRL <im@strrl.dev>
@STRRL STRRL force-pushed the prune-kubernetes-dependency branch from fff1682 to 9c6a02d Compare July 25, 2022 09:52
@STRRL
Copy link
Contributor Author

STRRL commented Jul 25, 2022

@STRRL Thx~ It would be great if you can remove the replacement here, and run go mod tidy to refresh the file go.sum

k8s.io/kubernetes => k8s.io/kubernetes v1.14.8

Updated! PTAL!

I also updated the pseudo version for k8s.io/kube-openapi as the version used in kubernetes 1.20.4

cmd/main.go Outdated Show resolved Hide resolved
Signed-off-by: STRRL <im@strrl.dev>
@STRRL
Copy link
Contributor Author

STRRL commented Jul 25, 2022

I found other issues when I remove the replace statements in go.mod:

make            
/home/strrl/playground/github/kubebrain
fatal: No names found, cannot describe anything.

build env 
version         prune-kubernetes-dependency
sha             bc573df
go_version      go1.18.3
go_os           linux
go_arch         amd64
storage         Badger

# github.com/kubewharf/kubebrain/pkg/backend/election
../pkg/backend/election/election.go:68:9: cannot use r.resourceLock (variable of type *resourceLock) as type resourcelock.Interface in return statement:
        *resourceLock does not implement resourcelock.Interface (wrong type for Create method)
                have Create(ler resourcelock.LeaderElectionRecord) error
                want Create(ctx context.Context, ler resourcelock.LeaderElectionRecord) error
make: *** [makefile:4: badger] Error 2

It relates to changes in the interface.

@STRRL
Copy link
Contributor Author

STRRL commented Jul 25, 2022

I found other issues when I remove the replace statements in go.mod:

make            
/home/strrl/playground/github/kubebrain
fatal: No names found, cannot describe anything.

build env 
version         prune-kubernetes-dependency
sha             bc573df
go_version      go1.18.3
go_os           linux
go_arch         amd64
storage         Badger

# github.com/kubewharf/kubebrain/pkg/backend/election
../pkg/backend/election/election.go:68:9: cannot use r.resourceLock (variable of type *resourceLock) as type resourcelock.Interface in return statement:
        *resourceLock does not implement resourcelock.Interface (wrong type for Create method)
                have Create(ler resourcelock.LeaderElectionRecord) error
                want Create(ctx context.Context, ler resourcelock.LeaderElectionRecord) error
make: *** [makefile:4: badger] Error 2

It relates to changes in the interface.

What do you think about it? @divanodestiny

  • Keep using replace k8s.io/* dependencies with version 1.14.x, then update dependencies and codes about interface changes in other PR?
  • Or make required changes in this PR?

@divanodestiny
Copy link
Collaborator

I found other issues when I remove the replace statements in go.mod:

make            
/home/strrl/playground/github/kubebrain
fatal: No names found, cannot describe anything.

build env 
version         prune-kubernetes-dependency
sha             bc573df
go_version      go1.18.3
go_os           linux
go_arch         amd64
storage         Badger

# github.com/kubewharf/kubebrain/pkg/backend/election
../pkg/backend/election/election.go:68:9: cannot use r.resourceLock (variable of type *resourceLock) as type resourcelock.Interface in return statement:
        *resourceLock does not implement resourcelock.Interface (wrong type for Create method)
                have Create(ler resourcelock.LeaderElectionRecord) error
                want Create(ctx context.Context, ler resourcelock.LeaderElectionRecord) error
make: *** [makefile:4: badger] Error 2

It relates to changes in the interface.

What do you think about it? @divanodestiny

  • Keep using replace k8s.io/* dependencies with version 1.14.x, then update dependencies and codes about interface changes in other PR?
  • Or make required changes in this PR?

Just keep k8s.io/* dependencies with version 1.14 now,and we will find the way to update them later. It seems that the resourcelock.Interface is changed after v1.18.0-beta.0

@STRRL
Copy link
Contributor Author

STRRL commented Jul 25, 2022

I found other issues when I remove the replace statements in go.mod:

make            
/home/strrl/playground/github/kubebrain
fatal: No names found, cannot describe anything.

build env 
version         prune-kubernetes-dependency
sha             bc573df
go_version      go1.18.3
go_os           linux
go_arch         amd64
storage         Badger

# github.com/kubewharf/kubebrain/pkg/backend/election
../pkg/backend/election/election.go:68:9: cannot use r.resourceLock (variable of type *resourceLock) as type resourcelock.Interface in return statement:
        *resourceLock does not implement resourcelock.Interface (wrong type for Create method)
                have Create(ler resourcelock.LeaderElectionRecord) error
                want Create(ctx context.Context, ler resourcelock.LeaderElectionRecord) error
make: *** [makefile:4: badger] Error 2

It relates to changes in the interface.

What do you think about it? @divanodestiny

  • Keep using replace k8s.io/* dependencies with version 1.14.x, then update dependencies and codes about interface changes in other PR?
  • Or make required changes in this PR?

Just keep k8s.io/* dependencies with version 1.14 now,and we will find the way to update them later. It seems that the resourcelock.Interface is changed after v1.18.0-beta.0

got that.

Signed-off-by: STRRL <im@strrl.dev>
@STRRL STRRL force-pushed the prune-kubernetes-dependency branch from 8328e59 to ebde5a9 Compare July 25, 2022 12:26
@STRRL
Copy link
Contributor Author

STRRL commented Jul 25, 2022

Updated! PTAL! @divanodestiny

PS: I am very pleased to help if you meet some issue when bump the version of kubernetes deps. We (Chaos Mesh Contributors) also make a script for upgrade replace statements in go.mod: https://github.com/chaos-mesh/chaos-mesh/blob/master/hack/update-kubernetes-library.sh

@STRRL
Copy link
Contributor Author

STRRL commented Jul 25, 2022

Another thing needs to be mentioned: when I tried to execute go mod tidy, this issue occurs on me:

$ go mod tidy
go: finding module for package github.com/googleapis/gnostic/OpenAPIv2
github.com/kubewharf/kubebrain/pkg/server/service/leader imports
        k8s.io/client-go/tools/leaderelection tested by
        k8s.io/client-go/tools/leaderelection.test imports
        k8s.io/client-go/kubernetes/fake imports
        k8s.io/client-go/discovery imports
        github.com/googleapis/gnostic/OpenAPIv2: module github.com/googleapis/gnostic@latest found (v0.6.9), but does not contain package github.com/googleapis/gnostic/OpenAPIv2

That's a historical issue with kubernetes client-go: kubernetes/client-go#741 (comment)

I am not sure why you did not face this issue. Maybe the (internal) go module proxy server that you used cached an old version for github.com/googleapis/gnostic@latest.

And that's the reason why I replace the github.com/googleapis/gnostic with version v0.3.1

@divanodestiny
Copy link
Collaborator

@STRRL Thx for your help~ It seems to work now. I will recheck this PR after merging #2, which sets the actions for UT and lint to run basic checks.

@divanodestiny
Copy link
Collaborator

@STRRL hi~ would you mind updating this PR to trigger the workflows, which were set recently.

@STRRL
Copy link
Contributor Author

STRRL commented Jul 26, 2022

@STRRL hi~ would you mind updating this PR to trigger the workflows, which were set recently.

OK! I would have a try later.

Copy link
Collaborator

@divanodestiny divanodestiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All checks have passed 🎉🎉🎉

@divanodestiny divanodestiny merged commit 24309bd into kubewharf:main Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants