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

Windows-specific .kube/config file can't be deserialized (autoConfigured Client can't be instantiated) #4803

Closed
manusa opened this issue Jan 28, 2023 · 0 comments · Fixed by #4948
Assignees
Labels
Milestone

Comments

@manusa
Copy link
Member

manusa commented Jan 28, 2023

Describe the bug

from quarkusio/quarkus#30525

When running the client from Windows, the following stacktrace is thrown:

org.yaml.snakeyaml.parser.ParserException: expected '<document start>', but found '<scalar>'
 in 'reader', line 1, column 14:
    'C:\Program' is not recognized as an internal ...
                 ^

    at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce (ParserImpl.java:274)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent (ParserImpl.java:185)
    at org.yaml.snakeyaml.parser.ParserImpl.checkEvent (ParserImpl.java:175)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode (Composer.java:163)
    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData (BaseConstructor.java:184)
    at org.yaml.snakeyaml.Yaml.loadFromReader (Yaml.java:477)
    at org.yaml.snakeyaml.Yaml.load (Yaml.java:418)
    at io.fabric8.kubernetes.client.utils.Serialization.unmarshal (Serialization.java:237)
    at io.fabric8.kubernetes.client.utils.Serialization.unmarshal (Serialization.java:351)
    at io.fabric8.kubernetes.client.utils.Serialization.unmarshal (Serialization.java:287)
    at io.fabric8.kubernetes.client.utils.Serialization.unmarshal (Serialization.java:272)
    at io.fabric8.kubernetes.client.Config.getExecCredentialFromExecConfig (Config.java:746)
    at io.fabric8.kubernetes.client.Config.loadFromKubeconfig (Config.java:702)
    at io.fabric8.kubernetes.client.Config.tryKubeConfig (Config.java:616)
    at io.fabric8.kubernetes.client.Config.autoConfigure (Config.java:286)
    at io.fabric8.kubernetes.client.Config.autoConfigure (Config.java:282)
    at io.quarkus.kubernetes.client.runtime.KubernetesClientUtils.createConfig (KubernetesClientUtils.java:18)
    at io.quarkus.kubernetes.client.runtime.KubernetesClientUtils.createClient (KubernetesClientUtils.java:52)
    at io.quarkus.kubernetes.client.deployment.KubernetesClientBuildStep.process (KubernetesClientBuildStep.java:16)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    at io.quarkus.deployment.ExtensionLoader$3.execute (ExtensionLoader.java:909)
    at io.quarkus.builder.BuildContext.run (BuildContext.java:281)
    at org.jboss.threads.ContextHandler$1.runWith (ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run (EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1478)
    at java.lang.Thread.run (Thread.java:1589)
    at org.jboss.threads.JBossThread.run (JBossThread.java:501)

The culprit is a .kube/config file that contains a field with backslashes and apparently causes trouble. The following code snippet contains a redacted version of this configuration file:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: REDACTED
  name: REDACTED
contexts:
- context:
    cluster: REDACTED
    user: REDACTED
  name: REDACTED
current-context: REDACTED
kind: Config
preferences: {}
users:
- name: REDACTED
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - kubernetes
      - cluster
      - kubeconfig
      - exec-credential
      - --version=v1beta1
      - --context=k8s
      - 95523dba-0a36-46c3-bcab-87de681e0097
      command: "C:\Program Files\\doctl\\doctl.exe"
      env: null
      provideClusterInfo: false

Un order to fix, we should add a reproducer to one of the Serialization test suites and then fix whatever is causing the bug.

Fabric8 Kubernetes Client version

SNAPSHOT

Steps to reproduce

  1. Add an entry like the one provided to your .kube/config file
  2. Run the client

Expected behavior

The client should instantiate correctly and you should be able to perform operations with it.

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3@latest

Environment

Windows

Fabric8 Kubernetes Client Logs

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants