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

fix: ensure the secret for pulling image is created #61

Closed
wants to merge 2 commits into from
Closed
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
34 changes: 22 additions & 12 deletions hack/e2e/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,23 @@ notinpath () {
esac
}

ensure_image_pull_secret() {
if [ -n "${DOCKER_SERVER-}" ] && [ -n "${DOCKER_USERNAME-}" ] && [ -n "${DOCKER_PASSWORD-}" ]; then
if ! kubectl get secret cnpg-pull-secret -n cnpg-system >/dev/null 2>&1; then
kubectl create secret docker-registry \
-n cnpg-system \
cnpg-pull-secret \
--docker-server="${DOCKER_SERVER}" \
--docker-username="${DOCKER_USERNAME}" \
--docker-password="${DOCKER_PASSWORD}"
fi
fi
}

# Process the e2e templates
export E2E_PRE_ROLLING_UPDATE_IMG=${E2E_PRE_ROLLING_UPDATE_IMG:-${POSTGRES_IMG%.*}}
export AZURE_STORAGE_ACCOUNT=${AZURE_STORAGE_ACCOUNT:-''}

# Getting the operator images need a pull secret
kubectl delete namespace cnpg-system || :
kubectl create namespace cnpg-system
if [ -n "${DOCKER_SERVER-}" ] && [ -n "${DOCKER_USERNAME-}" ] && [ -n "${DOCKER_PASSWORD-}" ]; then
kubectl create secret docker-registry \
-n cnpg-system \
cnpg-pull-secret \
--docker-server="${DOCKER_SERVER}" \
--docker-username="${DOCKER_USERNAME}" \
--docker-password="${DOCKER_PASSWORD}"
fi

go_bin="$(go env GOPATH)/bin"
if notinpath "${go_bin}"; then
export PATH="${go_bin}:${PATH}"
Expand All @@ -74,6 +75,10 @@ echo "E2E tests are running with the following filters: ${LABEL_FILTERS}"
RC=0
RC_GINKGO1=0
if [[ "${TEST_UPGRADE_TO_V1}" != "false" ]]; then
# Getting the operator images need a pull secret
kubectl delete namespace cnpg-system || :
kubectl create namespace cnpg-system
ensure_image_pull_secret
# Generate a manifest for the operator after the api upgrade
# TODO: this is almost a "make deploy". Refactor.
make manifests kustomize
Expand Down Expand Up @@ -103,6 +108,11 @@ if [[ "${TEST_UPGRADE_TO_V1}" != "false" ]]; then
jq -e -c -f "${ROOT_DIR}/hack/e2e/test-report.jq" "${ROOT_DIR}/tests/e2e/out/upgrade_report.json" || RC=$?
fi

# Getting the operator images need a pull secret
kubectl delete namespace cnpg-system || :
kubectl create namespace cnpg-system
ensure_image_pull_secret

CONTROLLER_IMG="${CONTROLLER_IMG}" \
POSTGRES_IMAGE_NAME="${POSTGRES_IMG}" \
make -C "${ROOT_DIR}" deploy
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/volume_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"encoding/json"
"os"
"strings"
"time"

volumesnapshot "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -240,6 +241,10 @@ var _ = Describe("Verify Volume Snapshot",
// Create a "test" table with values 1,2
AssertCreateTestData(namespace, clusterToSnapshotName, tableName, psqlClientPod)

// Because GetCurrentTimestamp() rounds down to the second and is executed
// right after the creation of the test data, we wait for 1s to avoid not
// including the newly created data within the recovery_target_time
time.Sleep(1 * time.Second)
// Get the recovery_target_time and pass it to the template engine
recoveryTargetTime, err := testUtils.GetCurrentTimestamp(namespace, clusterToSnapshotName, env, psqlClientPod)
Expect(err).ToNot(HaveOccurred())
Expand Down
Loading