Git Product home page Git Product logo

Comments (6)

ashleyschuett avatar ashleyschuett commented on July 4, 2024 1

Thank you for looking into this and fixing it

from kubeconfig-cleanup.

ashleyschuett avatar ashleyschuett commented on July 4, 2024

Is your kubeconfig file located at $HOME/.kube/config?

from kubeconfig-cleanup.

embano1 avatar embano1 commented on July 4, 2024

Yes, it's there.

Reading the stack trace the issue seems to be caused here:

func (m *Manager) Validate(context *clientcmdapi.Context) (bool, string) {
[...]
_, err = client.CoreV1().ConfigMaps(metav1.NamespacePublic).Get(bootstrapapi.ConfigMapClusterInfo, metav1.GetOptions{})
https://github.com/ashleyschuett/kubeconfig-cleanup/blob/master/pkg/config/config.go#L164

calls:

// CoreV1 retrieves the CoreV1Client
func (c *Clientset) CoreV1() corev1.CoreV1Interface {
	return c.coreV1
}
https://github.com/kubernetes/client-go/blob/v7.0.0/kubernetes/clientset.go#L273

Could that be caused by using incompatible client-go and K8s versions? Just speculating...

from kubeconfig-cleanup.

embano1 avatar embano1 commented on July 4, 2024

Full stack trace attached:

interesting:

github.com/ashleyschuett/kubeconfig-cleanup/vendor/k8s.io/client-go/tools/clientcmd.(*DirectClientConfig).ClientConfig(0xc42031c0c0, 0x0, 0x0, 0x0)
        /Users/ashley/go/src/github.com/ashleyschuett/kubeconfig-cleanup/vendor/k8s.io/client-go/tools/clientcmd/client_config.go:143 +0x273

From my understand that call for function signature func (config *DirectClientConfig) ClientConfig() (*restclient.Config, error) does not return a valid memory alloc i.e. nil.

stacktrace.txt

from kubeconfig-cleanup.

embano1 avatar embano1 commented on July 4, 2024

Further investigation:

The error from kubeconfigutil.ToClientSet(configFromClusterInfo) was not checked.
I added the following line:

	configFromClusterInfo.AuthInfos[context.AuthInfo] = m.getContextsUser(context)
	client, err := kubeconfigutil.ToClientSet(configFromClusterInfo)
	if err != nil {
		return false, fmt.Sprintf("error converting to clientset: %v", err)
	}

This solves the nil pointer exception and throws the following error:

Testing context's 'mgasch01-prod-context' cluster...
error converting to clientset: failed to create API client: No Auth Provider found for name "oidc"
Remove 'mgasch01-prod-context' from context (Y/n)? ^C

Btw: I had issues building from remotes/origin/HEAD -> origin/master with Glide. Go complained about incompatible types in the Validate() function. Using dep (which build dependency constraints from Glide, really neat) it worked.

from kubeconfig-cleanup.

embano1 avatar embano1 commented on July 4, 2024

Welcome.

Since I did not push the binary, it's probably the best to create a new binary release containing this fix.
I usually use Goreleaser as a way to automate releases.

from kubeconfig-cleanup.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.