Closed paololazzari closed 1 month ago
I don't know much about completion, tried to find out about problem after some debug here is my output:
After running kubectl set image <TAB>
========= starting completion logic ==========
CURRENT: 4, words[*]: kubectl set image
Truncated words[*]: kubectl set image ,
lastParam: , lastChar:
Adding extra empty parameter
About to call: eval kubectl __complete set image ""
completion output: :0
last line: :0
directive: 0
completions:
flagPrefix:
Calling _describe
_describe did not find completions.
Checking if we should do file completion.
Activating file completion
Activating file completion
And it starts to complete from files.
But when we call
kubectl logs <TAB>
========= starting completion logic ==========
CURRENT: 3, words[*]: kubectl logs
Truncated words[*]: kubectl logs ,
lastParam: , lastChar:
Adding extra empty parameter
About to call: eval kubectl __complete logs ""
completion output: nginx-7854ff8877-hc59j
daemonsets/
deployments/
pods/
jobs/
replicasets/
replicationcontrollers/
services/
statefulsets/
:4
last line: :4
directive: 4
completions: nginx-7854ff8877-hc59j
daemonsets/
deployments/
pods/
jobs/
replicasets/
replicationcontrollers/
services/
statefulsets/
flagPrefix:
Adding completion: nginx-7854ff8877-hc59j
Adding completion: daemonsets/
Adding completion: deployments/
Adding completion: pods/
Adding completion: jobs/
Adding completion: replicasets/
Adding completion: replicationcontrollers/
Adding completion: services/
Adding completion: statefulsets/
Calling _describe
_describe found some completions
And gets you a list of options.
I think we need to add something like this
https://github.com/kubernetes/kubernetes/blob/cae35dba5a3060711a2a3f958537003bc74a59c0/staging/src/k8s.io/kubectl/pkg/util/completion/completion.go#L101
for set
command to support this feature.
Also we have another issue for completion to explain
it would be nice to fix that too.
I was able to fix this issue with a simple approach of set
, which is
kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1
I'm trying to fix completion to not catch duplicated containers, and cleaning up the code.
/triage accepted /assign @ah8ad3
hitting tab does nothing