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

Kubernetes Extension Can't Build on Windows #30525

Closed
aelfric opened this issue Jan 21, 2023 · 10 comments
Closed

Kubernetes Extension Can't Build on Windows #30525

aelfric opened this issue Jan 21, 2023 · 10 comments
Labels
area/kubernetes env/windows Impacts Windows machines kind/bug Something isn't working

Comments

@aelfric
Copy link

aelfric commented Jan 21, 2023

Describe the bug

Trying to run mvn package on Windows with a project configured with the quarkus-kubernetes extension, and it fails seemingly due to a space in the "Program Files" directory name.

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)

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

Reproducer: https://github.com/aelfric/github-classroom-lti

On windows, run ./mvnw package

Output of uname -a or ver

Windows 11

Output of java -version

openjdk version "19.0.1" 2022-10-18 OpenJDK Runtime Environment Temurin-19.0.1+10 (build 19.0.1+10) OpenJDK 64-Bit Server VM Temurin-19.0.1+10 (build 19.0.1+10, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.15.3.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

Additional information

Happy to help debug / fix this if someone could point me in the right direction.

@aelfric aelfric added the kind/bug Something isn't working label Jan 21, 2023
@quarkus-bot quarkus-bot bot added area/kubernetes env/windows Impacts Windows machines labels Jan 21, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Jan 21, 2023

/cc @Sgitario (kubernetes), @geoand (kubernetes), @iocanel (kubernetes)

@aelfric
Copy link
Author

aelfric commented Jan 21, 2023

Update: This issue seems only to occur in the Windows Terminal. Running it in the normal windows CMD prompt does not have the same issue.

@geoand
Copy link
Contributor

geoand commented Jan 23, 2023

@manusa this looks like a client bug. Do you know if it's an issue?

@manusa
Copy link
Contributor

manusa commented Jan 23, 2023

I think it might be partially related to:

From the stacktrace I understand that the problem is caused when instantiating the client, and that the autoconfiguration part is failing. i.e. the process fails even before generating resources or anything else.

I'm not sure if the issue is caused by the contents of your .kube/config file which might have an entry pointing to a C:\Program files... value which might not be strictly compliant with the YAML spec.

Could you please check the file contents and if there's such an entry enclose it with " and see if the error persists?

@aelfric
Copy link
Author

aelfric commented Jan 23, 2023

Ah...looks like this might be the answer, though wrapping it in quotes didn't fully fix the problem. I use Digital Ocean as my k8s provider and their config tool added an entry like this (originally without the quotes).

command: "C:\Program Files\doctl\doctl.exe"

After adding the quotes, I got a different error about an invalid escape code so I changed \doctl\doctl.exe to \\doctl\\doctl.exe. And then I get some other stack trace:

[ERROR] Failed to parse the kubeconfig.
org.yaml.snakeyaml.parser.ParserException: expected '<document start>', but found '<scalar>'
 in 'reader', line 1, column 25:
    'C:\Users\aelfr\.kube\' 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.<init> (Config.java:251)
    at io.fabric8.kubernetes.client.Config.<init> (Config.java:245)
    at io.fabric8.kubernetes.client.ConfigBuilder.<init> (ConfigBuilder.java:10)
    at io.fabric8.kubernetes.client.ConfigBuilder.<init> (ConfigBuilder.java:7)
    at io.quarkus.kubernetes.client.runtime.KubernetesClientUtils.createConfig (KubernetesClientUtils.java:20)
    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)

@geoand
Copy link
Contributor

geoand commented Jan 26, 2023

@manusa ^

@manusa
Copy link
Contributor

manusa commented Jan 26, 2023

Hi @aelfric
Could you please provide a (redacted) version of your .kube/config file so that we can create a reproducer test and fix it upstream?
I¡ll create an issue in the Fabric8 repo once you provide the information.

@aelfric
Copy link
Author

aelfric commented Jan 28, 2023

This is the one with the escaped \d characters

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

@manusa
Copy link
Contributor

manusa commented Jan 28, 2023

Thx! I've created fabric8io/kubernetes-client#4803

@geoand
Copy link
Contributor

geoand commented Jan 28, 2023

Closing this an upstream issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants