envoyproxy / gateway

Manages Envoy Proxy as a Standalone or Kubernetes-based Application Gateway
https://gateway.envoyproxy.io
Apache License 2.0
1.63k stars 354 forks source link

always show egctl version #4766

Closed dart-ops closed 7 hours ago

dart-ops commented 8 hours ago

Description: The egctl version command should display the application version even when no Kubernetes context exists

without Kubernetes context

$ egctl version
error: list EG pods failed: Get "http://localhost:8080/api/v1/pods?labelSelector=control-plane%3Denvoy-gateway": dial tcp 127.0.0.1:8080: connect: connection refused

$ kubectl version
Client Version: v1.31.2
Kustomize Version: v5.4.2
The connection to the server localhost:8080 was refused - did you specify the right host or port?

with Kubernetes context

$ egctl version
client: 1.2.1
server:
- Name: envoy-gateway-6bd99f6549-55n8p
  Namespace: envoy-gateway-system
  envoyGatewayVersion: v1.2.1
  envoyProxyVersion: distroless-v1.32.1
  gatewayAPIVersion: v1.2.0
  gitCommitID: 1e7263bc05566559a67ed028b633fb3580f61682
  golangVersion: go1.23.2

$ kubectl version
Client Version: v1.31.2
Kustomize Version: v5.4.2
Server Version: v1.29.8-eks-a737599
WARNING: version difference between client (1.31) and server (1.29) exceeds the supported minor version skew of +/-1
zirain commented 8 hours ago

try egctl version --retmote=false?

dart-ops commented 8 hours ago

try egctl version --retmote=false?

it works, but I think version flag should always return the application version without requiring additional flags, especially since this behavior is not mentioned it the --help output

zirain commented 7 hours ago
egctl version -h
Show version

Usage:
  egctl version [flags]

Aliases:
  version, versions, v

Examples:
  # Show versions of both client and server.
  egctl version

  # Show versions of both client and server in JSON format.
  egctl version --output=json

  # Show version of client without server.
  egctl version --remote=false

Flags:
      --context string      The name of the kubeconfig context to use.
  -h, --help                help for version
      --kubeconfig string   Path to the kubeconfig file to use for CLI requests.
  -o, --output string       One of 'yaml' or 'json' (default "yaml")
  -r, --remote              If true, retrieve version from remote apiserver. (default true)
dart-ops commented 7 hours ago

thnx