Skip to content

Add optional pre-upgrade hook delay #82434

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

Open
wants to merge 1 commit into
base: main
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ etcd_env_vars=(
ETCD_DISASTER_RECOVERY
ETCD_ON_K8S
ETCD_INIT_SNAPSHOT_FILENAME
ETCD_PREUPGRADE_START_DELAY
ETCD_NAME
ETCD_LOG_LEVEL
ETCD_LISTEN_CLIENT_URLS
Expand Down Expand Up @@ -90,6 +91,7 @@ export ETCD_START_FROM_SNAPSHOT="${ETCD_START_FROM_SNAPSHOT:-no}"
export ETCD_DISASTER_RECOVERY="${ETCD_DISASTER_RECOVERY:-no}"
export ETCD_ON_K8S="${ETCD_ON_K8S:-no}"
export ETCD_INIT_SNAPSHOT_FILENAME="${ETCD_INIT_SNAPSHOT_FILENAME:-}"
export ETCD_PREUPGRADE_START_DELAY="${ETCD_PREUPGRADE_START_DELAY:-}"

# etcd native environment variables (see https://etcd.io/docs/current/op-guide/configuration)
export ETCD_NAME="${ETCD_NAME:-}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set -o nounset
# based on "initial-cluster" flag value
# ref: https://etcd.io/docs/latest/op-guide/clustering/#static
# Globals:
# ETCD_INITIAL_CLUSTER
# ETCD_INITIAL_CLUSTER
# Arguments:
# None
# Returns:
Expand All @@ -37,6 +37,11 @@ endpoints_as_host_port() {

read -r -a extra_flags <<<"$(etcdctl_auth_flags)"
is_boolean_yes "$ETCD_ON_K8S" && extra_flags+=("--endpoints=$(endpoints_as_host_port)")

if [[ -n "$ETCD_PREUPGRADE_START_DELAY" ]]; then
info "Waiting for $ETCD_PREUPGRADE_START_DELAY seconds before starting pre-upgrade checks"
sleep "$ETCD_PREUPGRADE_START_DELAY"
fi
debug "Listing members"
if ! current="$(etcdctl member list "${extra_flags[@]}" --write-out simple | awk -F ", " '{print $3 ":" $1}')"; then
error "Unable to list members, are all members healthy?"
Expand Down
1 change: 1 addition & 0 deletions bitnami/etcd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ Apart from providing your custom configuration file, you can also modify the ser
| `ETCD_START_FROM_SNAPSHOT` | Whether etcd should start from an existing snapshot or not. | `no` |
| `ETCD_DISASTER_RECOVERY` | Whether etcd should try or not to recover from snapshots when the cluste disastrously fails. | `no` |
| `ETCD_ON_K8S` | Whether etcd is running on a K8s environment or not. | `no` |
| `ETCD_PREUPGRADE_START_DELAY` | Optional delay before starting the pre-upgrade hook (in seconds). | `nil` |
| `ETCD_INIT_SNAPSHOT_FILENAME` | Existing snapshot filename to start the etcd cluster from. | `nil` |
| `ETCD_NAME` | etcd member name. | `nil` |
| `ETCD_LOG_LEVEL` | etcd log level. | `info` |
Expand Down
Loading