Closed den-is closed 1 month ago
Looks like it will return exit code 0 if not configured to talk to a server, but if configured (e.g., with a kubeconfig) it will return an error.
Seems like a reasonable enhancement request to make that configurable though.
I want to work on this, please assign it to me. thanks.
Expected Behavior
calicoctl version --client
should not query Cluster API and return calicoctl version only.I have ansible roles that install tools and check their versions to determine on action (install/update or skip). Helm, kubectl, cilium - allows to query cli binary version only (offline) without communicating to the cluster.
Current Behavior
calicoctl version | head -1 | grep -E -o "v[0-9]+\.[0-9]+\.[0-9]+"
This command always tries to communicate to the server and returnsexit code 1
when server is not available.And cluster is not available in many cases, either I try to install calicoctl before cluster setup, or installing calicoctl on some remote workstation without immediate access to the cluster.
Possible Solution
helm version --template='{{ '{{' }}.Version{{ '}}' }}'
kubectl version --client -o json | grep -i gitversion | grep -E -o "v[0-9]+\.[0-9]+\.[0-9]+"
(no jq)cilium version --client | head -1 | grep -E -o "v[0-9]+\.[0-9]+\.[0-9]+"