redhat-developer / redhat-developer/web-terminal-operator

config file /home/user/.kube/config does not use quotation marks

Open
#93 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
42
Forks
24
Avg merge
3d 21h
Merged PRs (30d)
1

Description

Describe the bug

We use the mobile phone number as the username, but the generated kubeconfig does not use quotation marks, resulting in an error when using the oc command

bash-4.4 ~ $ cat /home/user/.kube/config 
apiVersion: v1
clusters:
- cluster:
    certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    server: https://172.30.0.1:443
  name: https://172.30.0.1:443
users:
- name: 18656157120
  user:
    token: sha256~F696KTgtysnKT-U9yjUZ2mTreR2Sc8EFTuOKMSJIEik
contexts:
- context:
    cluster: https://172.30.0.1:443
    namespace: tool-polaris
    user: 18656157120
  name: 18656157120-context
current-context: 18656157120-context
kind: Config

bash-4.4 ~ $ oc get pod
error: error loading config file "/home/user/.kube/config": v1.Config.Contexts: []v1.NamedContext: v1.NamedContext.Context: v1.Context.AuthInfo: ReadString: expects " or n, but found 1, error found in #10 byte of ...|","user":18656157120|..., bigger context ...|72.30.0.1:443","namespace":"tool-polaris","user":18656157120},"name":"18656157120-context"}],"curren|...

Environment

  • Web Terminal: v1.2.1
  • OpenShift Version: 4.8

When I add quotation marks, the oc command can be executed normally

bash-4.4 ~ $ cat /home/user/.kube/config 
...
users:
- name: "18656157120"
  user:
    token: sha256~F696KTgtysnKT-U9yjUZ2mTreR2Sc8EFTuOKMSJIEik
...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing where the web terminal generates the kubeconfig and reproduce the issue with a numeric mobile-phone username. Compare the generated users and contexts with the quoted example, then verify that the resulting config is accepted by the oc command.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
backend, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.