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

Allow user to get version without a server #95

Merged
merged 3 commits into from
Jan 23, 2024
Merged

Allow user to get version without a server #95

merged 3 commits into from
Jan 23, 2024

Conversation

jmckulk
Copy link
Contributor

@jmckulk jmckulk commented Jan 23, 2024

If you don't have a running server, the current version command will fail.

$ KUBECONFIG=blah ./bin/kubectl-pgo version
Client Version: v0.4.1
W0123 12:49:15.331122 1788689 loader.go:221] Config not found: blah
Error: Get "http://localhost:8080/apis/apiextensions.k8s.io/v1/customresourcedefinitions/postgresclusters.postgres-operator.crunchydata.com": dial tcp 127.0.0.1:8080: connect: connection refused
$ echo $?
1

With the change, you can pass the --client or --client=true flag to skip the server and postgrescluster version check

$ KUBECONFIG=blah ./bin/kubectl-pgo version --client
Client Version: v0.4.1
$ echo $?
0

Copy link
Contributor

@tjmoore4 tjmoore4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍
🤔 Would it be worthwhile to add a check in our KUTTL tests?

We have been using a contains function to check these sorts of outputs
in newer tests
if [ -z "$OPERATOR_VERSION" ]; then
echo "Operator version output is empty."
{ contains "${VERSION_OUTPUT}" "Operator Version: v${OPERATOR_VERSION}"; } || {
echo ${VERSION_OUTPUT}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏️ I'd prefer to have the Expected/Actual error output for troubleshooting.

@jmckulk jmckulk merged commit 56a0c82 into main Jan 23, 2024
5 checks passed
@cbandy cbandy deleted the client-flag branch May 30, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants