turkenh / KubeContext

Menu Bar App for Managing Kubernetes Contexts on Mac
Apache License 2.0
403 stars 19 forks source link

Bug after using minikube to set context #12

Closed daxmc99 closed 2 years ago

daxmc99 commented 3 years ago

I get this alert after using minikube to set the context

Could not parse config file 
typeMismatch(Yams.Node.Mapping, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "clusters", intValue: nil), _YAMLCodingKey(stringValue: "Index 9", intValue: 9), CodingKeys(stringValue: "cluster", intValue: nil), CodingKeys(stringValue: "extensions", intValue: nil)], debugDescription: "Expected to decode Mapping but found Node instead.", underlyingError: nil))
turkenh commented 3 years ago

Kubeconfig (with redacted creds/endpoints) would be very helpful.

daxmc99 commented 3 years ago

Heavily redacted kubeconfig. Most of the fields that appear duplicated are unique.

Full kubeconfig apiVersion: v1 clusters: - cluster: certificate-authority-data: server: https://127.0.0.1 name: docker-desktop - cluster: certificate-authority-data: server: https://127.0.0.1 name: gke_cluster_REDACTED - cluster: certificate-authority-data: server: https://127.0.0.1 name: gke_cluster_REDACTED - cluster: certificate-authority-data: server: https://127.0.0.1 name: gke_cluster_REDACTED - cluster: certificate-authority-data: server: https://127.0.0.1 name: gke_cluster_REDACTED - cluster: certificate-authority-data: server: https://127.0.0.1 name: gke_cluster_REDACTED - cluster: certificate-authority-data: server: https://127.0.0.1 name: gke_cluster_REDACTED - cluster: certificate-authority-data: server: https://127.0.0.1 name: gke_cluster_REDACTED - cluster: certificate-authority-data: server: https://127.0.0.1 name: k3d-k3s-default - cluster: certificate-authority: /Users/dax/.minikube/ca.crt extensions: - extension: last-update: Fri, 28 May 2021 14:38:35 MST provider: minikube.sigs.k8s.io version: v1.17.1 name: cluster_info server: https://127.0.0.1 name: minikube contexts: - context: cluster: gke_cluster_REDACTED namespace: buildkite user: gke_cluster_REDACTED name: buildkite - context: cluster: gke_cluster_REDACTED namespace: buildkite user: gke_cluster_REDACTED name: ci - context: cluster: gke_cluster_REDACTED namespace: prod user: gke_cluster_REDACTED name: cloud - context: cluster: gke_cluster_REDACTED namespace: default user: gke_cluster_REDACTED name: dax-autopilot - context: cluster: gke_cluster_REDACTED namespace: test user: gke_cluster_REDACTED name: dax-demo - context: cluster: gke_cluster_REDACTED namespace: pl user: gke_cluster_REDACTED name: demo - context: cluster: docker-desktop user: docker-desktop name: docker-desktop - context: cluster: gke_cluster_REDACTED namespace: dogfood-k8s user: gke_cluster_REDACTED name: dogfood - context: cluster: gke_cluster_REDACTED namespace: prod user: gke_cluster_REDACTED name: dot-com - context: cluster: gke_cluster_REDACTED namespace: dax-test user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: gke_cluster_REDACTED user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: gke_cluster_REDACTED user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: gke_cluster_REDACTED user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: gke_cluster_REDACTED user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: gke_cluster_REDACTED user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: gke_cluster_REDACTED namespace: prod user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: gke_cluster_REDACTED user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: gke_cluster_REDACTED user: gke_cluster_REDACTED name: gke_cluster_REDACTED - context: cluster: k3d-k3s-default user: admin@k3d-k3s-default name: k3d-k3s-default - context: cluster: minikube extensions: - extension: last-update: Fri, 28 May 2021 14:38:35 MST provider: minikube.sigs.k8s.io version: v1.17.1 name: context_info namespace: sg-distro user: minikube name: minikube current-context: minikube kind: Config preferences: {} users: - name: admin@k3d-k3s-default user: password: 69049deab2230c22b8a5882d96dc881c username: admin - name: docker-desktop user: client-certificate-data: client-key-data: - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-04-29T21:23:11Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-04-29T21:23:11Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2020-12-16T00:03:15Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-03-26T23:04:03Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-01-16T01:23:04Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-03-26T23:04:03Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-03-27T03:44:56Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-03-26T23:04:03Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-05-07T20:59:31Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2020-07-14T17:51:52Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2020-11-07T02:59:09Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2020-11-07T02:59:09Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2020-07-02 03:06:49" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-05-20T22:59:35Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2020-11-12T04:57:16Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2021-05-28T22:35:34Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2020-07-18T03:04:21Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: gke_cluster_REDACTED user: auth-provider: config: access-token: cmd-args: config config-helper --format=json cmd-path: /Users/dax/google-cloud-sdk/bin/gcloud expiry: "2020-11-12T04:57:16Z" expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp - name: minikube user: client-certificate: /Users/dax/.minikube/profiles/minikube/client.crt client-key: /Users/dax/.minikube/profiles/minikube/client.key

Happy to help with this, not very familiar with Swift though 😞

andyast commented 3 years ago

getting exactly the same error

exocode commented 2 years ago

Me too: (tried the AppStore and Release version

Could not parse selected kubeconfig file
typeMismatch(Yams.Node.Mapping, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "clusters", intValue: nil), _YAMLCodingKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "cluster", intValue: nil), CodingKeys(stringValue: "extensions", intValue: nil)], debugDescription: "Expected to decode Mapping but found Node instead.", underlyingError: nil))

You can use this YAML for testing:

apiVersion: v1
clusters:
  - cluster:
      certificate-authority: /Users/jan/.minikube/ca.crt
      extensions:
        - extension:
            last-update: Thu, 21 Oct 2021 00:06:27 CEST
            provider: minikube.sigs.k8s.io
            version: v1.23.2
          name: cluster_info
      server: https://127.0.0.1:56524
    name: minikube
  - cluster:
      certificate-authority-data: k234jh5k3j4hkl2j34w34tlagmöo43öict9qwp4t9w0mpz8w4p9z8w3px409pw8mznp9tw83ztv8nqc4xpu,84tnz34tü3qnm3öa934ntpc8bz38
      server: https://127.0.0.1:6443
    name: rancher-desktop
contexts:
  - context:
      cluster: minikube
      extensions:
        - extension:
            last-update: Thu, 21 Oct 2021 00:06:27 CEST
            provider: minikube.sigs.k8s.io
            version: v1.23.2
          name: context_info
      namespace: default
      user: minikube
    name: minikube
  - context:
      cluster: rancher-desktop
      user: rancher-desktop
    name: rancher-desktop
current-context: rancher-desktop
kind: Config
preferences: {}
users:
  - name: minikube
    user:
      client-certificate: /Users/jan/.minikube/profiles/minikube/client.crt
      client-key: /Users/jan/.minikube/profiles/minikube/client.key
  - name: rancher-desktop
    user:
      client-certificate-data: kj3hkjhkjh3l4kj5h3lk4jh5k45jölkjsjfdkjsöseglk54j
      client-key-data: 3kj45h6lkj45hl36kj4h5l6k3jh45lkjznrlksgjöw3oirjöfger=
turkenh commented 2 years ago

Closed with https://github.com/turkenh/KubeContext/pull/13