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

add time limit parameter to hooks (#3) #4

Merged
merged 1 commit into from
Aug 28, 2024
Merged
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
3 changes: 1 addition & 2 deletions bin/actions-runner-postsync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ set -e

RELEASE_NAME="${1:-actions-runner}"
NAMESPACE="${2:-actions-runner}"

LIMIT=180
LIMIT="${3:-180}"

# Note: The hook is only valid for static self-hosted runners (not created by HorizontalRunnerAutoscaler from 0)
GO_TEMPLATE='
Expand Down
3 changes: 1 addition & 2 deletions bin/azure-cluster-postsync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ set -e

RELEASE_NAME="${1}"
NAMESPACE="${2:-azure}"

LIMIT=1200
LIMIT="${3:-1200}"

GO_TEMPLATE='
{{- range .items -}}
Expand Down
10 changes: 8 additions & 2 deletions bin/check-pvcs-deleted.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ set -e

NAMESPACE="${1}"
K8S_LABELS=("${@}")
K8S_LABELS="${K8S_LABELS[@]:1}"
LIMIT="120"

if [[ ! "${2}" =~ ^[0-9]+$ ]];then
K8S_LABELS="${K8S_LABELS[@]:1}"
else
LIMIT="${2}"
K8S_LABELS="${K8S_LABELS[@]:2}"
fi

LIMIT=120
PVC_IDS=( "$(kubectl -n "${NAMESPACE}" get pvc -l "${K8S_LABELS/ /,}" -o yaml | yq '.items[].spec.volumeName')" )

for PVC_ID in ${PVC_IDS[*]}; do
Expand Down
2 changes: 1 addition & 1 deletion bin/clickhouse-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -e
RELEASE_NAME="${1:-clickhouse}"
NAMESPACE="${2:-clickhouse}"
ACTION="${3}"
LIMIT="${4:-180}"

LIMIT=180
COUNT=1

function watcher() {
Expand Down
2 changes: 1 addition & 1 deletion bin/dagster-presync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ NAMESPACE=${1:-dagster}
SECRET_NAME_INPUT=${2:-dagster.user.postgres-cluster.credentials.postgresql.acid.zalan.do}
SECRET_NAME_OUTPUT=${3:-dagster-postgresql-secret}
MASKS=(${4})
LIMIT=180
LIMIT="${5:-180}"

function check_input_secret_exist() {
COUNT=0
Expand Down
2 changes: 1 addition & 1 deletion bin/elastic-postsync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ fi

RELEASE_NAME="${1:-elastic}"
NAMESPACE="${2:-elastic}"
LIMIT="${3:-240}"

LIMIT=120
COUNT=1

while true; do
Expand Down
3 changes: 1 addition & 2 deletions bin/kafka-config-postsync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ set -e

RELEASE_NAME="${1}"
NAMESPACE="${2:-kafka}"

LIMIT=180
LIMIT="${3:-180}"

# for kafkaconnector also check connector and tasks' states in .status.connectorStatus
# for kafkamirrormaker2 also check connectors' and tasks' states in .status.connectors
Expand Down
2 changes: 1 addition & 1 deletion bin/kafka-postsync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ fi

RELEASE_NAME="${1:-kafka}"
NAMESPACE="${2:-kafka}"
LIMIT="${3:-180}"

LIMIT=180
# higher sleep is needed to wait till the operator starts updating the resources
SLEEP=5

Expand Down
3 changes: 1 addition & 2 deletions bin/keycloak-postsync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ RELEASE_NAME="${1}"
NAMESPACE="${2:-keycloak}"
STATUS_TYPE="${3:-Ready}"
KEYCLOAK_RESOURCE="${4:-keycloak}"

LIMIT=180
LIMIT="${5:-180}"

[[ "${STATUS_TYPE}" == "Done" ]] && KEYCLOAK_RESOURCE="keycloakrealmimport"

Expand Down
9 changes: 6 additions & 3 deletions bin/postgres-postsync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ fi
CLUSTER_NAME="${1:-postgres-cluster}"
NAMESPACE="${2:-postgres}"
CRD_NAME="${3:-postgresql}"
LIMIT="${4:-600}"

readonly LIMIT=600
COUNT=1

function disable_pooler_metrics_scraping() {
Expand Down Expand Up @@ -48,9 +48,12 @@ function disable_pooler_metrics_scraping() {
}

while true; do
sleep 1
STATUS=$(kubectl -n "${NAMESPACE}" get "${CRD_NAME}" "${CLUSTER_NAME}" -o yaml | yq '.status.PostgresClusterStatus')
if [[ "${STATUS}" != "Running" && "${COUNT}" -le "${LIMIT}" ]]; then
sleep 1
if [[ "${STATUS}" == "null" ]]; then
echo "Resource ${CRD_NAME} cluster ${CLUSTER_NAME} not exist."
break
elif [[ "${STATUS}" != "Running" && "${COUNT}" -le "${LIMIT}" ]]; then
((++COUNT))
elif [[ "${COUNT}" -gt "${LIMIT}" ]]; then
>2& echo "Limit exceeded."
Expand Down
2 changes: 1 addition & 1 deletion bin/traefik-ingress-postsync-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e

NAME_SERVER="${1}"
DOMAIN="${2}"
LIMIT="${3:-120}"

LIMIT=120
COUNT=1

while true; do
Expand Down