Skip to content
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 e2e-tests/default-cr/run
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function main() {

desc 'install PMM Server'
deploy_pmm_server
sleep 120
wait_pmm_service "monitoring"
ADMIN_PASSWORD=$(kubectl_bin exec monitoring-0 -- bash -c "printenv | grep ADMIN_PASSWORD | cut -d '=' -f2")
MONITORING_ENDPOINT=$(get_service_endpoint monitoring-service)
API_KEY=$(curl --insecure -X POST -H "Content-Type: application/json" -d '{"name":"operator", "role": "Admin"}' "https://admin:$ADMIN_PASSWORD@$MONITORING_ENDPOINT/graph/api/auth/keys" | jq .key)
Expand Down
50 changes: 36 additions & 14 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ if oc get projects 2>/dev/null; then
OPENSHIFT=$(oc version -o json | jq -r '.openshiftVersion' | grep -oE '^[0-9]+\.[0-9]+')
fi

if doctl kubernetes cluster get $(kubectl config current-context | sed 's/^do-[^-]*-//') --format Version >/dev/null 2>&1; then
DOKS=1
else
DOKS=0
fi

if [ $(kubectl version -o json | jq -r '.serverVersion.gitVersion' | grep "\-eks\-") ]; then
EKS=1
else
Expand Down Expand Up @@ -466,6 +472,8 @@ compare_kubectl() {
del(.metadata.annotations."cloud.google.com/neg") |
del(.metadata.annotations."k8s.v1.cni.cncf.io*") |
del(.metadata.annotations."k8s.ovn.org/pod-networks") |
del(.metadata.annotations."kubernetes.digitalocean.com/load-balancer-id") |
del(.metadata.annotations."service.beta.kubernetes.io/do-loadbalancer-type") |
del(.spec.template.metadata.annotations."last-applied-secret") |
del(.spec.template.metadata.labels."batch.kubernetes.io/job-name") |
del(.spec.template.metadata.labels."job-name") |
Expand Down Expand Up @@ -744,23 +752,18 @@ desc() {
get_service_endpoint() {
local service=$1

local hostname=$(
kubectl_bin get service/$service -o json \
| jq '.status.loadBalancer.ingress[].hostname' \
| sed -e 's/^"//; s/"$//;'
local endpoint=$(
kubectl_bin get service/$service -o jsonpath='{.status.loadBalancer.ingress[].hostname}'
)
if [ -n "$hostname" -a "$hostname" != "null" ]; then
echo $hostname
return

if [ -z "$endpoint" ] || [ "$endpoint" = "null" ]; then
endpoint=$(
kubectl_bin get service/$service -o jsonpath='{.status.loadBalancer.ingress[].ip}'
)
fi

local ip=$(
kubectl_bin get service/$service -o json \
| jq '.status.loadBalancer.ingress[].ip' \
| sed -e 's/^"//; s/"$//;'
)
if [ -n "$ip" -a "$ip" != "null" ]; then
echo $ip
if [ -n "$endpoint" ] && [ "$endpoint" != "null" ]; then
echo "$endpoint" | head -n 1 | sed -e 's/^"//; s/"$//;'
return
fi

Expand Down Expand Up @@ -1678,6 +1681,25 @@ deploy_pmm_server() {
retry 10 60 helm install monitoring --set imageRepo=${IMAGE_PMM_SERVER%:*} --set imageTag=${IMAGE_PMM_SERVER#*:} $additional_params https://percona-charts.storage.googleapis.com/pmm-server-$PMM_SERVER_VER.tgz
}

wait_pmm_service() {
service=$1

kubectl_bin wait --for=condition=Ready pod/$service-0 --timeout=120s >/dev/null

retry=0
until (get_service_endpoint $service-service && kubectl_bin exec $service-0 -- bash -c 'ls -l /proc/*/exe 2>/dev/null | grep postgres') >/dev/null; do
echo "Waiting for $service endpoint to be available. Retry $retry"
sleep 5
retry=$((retry + 1))
if [ "$retry" -ge 30 ]; then
echo "Max retry count $retry reached. pmm-server can't start or load balancer is not available"
exit 1
fi
done

echo "The $service service is available"
}

run_recovery_check_pitr() {
local cluster=$1
local restore=$2
Expand Down
11 changes: 1 addition & 10 deletions e2e-tests/monitoring-2-0/run
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,7 @@ deploy_helm $namespace

desc 'install PMM Server'
deploy_pmm_server
kubectl_bin wait --for=condition=Ready pod/${cluster}-0 --timeout=120s
until kubectl_bin exec monitoring-0 -- bash -c "ls -l /proc/*/exe 2>/dev/null| grep postgres >/dev/null"; do
echo "Retry $retry"
sleep 5
let retry+=1
if [ $retry -ge 20 ]; then
echo "Max retry count $retry reached. Pmm-server can't start"
exit 1
fi
done
wait_pmm_service $cluster
ADMIN_PASSWORD=$(kubectl_bin exec monitoring-0 -- bash -c "printenv | grep ADMIN_PASSWORD | cut -d '=' -f2")
sleep 5
kubectl_bin exec monitoring-0 -- bash -c "grafana-cli --homepath=/usr/share/grafana --config=/etc/grafana/grafana.ini admin reset-admin-password $ADMIN_PASSWORD"
Expand Down
11 changes: 1 addition & 10 deletions e2e-tests/monitoring-pmm3/run
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,7 @@ deploy_helm $namespace

desc 'install PMM Server'
deploy_pmm3_server
kubectl_bin wait --for=condition=Ready pod/${cluster}-0 --timeout=120s
until kubectl_bin exec monitoring-0 -- bash -c "ls -l /proc/*/exe 2>/dev/null| grep postgres >/dev/null"; do
echo "Retry $retry"
sleep 5
let retry+=1
if [ $retry -ge 20 ]; then
echo "Max retry count $retry reached. PMM3-server can't start"
exit 1
fi
done
wait_pmm_service $cluster

desc 'create secret'
kubectl_bin apply -f "$test_dir/conf/secrets.yaml"
Expand Down
13 changes: 12 additions & 1 deletion e2e-tests/proxy-protocol/run
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,18 @@ if [[ -n ${OPENSHIFT} ]]; then
client_ip=$(kubectl_bin exec ${pod_name} -- curl -s ifconfig.io)
fi

service_ip=$(get_service_endpoint proxy-protocol-haproxy)
retry=0
service=proxy-protocol-haproxy
until get_service_endpoint $service >/dev/null; do
echo "Waiting for $service endpoint to be available. Retry $retry"
sleep 5
retry=$((retry + 1))
if [ "$retry" -ge 30 ]; then
echo "Max retry count $retry reached. Endpoint for $service is not available"
exit 1
fi
done
service_ip=$(get_service_endpoint $service)

desc 'check if service and statefulset created with expected config'
compare_kubectl statefulset/${cluster}-pxc
Expand Down
5 changes: 5 additions & 0 deletions e2e-tests/storage/run
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ if [ -n "${OPENSHIFT}" ]; then
exit 0
fi

if [ "$DOKS" = "1" ]; then
echo "This test is not supported on Digital Ocean because hostpath has noexec mode"
exit 0
fi

check_cr_config() {
local cluster="$1"

Expand Down
Loading