Skip to content
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
2 changes: 1 addition & 1 deletion hack/lib/__sources__.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

declare -a __sources=(vars common ui scaleup namespaces catalogsource serverless)
declare -a __sources=(vars common ui scaleup namespaces catalogsource serverless tracing)

for source in "${__sources[@]}"; do
# shellcheck disable=SC1091,SC1090
Expand Down
2 changes: 1 addition & 1 deletion hack/lib/namespaces.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function delete_namespaces {
for ns in "${NAMESPACES[@]}"; do
if oc get ns "${ns}" >/dev/null 2>&1; then
logger.info "Waiting until there are no pods in ${ns} to safely remove it..."
timeout 600 "[[ \$(oc get pods -n $ns -o jsonpath='{.items}') != '[]' ]]"
timeout 600 "[[ \$(oc get pods -n $ns --field-selector=status.phase!=Succeeded -o jsonpath='{.items}') != '[]' ]]"
Comment thread
aliok marked this conversation as resolved.
oc delete ns "$ns"
fi
done
Expand Down
4 changes: 2 additions & 2 deletions hack/lib/serverless.bash
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ function teardown_serverless {
oc delete knativeserving.operator.knative.dev knative-serving -n "${SERVING_NAMESPACE}" || return $?
fi
logger.info 'Ensure no knative serving pods running'
timeout 600 "[[ \$(oc get pods -n ${SERVING_NAMESPACE} -o jsonpath='{.items}') != '[]' ]]" || return 9
timeout 600 "[[ \$(oc get pods -n ${SERVING_NAMESPACE} --field-selector=status.phase!=Succeeded -o jsonpath='{.items}') != '[]' ]]" || return 9

if oc get knativeeventing.operator.knative.dev knative-eventing -n "${EVENTING_NAMESPACE}" >/dev/null 2>&1; then
logger.info 'Removing KnativeEventing CR'
oc delete knativeeventing.operator.knative.dev knative-eventing -n "${EVENTING_NAMESPACE}" || return $?
fi
logger.info 'Ensure no knative eventing pods running'
timeout 600 "[[ \$(oc get pods -n ${EVENTING_NAMESPACE} -o jsonpath='{.items}') != '[]' ]]" || return 9
timeout 600 "[[ \$(oc get pods -n ${EVENTING_NAMESPACE} --field-selector=status.phase!=Succeeded -o jsonpath='{.items}') != '[]' ]]" || return 9

oc delete subscription -n "${OPERATORS_NAMESPACE}" "${OPERATOR}" 2>/dev/null
for ip in $(oc get installplan -n "${OPERATORS_NAMESPACE}" | grep serverless-operator | cut -f1 -d' '); do
Expand Down
90 changes: 90 additions & 0 deletions hack/lib/tracing.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/usr/bin/env bash

function install_tracing {
deploy_zipkin
enable_eventing_tracing
}

function deploy_zipkin {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't we use Openshift Tracing (Jaeger) here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No idea. Just trying to make things work honestly.
Maybe we can do that later

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I will create a JIRA for it after this PR is merged

logger.info "Installing Zipkin in namespace ${ZIPKIN_NAMESPACE}"
cat <<EOF | oc apply -f - || return $?
apiVersion: v1
kind: Service
metadata:
name: zipkin
namespace: ${ZIPKIN_NAMESPACE}
spec:
type: NodePort
ports:
- name: http
port: 9411
selector:
app: zipkin
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: zipkin
namespace: ${ZIPKIN_NAMESPACE}
spec:
replicas: 1
selector:
matchLabels:
app: zipkin
template:
metadata:
labels:
app: zipkin
annotations:
sidecar.istio.io/inject: "false"
spec:
containers:
- name: zipkin
image: docker.io/openzipkin/zipkin:latest
ports:
- containerPort: 9411
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
resources:
limits:
memory: 1000Mi
requests:
memory: 256Mi
---
EOF

logger.info "Waiting until Zipkin is available"
timeout 600 "[[ \$(oc get pods -n ${ZIPKIN_NAMESPACE} --field-selector=status.phase!=Succeeded -o jsonpath='{.items}') != '[]' ]]" || return 1
}

function enable_eventing_tracing {
header_text "Configuring tracing for Eventing"

cat <<EOF | oc apply -f - || return $?
apiVersion: v1
kind: ConfigMap
metadata:
name: config-tracing
namespace: ${EVENTING_NAMESPACE}
data:
enable: "true"
zipkin-endpoint: "http://zipkin.${ZIPKIN_NAMESPACE}.svc.cluster.local:9411/api/v2/spans"
sample-rate: "1.0"
debug: "true"
EOF
}

function teardown_tracing {
logger.warn 'Teardown tracing'

oc delete service -n ${ZIPKIN_NAMESPACE} zipkin
oc delete deployment -n ${ZIPKIN_NAMESPACE} zipkin

timeout 600 "[[ \$(oc get pods -n ${ZIPKIN_NAMESPACE} --field-selector=status.phase!=Succeeded -o jsonpath='{.items}') != '[]' ]]" || return 2

logger.success 'Tracing is uninstalled.'
}
8 changes: 5 additions & 3 deletions hack/lib/vars.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ source "$(dirname "${BASH_SOURCE[0]}")/../../test/vendor/knative.dev/test-infra/

readonly KNATIVE_SERVING_VERSION="${KNATIVE_SERVING_VERSION:-v0.13.3}"
readonly KNATIVE_SERVING_OPERATOR_VERSION="${KNATIVE_SERVING_OPERATOR_VERSION:-v0.13.3}"
readonly KNATIVE_EVENTING_VERSION="${KNATIVE_EVENTING_VERSION:-v0.13.0}"
readonly KNATIVE_EVENTING_OPERATOR_VERSION="${KNATIVE_EVENTING_OPERATOR_VERSION:-0.13.2}"
readonly KNATIVE_EVENTING_VERSION="${KNATIVE_EVENTING_VERSION:-v0.14.0}"
readonly KNATIVE_EVENTING_OPERATOR_VERSION="${KNATIVE_EVENTING_OPERATOR_VERSION:-0.14}"

readonly KNATIVE_SERVING_BRANCH="${KNATIVE_SERVING_BRANCH:-release-${KNATIVE_SERVING_VERSION}}"
readonly KNATIVE_SERVING_OPERATOR_BRANCH="${KNATIVE_SERVING_OPERATOR_BRANCH:-openshift-${KNATIVE_SERVING_OPERATOR_VERSION}}"
Expand All @@ -38,9 +38,11 @@ readonly OPERATORS_NAMESPACE="${OPERATORS_NAMESPACE:-openshift-operators}"
readonly SERVERLESS_NAMESPACE="${SERVERLESS_NAMESPACE:-serverless}"
readonly SERVING_NAMESPACE="${SERVING_NAMESPACE:-knative-serving}"
readonly EVENTING_NAMESPACE="${EVENTING_NAMESPACE:-knative-eventing}"
# eventing e2e and conformance tests use a container for tracing tests that has hardcoded `istio-system` in it
readonly ZIPKIN_NAMESPACE="${ZIPKIN_NAMESPACE:-istio-system}"

declare -a NAMESPACES
NAMESPACES=("${SERVING_NAMESPACE}" "${SERVERLESS_NAMESPACE}" "${EVENTING_NAMESPACE}")
NAMESPACES=("${SERVING_NAMESPACE}" "${SERVERLESS_NAMESPACE}" "${EVENTING_NAMESPACE}" "${ZIPKIN_NAMESPACE}")
export NAMESPACES
readonly UPGRADE_SERVERLESS="${UPGRADE_SERVERLESS:-"true"}"
readonly UPGRADE_CLUSTER="${UPGRADE_CLUSTER:-"false"}"
Expand Down
15 changes: 3 additions & 12 deletions hack/teardown.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
#!/usr/bin/env bash

# This script can be used to teardown Serverless on a configured cluster.
#
# This script will:
#
# * Remove Knative Serving custom resource
# * Uninstall Serverless Operator
# * Remove Catalog Source
# * Unregister namespaces from Service Mesh and remove them
#

# shellcheck disable=SC1091,SC1090
source "$(dirname "${BASH_SOURCE[0]}")/lib/__sources__.bash"

Expand All @@ -18,7 +8,8 @@ set -Eeuo pipefail
exitcode=0

(( !exitcode )) && teardown_serverless || exitcode=2
(( !exitcode )) && delete_catalog_source || exitcode=3
(( !exitcode )) && delete_namespaces || exitcode=4
(( !exitcode )) && teardown_tracing || exitcode=3
(( !exitcode )) && delete_catalog_source || exitcode=4
(( !exitcode )) && delete_namespaces || exitcode=5

exit $exitcode
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ spec:
spec:
description: Spec defines the desired state of KnativeEventing
properties:
config:
additionalProperties:
additionalProperties:
type: string
type: object
description: A means to override the corresponding entries in the upstream
configmaps
type: object
registry:
description: A means to override the corresponding deployment images in the upstream.
This affects both apps/v1.Deployment and caching.internal.knative.dev/v1alpha1.Image.
Expand All @@ -64,6 +72,10 @@ spec:
name:
description: The name of the secret.
type: string
default-broker-class:
description: The default broker type to use for the brokers Knative creates.
If no value is provided, ChannelBasedBroker will be used.
type: string
type: object
status:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ spec:
fieldPath: metadata.namespace
- name: METRICS_DOMAIN
value: knative.dev/eventing-operator
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.2:knative-eventing-operator
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-operator
imagePullPolicy: IfNotPresent
name: knative-eventing-operator
ports:
Expand Down Expand Up @@ -356,27 +356,35 @@ spec:
- name: IMAGE_3scale-kourier-control
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.3:kourier
- name: IMAGE_eventing-controller
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-controller
- name: IMAGE_eventing-webhook
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-webhook
- name: IMAGE_broker-controller
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-channel-broker
- name: IMAGE_imc-controller
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-channel-controller
- name: IMAGE_imc-dispatcher
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-channel-dispatcher
- name: IMAGE_CRONJOB_RA_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-cronjob-receive-adapter
- name: IMAGE_PING_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-ping
- name: IMAGE_APISERVER_RA_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-apiserver-receive-adapter
- name: IMAGE_BROKER_INGRESS_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-ingress
- name: IMAGE_BROKER_FILTER_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-filter
- name: IMAGE_DISPATCHER_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-channel-dispatcher
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-controller
- name: IMAGE_eventing-webhook__eventing-webhook
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-webhook
- name: IMAGE_broker-controller__eventing-controller
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-channel-broker
- name: IMAGE_broker-filter__filter
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-mtbroker-filter
- name: IMAGE_broker-ingress__ingress
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-mtbroker-ingress
- name: IMAGE_mt-broker-controller__eventing-controller
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-mtchannel-broker
- name: IMAGE_imc-controller__controller
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-channel-controller
- name: IMAGE_imc-dispatcher__dispatcher
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-channel-dispatcher
- name: IMAGE_v0.14.0-upgrade__upgrade-brokers
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-upgrade-v0-14-0
- name: IMAGE_eventing-controller__PING_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-adapter
- name: IMAGE_eventing-controller__JOB_RUNNER_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-jobrunner
- name: IMAGE_eventing-controller__APISERVER_RA_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-apiserver-receive-adapter
- name: IMAGE_broker-controller__BROKER_INGRESS_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-ingress
- name: IMAGE_broker-controller__BROKER_FILTER_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-filter
- name: IMAGE_imc-controller__DISPATCHER_IMAGE
value: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-channel-dispatcher
- name: IMAGE_KN_CLI_ARTIFACTS
value: registry.svc.ci.openshift.org/openshift/knative-v0.13.2:kn-cli-artifacts
- name: knative-openshift-ingress
Expand Down Expand Up @@ -511,29 +519,37 @@ spec:
- name: knative-openshift-ingress
image: $IMAGE_KNATIVE_OPENSHIFT_INGRESS
- name: knative-eventing-operator
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.2:knative-eventing-operator
- name: IMAGE_eventing-controller
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-controller
- name: IMAGE_eventing-webhook
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-webhook
- name: IMAGE_broker-controller
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-channel-broker
- name: IMAGE_imc-controller
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-channel-controller
- name: IMAGE_imc-dispatcher
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-channel-dispatcher
- name: IMAGE_CRONJOB_RA_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-cronjob-receive-adapter
- name: IMAGE_PING_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-ping
- name: IMAGE_APISERVER_RA_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-apiserver-receive-adapter
- name: IMAGE_BROKER_INGRESS_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-ingress
- name: IMAGE_BROKER_FILTER_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-filter
- name: IMAGE_DISPATCHER_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.0:knative-eventing-channel-dispatcher
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-operator
- name: IMAGE_eventing-controller__eventing-controller
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-controller
- name: IMAGE_eventing-webhook__eventing-webhook
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-webhook
- name: IMAGE_broker-controller__eventing-controller
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-channel-broker
- name: IMAGE_broker-filter__filter
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-mtbroker-filter
- name: IMAGE_broker-ingress__ingress
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-mtbroker-ingress
- name: IMAGE_mt-broker-controller__eventing-controller
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-mtchannel-broker
- name: IMAGE_imc-controller__controller
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-channel-controller
- name: IMAGE_imc-dispatcher__dispatcher
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-channel-dispatcher
- name: IMAGE_v0.14.0-upgrade__upgrade-brokers
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-upgrade-v0-14-0
- name: IMAGE_eventing-controller__PING_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-adapter
- name: IMAGE_eventing-controller__JOB_RUNNER_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-jobrunner
- name: IMAGE_eventing-controller__APISERVER_RA_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-apiserver-receive-adapter
- name: IMAGE_broker-controller__BROKER_INGRESS_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-ingress
- name: IMAGE_broker-controller__BROKER_FILTER_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-filter
- name: IMAGE_imc-controller__DISPATCHER_IMAGE
image: registry.svc.ci.openshift.org/openshift/knative-v0.14.0:knative-eventing-channel-dispatcher
- name: IMAGE_KN_CLI_ARTIFACTS
image: registry.svc.ci.openshift.org/openshift/knative-v0.13.2:kn-cli-artifacts
replaces: serverless-operator.v1.7.0
Expand Down
4 changes: 3 additions & 1 deletion test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ failed=0
(( !failed )) && downstream_serving_e2e_tests || failed=5

(( !failed )) && upstream_knative_serving_e2e_and_conformance_tests || failed=16
(( !failed )) && knative_eventing_tests || failed=17

(( !failed )) && install_tracing || failed=17
(( !failed )) && knative_eventing_tests || failed=18

(( failed )) && dump_state
(( failed )) && exit $failed
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/knative_eventing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ const (

var knativeControlPlaneDeploymentNames = []string{
"broker-controller",
"broker-filter",
"broker-ingress",
"eventing-controller",
"eventing-webhook",
"imc-controller",
"imc-dispatcher",
"mt-broker-controller",
}

func TestKnativeEventing(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions test/lib.bash
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ function teardown {
fi
logger.warn "Teardown 💀"
teardown_serverless
teardown_tracing
delete_namespaces
delete_catalog_source
delete_users
Expand Down