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

Cannot use the internalversion clientset #381

Open
ialidzhikov opened this issue Dec 31, 2019 · 2 comments
Open

Cannot use the internalversion clientset #381

ialidzhikov opened this issue Dec 31, 2019 · 2 comments
Labels
kind/api-change API change with impact on API users kind/bug Bug lifecycle/rotten Nobody worked on this for 12 months (final aging stage) needs/planning Needs (more) planning with other MCM maintainers priority/4 Priority (lower number equals higher priority) triage/wont-fix We will not fix this

Comments

@ialidzhikov
Copy link
Member

Steps to reproduce:

  1. Setup dummy main.go
package main

import (
	"fmt"

	machine "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	rest "k8s.io/client-go/rest"
)

func main() {
	config := rest.Config{
		Host: "(minikube ip):8443",
		TLSClientConfig: rest.TLSClientConfig{
			CAFile:   "/path/to/ca.crt",
			CertFile: "/path/to/client.crt",
			KeyFile:  "/path/to/client.key",
		},
	}
	client, err := machine.NewForConfig(&config)
	if err != nil {
		panic(err)
	}

	machineList, err := client.Machine().List(metav1.ListOptions{})
	if err != nil {
		panic(err)
	}

	fmt.Println(len(machineList.Items))
}
  1. Try to run it and ensure it fails
$ go mod vendor && go mod tidy
$ go run -mod=vendor main.go
# github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:85:19: machine.Machine undefined (type *machine.Machine has no field or method Machine)
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:97:19: machine.Machine undefined (type *machine.Machine has no field or method Machine)
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:112:19: machine.Machine undefined (type *machine.Machine has no field or method Machine)
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go:10:6: MachineInterface redeclared in this block
	previous declaration at vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:21:6
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go:47:20: cannot use newMachines(c, namespace) (type *machines) as type MachineInterface in return argument:
	*machines does not implement MachineInterface (missing AWSMachineClasses method)

Also golangci-lint reports for the same redeclaration of MachineInterface.

$ golangci-lint run --version
golangci-lint has version 1.18.0 built from 31afdf8 on 2019-09-10T09:34:48Z
$ golangci-lint run ./...
pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go:10:6: `MachineInterface` redeclared in this block (typecheck)
type MachineInterface interface {
     ^
pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:21:6: 	other declaration of MachineInterface (typecheck)
type MachineInterface interface {
     ^
[...]
@ialidzhikov
Copy link
Member Author

I think the issue is that the package name is machine and there is an internal type Machine which both result in type MachineInterface.

/kind bug

@prashanth26 prashanth26 added kind/bug Bug kind/api-change API change with impact on API users labels Jan 16, 2020
@ghost ghost added the lifecycle/stale Nobody worked on this for 6 months (will further age) label Mar 17, 2020
@ghost ghost added lifecycle/rotten Nobody worked on this for 12 months (final aging stage) and removed lifecycle/stale Nobody worked on this for 6 months (will further age) labels May 16, 2020
@prashanth26 prashanth26 removed the lifecycle/rotten Nobody worked on this for 12 months (final aging stage) label Aug 16, 2020
@gardener-robot gardener-robot added the lifecycle/stale Nobody worked on this for 6 months (will further age) label Oct 16, 2020
@gardener-robot gardener-robot added lifecycle/rotten Nobody worked on this for 12 months (final aging stage) and removed lifecycle/stale Nobody worked on this for 6 months (will further age) labels Dec 16, 2020
@prashanth26 prashanth26 added the priority/4 Priority (lower number equals higher priority) label Jul 21, 2021
@himanshu-kun himanshu-kun added the triage/wont-fix We will not fix this label Feb 14, 2023
@himanshu-kun
Copy link
Contributor

This will be taken care as part of controller runtime refactoring #724

@himanshu-kun himanshu-kun added the needs/planning Needs (more) planning with other MCM maintainers label Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change API change with impact on API users kind/bug Bug lifecycle/rotten Nobody worked on this for 12 months (final aging stage) needs/planning Needs (more) planning with other MCM maintainers priority/4 Priority (lower number equals higher priority) triage/wont-fix We will not fix this
Projects
None yet
Development

No branches or pull requests

4 participants