Conversation
More feature complete even when unable to reach server
Stupid error
| # Echo as comment to make sure "kubectl completion" etc works in profile | ||
| echo -e "#WARNING: Wrapper unable to verify server version, using default version $DEFAULT_VERSION.\n" | ||
| $DEFAULT_CLIENT "$@" | ||
| else |
There was a problem hiding this comment.
unnecessary else statement. use exit $?
|
|
||
| if [ "$1" == "config" ]; then | ||
| $DEFAULT_CLIENT "$@" | ||
| exit $? |
There was a problem hiding this comment.
I would keep config with default client to make sure we can always configure our kubectl and dont have to wait 30 seconds for an i/o timeout if cluster not reachable for example.
| $DEFAULT_CLIENT "$@" | ||
| exit $? | ||
| VERSION_OUTPUT=$($DEFAULT_CLIENT version -o json 2>&1) | ||
| if grep -q "Unable to connect to the server" <<<"$VERSION_OUTPUT"; then |
There was a problem hiding this comment.
Depending on error message strings is fragile. Better to check the exit code != 0
|
On more thought i think using default version is bad. If we cannot talk to cluster fetching version we will not be able to talk to cluster got what other command we where using. So simple fix is just exit with error message if SERVER_VERSION is empty. |
|
I understand your point, my thought was to make it behave as similar to
regular kubectl as possible. This version would show all help commands
available in default client for instance (which is good for someone
unfamiliar with kubectl, i.e me). As soon as you are connected to a
responding cluster it would download correct version.
Pity about the delay though, could conceivably be fixed by some sort of
lockfile after first attempt until connected, but would complicate a bit.
Den ons 28 nov. 2018 09:12 skrev Jonas Falck <notifications@github.com>:
… On more thought i think using default version is bad. If we cannot talk to
cluster fetching version we will not be able to talk to cluster got what
other command we where using. So simple fix is just exit with error message
if SERVER_VERSION is empty.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADbfGhyKhjROJvixcSW184zHp2uFxx2qks5uzkVugaJpZM4Y1Mkl>
.
|
|
Then its better to "whitelist" more stuff. For example if We only want to check server version for commands that talk to the server. |
More feature complete even when unable to reach server