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

Re-add support for Kubernetes versions <= v1.23 #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

> This tool is still actively used and working stably despite not too frequent commits! Pull requests are most welcome!
> Important: For kubernetes versions <=1.23 use k8s-wait-for versions 1.*, see [here](https://github.com/groundnuty/k8s-wait-for/issues/60#issuecomment-1313483011).
> Important: For kubernetes versions <=1.23, use k8s-wait-for version 2.1 or higher or k8s-wait-for versions 1.*. See [here](https://github.com/groundnuty/k8s-wait-for/issues/60#issuecomment-1313483011).
A simple script that allows waiting for a k8s service, job or pods to enter the desired state.

Expand Down
8 changes: 4 additions & 4 deletions wait_for.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ get_job_state() {
kill -s TERM $TOP_PID
fi

# Extract number of <avtive>:<ready>:<succeeded>:<failed>
# Ignore the Ready number, as it will alwasy be less or equal to Active number
get_job_state_output1=$(printf "%s" "$get_job_state_output" | sed -nr 's#.*:[[:blank:]]+([[:digit:]]+) [[:alpha:]]+ \(+([[:digit:]]+) [[:alpha:]]+\) / ([[:digit:]]+) [[:alpha:]]+ / ([[:digit:]]+) [[:alpha:]]+.*#\1:\3:\4#p' 2>&1)
# Extract number of <active>:<succeeded>:<failed>
# Ignore the Ready number if it exists, as it will always be less or equal to Active number
get_job_state_output1=$(printf "%s" "$get_job_state_output" | sed -nr 's#.*:[[:blank:]]+([[:digit:]]+) [[:alpha:]]+ (\(+[[:digit:]]+ [[:alpha:]]+\) )?/ ([[:digit:]]+) [[:alpha:]]+ / ([[:digit:]]+) [[:alpha:]]+.*#\1:\3:\4#p' 2>&1)
if [ $? -ne 0 ]; then
echo "$get_job_state_output" >&2
echo "$get_job_state_output1" >&2
Expand All @@ -185,7 +185,7 @@ get_job_state() {
echo "${get_job_state_output1}" >&2
fi

# Map triplets of <avtive>:<succeeded>:<failed> to not ready (emit 1) state
# Map triplets of <active>:<succeeded>:<failed> to not ready (emit 1) state
if [ $TREAT_ERRORS_AS_READY -eq 0 ]; then
# Two conditions:
# - pods are distributed between all 3 states with at least 1 pod active - then emit 1
Expand Down