-
Notifications
You must be signed in to change notification settings - Fork 3
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
ASTRACTL-32772: rework Trident upgrade logic, better error handling #352
Conversation
@@ -1097,10 +1097,9 @@ get_registry_credentials_from_pull_secret() { | |||
# 6. Get the first matching entry's `.value.auth`, which would be `B64_ENCODED_USERNAME_PASSWORD` here | |||
# 7. The `B64_ENCODED_USERNAME_PASSWORD` can then be passed to curl via | |||
# `-H 'Authorization: Basic B64_ENCODED_USERNAME_PASSWORD'` without having to decode it first. | |||
local -r contents="$(kubectl get secret "$pull_secret" -n "$namespace" -o json 2> /dev/null)" | |||
local -r contents="$(k8s_get_resource "secret/$pull_secret" "$namespace" "json")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll see quite a few of these changes; most kubectl get
commands now instead use k8s_get_resource
or k8s_resource_exists
, which actually handles kubectl errors instead of just sending them into the void.
…rdless of which COMPONENTS is used
if [ -z "$current" ] || [ "$current" == null ] || [ -n "$captured_err" ]; then | ||
add_problem "Failed to get your cluster's Kubernetes version: $captured_err" | ||
return 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is not a kubectl get
and is only called once, the error is handled here instead of using k8s_get_resource
or k8s_resource_exists
(or making a new function).
else | ||
add_problem "k8s permissions: user does not have admin privileges" "Kubernetes user does not have admin privileges" | ||
add_problem "Failed to check if Kubernetes user has admin privilege: unknown error" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above, this kubectl auth can-i
is pretty unique and not called anywhere else so we just handle the errors in-line instead of making a new function.
@@ -2350,6 +2416,7 @@ step_apply_resources() { | |||
# Apply operator resources | |||
logdebug "apply operator resources" | |||
local output="" | |||
local captured_err="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable declaration was missing, so the call 3 lines down was putting the value in a global variable instead.
…-connector-operator into ASTRACTL-32772-misc-fixes-6
…o ASTRACTL-32772-misc-fixes-7
* Revert "ASTRACTL-32772: remove pull secret stuff" This reverts commit 8af69b1. * ASTRACTL-32772: better pull secret handling * ASTRACTL-32772: rework registry resolution for error message * ASTRACTL-32772: suppress unneeded registry output
…o ASTRACTL-32772-misc-fixes-7
…-connector-operator into ASTRACTL-32772-misc-fixes-7
Minimum allowed line rate is |
kubectl get
commands; we'll now be able to differentiate connection/timeout errors VS not found, and users will get much better feedback when something does go wrong