Skip to content

Commit

Permalink
Add more variables to configure if install or not some operators (jae…
Browse files Browse the repository at this point in the history
…gertracing#1942)

Signed-off-by: Israel Blancas <[email protected]>
  • Loading branch information
iblancasa authored Jun 23, 2022
1 parent caef41e commit dd44c62
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 25 deletions.
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,24 @@ Other targets include `run-e2e-tests-cassandra` and `run-e2e-tests-elasticsearch
$ make e2e-test-suites
```
**Note**: there are some variables you need to take into account in order to
improve your experience running the E2E tests.
| Variable name | Description | Example usage |
|-------------------|-----------------------------------------------------|------------------------------------|
| KUTTL_OPTIONS | Options to pass directly to the KUTTL call | KUTTL_OPTIONS="--test es-rollover" |
| E2E_TESTS_TIMEOUT | Timeout for each step in the E2E tests. In seconds | E2E_TESTS_TIMEOUT=500 |
| USE_KIND_CLUSTER | Start a KIND cluster to run the E2E tests | USE_KIND_CLUSTER=true |
| KIND_KEEP_CLUSTER | Not remove the KIND cluster after running the tests | KIND_KEEP_CLUSTER=true |
Also, you can enable/disable the installation of the different operators needed
to run the tests:
| Variable name | Description | Example usage |
|----------------|---------------------------------------------|---------------------|
| JAEGER_OLM | Jaeger Operator was installed using OLM | JAEGER_OLM=true |
| KAFKA_OLM | Kafka Operator was installed using OLM | KAFKA_OLM=true |
| PROMETHEUS_OLM | Prometheus Operator was installed using OLM | PROMETHEUS_OLM=true |
#### An external cluster (like OpenShift)
The commands from the previous section are valid when running the E2E tests in an
external cluster like OpenShift, minikube or other Kubernetes environment. The only
Expand Down
40 changes: 24 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
GOARCH ?= $(go env GOARCH)
GOOS ?= $(go env GOOS)
GO_FLAGS ?= GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 GO111MODULE=on
GOPATH ?= "$(HOME)/go"
GOROOT ?= "$(shell go env GOROOT)"
WATCH_NAMESPACE ?= ""
BIN_DIR ?= bin
FMT_LOG=fmt.log

ECHO ?= @echo $(echo_prefix)
SED ?= "sed"
# Jaeger Operator build variables
OPERATOR_NAME ?= jaeger-operator
IMG_PREFIX ?= quay.io/${USER}
OPERATOR_VERSION ?= "$(shell grep -v '\#' versions.txt | grep operator | awk -F= '{print $$2}')"
Expand All @@ -25,28 +29,31 @@ BUNDLE_IMG ?= ${IMG_PREFIX}/${OPERATOR_NAME}-bundle:$(addprefix v,${VERSION})
OUTPUT_BINARY ?= "$(BIN_DIR)/jaeger-operator"
VERSION_PKG ?= "github.com/jaegertracing/jaeger-operator/pkg/version"
export JAEGER_VERSION ?= "$(shell grep jaeger= versions.txt | awk -F= '{print $$2}')"
# Kafka and kafka operator variables
# Kafka and Kafka Operator variables
STORAGE_NAMESPACE ?= "${shell kubectl get sa default -o jsonpath='{.metadata.namespace}' || oc project -q}"
KAFKA_NAMESPACE ?= "kafka"
KAFKA_EXAMPLE ?= "https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/0.23.0/examples/kafka/kafka-persistent-single.yaml"
KAFKA_YAML ?= "https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.23.0/strimzi-cluster-operator-0.23.0.yaml"
# Prometheus Operator variables
PROMETHEUS_OPERATOR_TAG ?= v0.39.0
PROMETHEUS_BUNDLE ?= https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/${PROMETHEUS_OPERATOR_TAG}/bundle.yaml
# Istio binary path and version
ISTIO_VERSION ?= 1.11.2
ISTIO_PATH = ./tests/_build/
ISTIOCTL="${ISTIO_PATH}istio/bin/istioctl"
GOPATH ?= "$(HOME)/go"
GOROOT ?= "$(shell go env GOROOT)"
ECHO ?= @echo $(echo_prefix)
SED ?= "sed"
# Cert manager version to use
CERTMANAGER_VERSION ?= 1.6.1
# Operator SDK version to use
OPERATOR_SDK_VERSION ?= 1.17.0

# Use a KIND cluster for the E2E tests
USE_KIND_CLUSTER ?= true
export OLM ?= false
SKIP_ES_EXTERNAL ?= false
# Is Jaeger Operator installed via OLM?
JAEGER_OLM ?= false
# Is Kafka Operator installed via OLM?
KAFKA_OLM ?= false
# Is Prometheus Operator installed via OLM?
PROMETHEUS_OLM ?= false

PROMETHEUS_OPERATOR_TAG ?= v0.39.0
PROMETHEUS_BUNDLE ?= https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/${PROMETHEUS_OPERATOR_TAG}/bundle.yaml

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand All @@ -59,7 +66,7 @@ LD_FLAGS ?= "-X $(VERSION_PKG).version=$(VERSION) -X $(VERSION_PKG).buildDate=$(

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.22
# Options for kuttl testing
# Options for KIND version to use
export KUBE_VERSION ?= 1.20
KIND_CONFIG ?= kind-$(KUBE_VERSION).yaml

Expand Down Expand Up @@ -216,7 +223,7 @@ storage:
deploy-kafka-operator:
$(ECHO) Creating namespace $(KAFKA_NAMESPACE)
$(VECHO)kubectl create namespace $(KAFKA_NAMESPACE) 2>&1 | grep -v "already exists" || true
ifeq ($(OLM),true)
ifeq ($(KAFKA_OLM),true)
$(ECHO) Skipping kafka-operator deployment, assuming it has been installed via OperatorHub
else
$(VECHO)kubectl create clusterrolebinding strimzi-cluster-operator-namespaced --clusterrole=strimzi-cluster-operator-namespaced --serviceaccount ${KAFKA_NAMESPACE}:strimzi-cluster-operator 2>&1 | grep -v "already exists" || true
Expand All @@ -230,7 +237,7 @@ endif

.PHONY: undeploy-kafka-operator
undeploy-kafka-operator:
ifeq ($(OLM),true)
ifeq ($(KAFKA_OLM),true)
$(ECHO) Skiping kafka-operator undeploy
else
$(VECHO)kubectl delete --namespace $(KAFKA_NAMESPACE) -f tests/_build/kafka-operator.yaml --ignore-not-found=true 2>&1 || true
Expand Down Expand Up @@ -260,15 +267,15 @@ undeploy-kafka: undeploy-kafka-operator

.PHONY: deploy-prometheus-operator
deploy-prometheus-operator:
ifeq ($(OLM),true)
ifeq ($(PROMETHEUS_OLM),true)
$(ECHO) Skipping prometheus-operator deployment, assuming it has been installed via OperatorHub
else
$(VECHO)kubectl apply -f ${PROMETHEUS_BUNDLE}
endif

.PHONY: undeploy-prometheus-operator
undeploy-prometheus-operator:
ifeq ($(OLM),true)
ifeq ($(PROMETHEUS_OLM),true)
$(ECHO) Skipping prometheus-operator undeployment, as it should have been installed via OperatorHub
else
$(VECHO)kubectl delete -f ${PROMETHEUS_BUNDLE} --ignore-not-found=true || true
Expand Down Expand Up @@ -401,6 +408,7 @@ catalog-push: ## Push a catalog image.

.PHONY: start-kind
start-kind: kind
echo $(USE_KIND_CLUSTER)
ifeq ($(USE_KIND_CLUSTER),true)
$(ECHO) Starting KIND cluster...
# Instead of letting KUTTL create the Kind cluster (using the CLI or in the kuttl-tests.yaml
Expand Down
8 changes: 4 additions & 4 deletions hack/run-e2e-test-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ if [ "$VERBOSE" = true ]; then
fi

if [ "$#" -ne 3 ]; then
echo "$0 <test_suite_name> <use_kind_cluster> <olm>"
echo "$0 <test_suite_name> <use_kind_cluster> <Jaeger Operator installed using OLM>"
exit 1
fi

test_suite_name=$1
use_kind_cluster=$2
olm=$3
jaeger_olm=$3

root_dir=$current_dir/../
reports_dir=$root_dir/reports
Expand All @@ -41,8 +41,8 @@ if [ "$use_kind_cluster" == true ]; then
kubectl wait --for=condition=available deployment/metrics-server -n kube-system --timeout=5m
fi

if [ "$olm" = true ]; then
echo "Skipping Jaeger Operator installation because OLM=true"
if [ "$jaeger_olm" = true ]; then
echo "Skipping Jaeger Operator installation because JAEGER_OLM=true"
else
echo Installing Jaeger Operator...
make cert-manager deploy
Expand Down
10 changes: 7 additions & 3 deletions tests/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ export VERTX_IMG ?= jaegertracing/vertx-create-span:operator-e2e-tests
export ELASTIC_IMG ?= docker.elastic.co/elasticsearch/elasticsearch-oss:6.8.6
export OPERATOR_IMAGE_NEXT ?= ${IMG_PREFIX}/jaeger-operator:next
export ASSERT_IMG ?= ${IMG_PREFIX}/asserts-e2e:$(shell date +%s)
USE_KIND_CLUSTER ?= true

# Use a KIND cluster for the E2E tests
USE_KIND_CLUSTER ?= true
# Skip E2E tests where ES external instance is used
SKIP_ES_EXTERNAL ?= false
export E2E_TESTS_TIMEOUT ?= 330


.PHONY: prepare-e2e-tests
prepare-e2e-tests: kuttl build generate-e2e-files

Expand Down Expand Up @@ -94,7 +98,7 @@ e2e-test-suites: list-test-suites
echo -e "\t $$test_suite" ; \
done

@echo "You can run a test suite with make run-e2e-tests-<suite name>. E.g: make run-e2e-tests-smoke"
@echo "You can run a test suite with make run-e2e-tests-<suite name>. E.g: make run-e2e-tests-elasticsearch"

run-suite-tests: start-kind prepare-e2e-tests load-operator-image
./hack/run-e2e-test-suite.sh $(TEST_SUITE_NAME) $(USE_KIND_CLUSTER) $(OLM)
KAFKA_OLM=$(KAFKA_OLM) ./hack/run-e2e-test-suite.sh $(TEST_SUITE_NAME) $(USE_KIND_CLUSTER) $(JAEGER_OLM)
4 changes: 2 additions & 2 deletions tests/templates/kafka-install.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: "cd {{ .Env.ROOT_DIR }} && make undeploy-kafka KAFKA_NAMESPACE=$NAMESPACE OLM={{ .Env.OLM }}"
- script: "cd {{ .Env.ROOT_DIR }} && make kafka KAFKA_NAMESPACE=$NAMESPACE OLM={{ .Env.OLM }}"
- script: "cd {{ .Env.ROOT_DIR }} && make undeploy-kafka KAFKA_NAMESPACE=$NAMESPACE KAFKA_OLM={{ .Env.KAFKA_OLM }}"
- script: "cd {{ .Env.ROOT_DIR }} && make kafka KAFKA_NAMESPACE=$NAMESPACE KAFKA_OLM={{ .Env.KAFKA_OLM }}"

0 comments on commit dd44c62

Please sign in to comment.