Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 api/v1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type NetworkPolicy struct {
}
type HAProxy struct {
Enabled bool `json:"enabled,omitempty"`
// +kubebuilder:default:="haproxytech/haproxy-alpine:3.2"
// +kubebuilder:default:="haproxytech/haproxy-alpine:3.2.1"
Image string `json:"image,omitempty"`
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
// +kubebuilder:default:=1
Expand Down
31 changes: 0 additions & 31 deletions pkg/k8sutil/scripts/liveness-probe.sh

This file was deleted.

23 changes: 21 additions & 2 deletions pkg/k8sutil/scripts/poststart-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ log () {
echo $message >> /tmp/script.log
}

# Function to retry a command based on the return code
# $1: The number of retries
# $2: The command to run
retry() {
local retries=$1
shift
local count=0
until "$@"; do
exit_code=$?
count=$((count + 1))
if [ $count -ge $retries ]; then
echo "Command failed after $retries attempts."
return $exit_code
fi
echo "Attempt $count failed. Retrying..."
Comment on lines +67 to +70
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Use the existing log function instead of echo so retries are recorded in the pod log and /tmp/script.log.

Suggested change
echo "Command failed after $retries attempts."
return $exit_code
fi
echo "Attempt $count failed. Retrying..."
log "Error" "Command failed after $retries attempts."
return $exit_code
fi
log "Info" "Attempt $count failed. Retrying..."

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Replace this echo with the log helper to ensure consistent logging with timestamps and PID handling.

Suggested change
echo "Attempt $count failed. Retrying..."
info "Attempt $count failed. Retrying..."

Copilot uses AI. Check for mistakes.
sleep 5
done
}

###############################################################
# Function to get the current host protocol
# $1: The host name
Expand Down Expand Up @@ -699,10 +718,10 @@ if [[ "$IS_BOOTSTRAP_HOST" == "true" ]]; then
if [[ "${MARKLOGIC_CLUSTER_TYPE}" == "bootstrap" ]]; then
log "Info: bootstrap host is ready"
init_security_db
configure_group
retry 5 configure_group
else
log "Info: bootstrap host is ready"
configure_group
retry 5 configure_group
join_cluster $HOST_FQDN
fi
configure_path_based_routing
Expand Down
7 changes: 5 additions & 2 deletions pkg/k8sutil/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,11 @@ func getLivenessProbe(probe marklogicv1.ContainerProbe) *corev1.Probe {
TimeoutSeconds: probe.TimeoutSeconds,
SuccessThreshold: probe.SuccessThreshold,
ProbeHandler: corev1.ProbeHandler{
Exec: &corev1.ExecAction{
Command: []string{"/bin/bash", "/tmp/helm-scripts/liveness-probe.sh"},
TCPSocket: &corev1.TCPSocketAction{
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: 8001,
},
},
},
}
Expand Down