-
Notifications
You must be signed in to change notification settings - Fork 101
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
Enable e2e tests using emulators for cloud providers [ aws, gcp, azure ] #743
base: master
Are you sure you want to change the base?
Changes from all commits
dd4a097
8b7bc47
5454c29
3f37a55
8d1c313
b7580db
c40c8b5
a711dc5
ec1496b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,8 +125,11 @@ function create_etcd_data_directory() { | |
mkdir -p ${ETCD_DATA_DIR} | ||
} | ||
|
||
function get_aws_existing_region() { | ||
function get_aws_existing_credentials() { | ||
export REGION=`cat ${HOME}/.aws/config | grep -e "^.*region.*$" | sed "s/^.*region[ ]*=[ ]*//"` | ||
export AWS_DEFAULT_REGION=${REGION} | ||
export AWS_ACCESS_KEY_ID=`cat ${HOME}/.aws/credentials | grep -e "^.*aws_access_key_id.*$" | sed "s/^.*aws_access_key_id[ ]*=[ ]*//"` | ||
export AWS_SECRET_ACCESS_KEY=`cat ${HOME}/.aws/credentials | grep -e "^.*aws_secret_access_key.*$" | sed "s/^.*aws_secret_access_key[ ]*=[ ]*//"` | ||
} | ||
|
||
############################# | ||
|
@@ -155,6 +158,9 @@ EOF | |
} | ||
EOF | ||
export AWS_APPLICATION_CREDENTIALS_JSON="${credentials_file}" | ||
export AWS_ACCESS_KEY_ID=$1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these variables being exported as env variables when they weren't needed to be exposed before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 I would like to avoid using environment variables to pass credential information to the etcd-backup-restore process (not just for the main codebase, but for the tests as well). |
||
export AWS_SECRET_ACCESS_KEY=$2 | ||
export AWS_DEFAULT_REGION=$3 | ||
} | ||
|
||
function create_aws_secret() { | ||
|
@@ -192,7 +198,7 @@ function setup-aws-infrastructure() { | |
if [[ "${USE_EXISTING_AWS_SECRET}" == "1" ]]; then | ||
create_aws_secret | ||
else | ||
get_aws_existing_region | ||
get_aws_existing_credentials | ||
fi | ||
create_s3_bucket | ||
echo "AWS infrastructure setup completed." | ||
|
@@ -256,7 +262,7 @@ function run_test_as_processes() { | |
setup_test_cluster | ||
|
||
echo "Starting integration tests..." | ||
cd test/e2e/integration | ||
cd test/integration | ||
|
||
set +e | ||
ginkgo -r -mod=vendor | ||
|
@@ -287,18 +293,18 @@ function run_test_on_cluster() { | |
setup-aws-infrastructure | ||
fi | ||
|
||
export ETCD_VERSION=${ETCD_VERSION:-"v3.4.13-bootstrap-1"} | ||
export ETCD_VERSION=${ETCD_VERSION:-"v0.1.1"} | ||
echo "Etcd version: ${ETCD_VERSION}" | ||
|
||
export ETCDBR_VERSION=${ETCDBR_VERSION:-${ETCDBR_VER:-"v0.12.1"}} | ||
export ETCDBR_VERSION=${ETCDBR_VERSION:-${ETCDBR_VER:-"v0.29.0-dev"}} | ||
Comment on lines
+296
to
+299
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please update the etcd-wrapper and etcd-backup-restore versions to the latest versions? |
||
echo "Etcd-backup-restore version: ${ETCDBR_VERSION}" | ||
|
||
echo "Starting integration tests on k8s cluster." | ||
|
||
set +e | ||
|
||
if [ -r "$INTEGRATION_TEST_KUBECONFIG" ]; then | ||
KUBECONFIG=$INTEGRATION_TEST_KUBECONFIG STORAGE_CONTAINER=$TEST_ID ginkgo -v -timeout=15m -mod=vendor test/e2e/integrationcluster | ||
KUBECONFIG=$INTEGRATION_TEST_KUBECONFIG STORAGE_CONTAINER=$TEST_ID PROVIDER=aws ginkgo -v -timeout=15m -mod=vendor test/integrationcluster | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we defaulting to |
||
TEST_RESULT=$? | ||
echo "Successfully completed all tests." | ||
else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,8 @@ | |
.glide/ | ||
|
||
# Build Binaries | ||
bin | ||
/bin | ||
/hack/tools/bin | ||
Comment on lines
+20
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason to add the |
||
test/output | ||
test/e2e_test_data | ||
default.bkp* | ||
|
@@ -28,6 +29,9 @@ compctedsnap.bkp* | |
.vscode | ||
.idea/ | ||
|
||
# kubeconfig | ||
hack/e2e-test/infrastructure/kind/kubeconfig | ||
|
||
# developers workspace | ||
tmp | ||
dev | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -3,17 +3,22 @@ | |||
# SPDX-License-Identifier: Apache-2.0 | ||||
|
||||
VERSION ?= $(shell cat VERSION) | ||||
REPO_ROOT := $(shell dirname "$(realpath $(lastword $(MAKEFILE_LIST)))") | ||||
REGISTRY ?= europe-docker.pkg.dev/gardener-project/snapshots | ||||
IMAGE_REPOSITORY := $(REGISTRY)/gardener/etcdbrctl | ||||
IMAGE_TAG := $(VERSION) | ||||
BUILD_DIR := build | ||||
BIN_DIR := bin | ||||
COVERPROFILE := test/output/coverprofile.out | ||||
KUBECONFIG_PATH :=$(REPO_ROOT)/hack/e2e-test/infrastructure/kind/kubeconfig | ||||
|
||||
IMG ?= ${IMAGE_REPOSITORY}:${IMAGE_TAG} | ||||
|
||||
.DEFAULT_GOAL := build-local | ||||
|
||||
TOOLS_DIR := hack/tools | ||||
include $(REPO_ROOT)/hack/tools.mk | ||||
Comment on lines
+19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Etcdbr master branch now includes Line 17 in 867f84d
Can you please replace that with your changes - basically rebase on latest master and take care of the merge conflicts. |
||||
|
||||
.PHONY: revendor | ||||
revendor: | ||||
@env GO111MODULE=on go mod tidy -v | ||||
|
@@ -24,6 +29,8 @@ update-dependencies: | |||
@env GO111MODULE=on go get -u | ||||
@make revendor | ||||
|
||||
kind-up kind-down ci-e2e-kind deploy-localstack deploy-fakegcs deploy-azurite test-e2e: export KUBECONFIG = $(KUBECONFIG_PATH) | ||||
|
||||
.PHONY: build | ||||
build: | ||||
@.ci/build | ||||
|
@@ -65,10 +72,46 @@ integration-test: | |||
@.ci/integration_test | ||||
|
||||
.PHONY: integration-test-cluster | ||||
integration-test-cluster: | ||||
integration-test-cluster: $(KIND) $(HELM) $(GINKGO) $(KUBECTL) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't we want to rename |
||||
@.ci/integration_test cluster | ||||
|
||||
.PHONY: show-coverage | ||||
show-coverage: | ||||
@if [ ! -f $(COVERPROFILE) ]; then echo "$(COVERPROFILE) is not yet built. Please run 'COVER=true make test'"; false; fi | ||||
@go tool cover -html $(COVERPROFILE) | ||||
|
||||
.PHONY: test-e2e | ||||
test-e2e: $(KIND) $(HELM) $(GINKGO) $(KUBECTL) | ||||
@"$(REPO_ROOT)/hack/e2e-test/run-e2e-test.sh" $(PROVIDERS) | ||||
|
||||
.PHONY: kind-up | ||||
kind-up: $(KIND) | ||||
./hack/kind-up.sh | ||||
|
||||
.PHONY: kind-down | ||||
kind-down: $(KIND) | ||||
kind delete cluster --name etcdbr-e2e | ||||
|
||||
.PHONY: deploy-localstack | ||||
deploy-localstack: $(KUBECTL) | ||||
./hack/deploy-localstack.sh | ||||
|
||||
.PHONY: deploy-fakegcs | ||||
deploy-fakegcs: $(KUBECTL) | ||||
./hack/deploy-fakegcs.sh | ||||
|
||||
.PHONY: deploy-azurite | ||||
deploy-azurite: $(KUBECTL) | ||||
./hack/deploy-azurite.sh | ||||
|
||||
.PHONY: ci-e2e-kind | ||||
ci-e2e-kind: | ||||
./hack/ci-e2e-kind.sh $(PROVIDERS) | ||||
|
||||
.PHONY: pr-test-e2e | ||||
pr-test-e2e: | ||||
./hack/ci-e2e-kind.sh aws | ||||
|
||||
.PHONY: merge-test-e2e | ||||
merge-test-e2e: | ||||
./hack/ci-e2e-kind.sh aws,gcp,azure | ||||
Comment on lines
+111
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice touch, running just one provider on PRs and against all providers on PR merge (head-update). But is it possible to simply provider arguments to And how is this implemented in the pipeline? Will you also introduce prow jobs that run these specific make targets upon specific triggers, like pr-build and head-update (I'm not aware if we can run a prow job on head-update and somehow get notified of the test run results in a meaningful way). Is there possibly a way to specify to prow which providers to run against, using github PR labels maybe? For instance, adding label The advantage with this approach is that we can choose which labels to set on which PRs, for instance a PR that touches GCS snapstore code can use label |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,11 @@ spec: | |
protocol: TCP | ||
port: {{ .Values.servicePorts.client }} | ||
targetPort: {{ .Values.servicePorts.client }} | ||
- name: server | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review comments provided in #813 (review). Please rebase this PR on master branch once #813 is merged. |
||
protocol: TCP | ||
port: {{ .Values.servicePorts.server }} | ||
targetPort: {{ .Values.servicePorts.server }} | ||
- name: backuprestore | ||
protocol: TCP | ||
port: {{ .Values.servicePorts.backupRestore }} | ||
targetPort: {{ .Values.servicePorts.backupRestore }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Release.Name }}-etcd-peer | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app.kubernetes.io/name: etcd | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
publishNotReadyAddresses: true | ||
type: ClusterIP | ||
clusterIP: None | ||
clusterIPs: | ||
- None | ||
internalTrafficPolicy: Cluster | ||
imFamilyPolicy: SingleStack | ||
sessionAffinity: None | ||
selector: | ||
app.kubernetes.io/name: etcd | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
ports: | ||
- name: peer | ||
protocol: TCP | ||
port: {{ .Values.servicePorts.server }} | ||
targetPort: {{ .Values.servicePorts.server }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. If the credentials can be fetched from the .aws folder, or from an applicationCredentials JSON file, then I would prefer that over exposing the env vars