Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.
Merged
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
63 changes: 0 additions & 63 deletions config/brokers/mt-channel-broker/deployments/hpa.yaml

This file was deleted.

1 change: 0 additions & 1 deletion config/brokers/mt-channel-broker/hpa.yaml

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion config/channels/in-memory-channel/configmaps/tracing.yaml

This file was deleted.

160 changes: 13 additions & 147 deletions openshift/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,152 +75,28 @@ function timeout_non_zero() {
return 0
}

function install_tracing {
deploy_zipkin
enable_eventing_tracing
}

function deploy_zipkin {
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: ghcr.io/openzipkin/zipkin:2
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"
kubectl wait deployment --all --timeout=600s --for=condition=Available -n ${ZIPKIN_NAMESPACE} || return 1
}

function enable_eventing_tracing {
logger.info "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 configure_sugar_controller_testing {
oc apply -f test/config/sugar.yaml
}

function install_serverless(){
header "Installing Serverless Operator"
local operator_dir=/tmp/serverless-operator
local failed=0
git clone --branch main https://github.com/openshift-knative/serverless-operator.git $operator_dir
# unset OPENSHIFT_BUILD_NAMESPACE (old CI) and OPENSHIFT_CI (new CI) as its used in serverless-operator's CI
# environment as a switch to use CI built images, we want pre-built images of k-s-o and k-o-i
unset OPENSHIFT_BUILD_NAMESPACE
unset OPENSHIFT_CI
pushd $operator_dir
INSTALL_EVENTING="false" ./hack/install.sh && header "Serverless Operator installed successfully" || failed=1
popd
return $failed
}

function install_knative_eventing(){
header "Installing Knative Eventing"

cat openshift/release/knative-eventing-ci.yaml > ci
cat openshift/release/knative-eventing-mtbroker-ci.yaml >> ci
KNATIVE_EVENTING_MANIFESTS_DIR="$(pwd)/openshift/release/artifacts"
export KNATIVE_EVENTING_MANIFESTS_DIR

sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-controller|${KNATIVE_EVENTING_CONTROLLER}|g" ci
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-mtping|${KNATIVE_EVENTING_MTPING}|g" ci
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-apiserver-receive-adapter|${KNATIVE_EVENTING_APISERVER_RECEIVE_ADAPTER}|g" ci
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-webhook|${KNATIVE_EVENTING_WEBHOOK}|g" ci
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-channel-controller|${KNATIVE_EVENTING_CHANNEL_CONTROLLER}|g" ci
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-channel-dispatcher|${KNATIVE_EVENTING_CHANNEL_DISPATCHER}|g" ci
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-mtbroker-ingress|${KNATIVE_EVENTING_MTBROKER_INGRESS}|g" ci
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-mtbroker-filter|${KNATIVE_EVENTING_MTBROKER_FILTER}|g" ci
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-mtchannel-broker|${KNATIVE_EVENTING_MTCHANNEL_BROKER}|g" ci

oc apply -f ci || return 1
rm ci

# Wait for 5 pods to appear first
timeout_non_zero 900 '[[ $(oc get pods -n $EVENTING_NAMESPACE --no-headers | wc -l) -lt 5 ]]' || return 1
wait_until_pods_running $EVENTING_NAMESPACE || return 1

# Apply the testing config for the sugar controller
configure_sugar_controller_testing

# Assert that there are no images used that are not CI images (which should all be using the $INTERNAL_REGISTRY)
# (except for the knative-eventing-operator)
#oc get pod -n knative-eventing -o yaml | grep image: | grep -v knative-eventing-operator | grep -v ${INTERNAL_REGISTRY} && return 1 || true
}

function uninstall_knative_eventing(){
header "Uninstalling Knative Eventing"

cat openshift/release/knative-eventing-ci.yaml > ci
cat openshift/release/knative-eventing-mtbroker-ci.yaml >> ci
local operator_dir=/tmp/serverless-operator
git clone --branch main https://github.com/openshift-knative/serverless-operator.git $operator_dir
export GOPATH=/tmp/go
local failed=0
pushd $operator_dir || return $?
export ON_CLUSTER_BUILDS=true
export DOCKER_REPO_OVERRIDE=image-registry.openshift-image-registry.svc:5000/openshift-marketplace
OPENSHIFT_CI="true" TRACING_BACKEND="zipkin" ENABLE_TRACING="true" make generated-files images install-tracing install-eventing || failed=$?
cat ${operator_dir}/olm-catalog/serverless-operator/manifests/serverless-operator.clusterserviceversion.yaml
popd || return $?

oc delete -f ci --ignore-not-found=true || return 1
rm ci
return $failed
}

function run_e2e_rekt_tests(){
header "Running E2E Reconciler Tests"
oc get ns ${SYSTEM_NAMESPACE} 2>/dev/null || SYSTEM_NAMESPACE="knative-eventing"
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" ${CONFIG_TRACING_CONFIG} | oc replace -f -

oc -n knative-eventing set env deployment/mt-broker-controller BROKER_INJECTION_DEFAULT=true || return 1
wait_until_pods_running $EVENTING_NAMESPACE || return 2

echo "Replacing images used in Rekt test resources with the images built in CI"

echo "Replacing knative-eventing-test-event-library image"
Expand All @@ -245,8 +121,6 @@ function run_e2e_rekt_tests(){

function run_e2e_tests(){
header "Running E2E tests with Multi Tenant Channel Based Broker"
oc get ns ${SYSTEM_NAMESPACE} 2>/dev/null || SYSTEM_NAMESPACE="knative-eventing"
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" ${CONFIG_TRACING_CONFIG} | oc replace -f -
local test_name="${1:-}"
local run_command=""
local failed=0
Expand All @@ -258,9 +132,6 @@ function run_e2e_tests(){
local run_command="-run ^(${test_name})$"
fi

oc -n knative-eventing set env deployment/mt-broker-controller BROKER_INJECTION_DEFAULT=true || return 1
wait_until_pods_running $EVENTING_NAMESPACE || return 2

go_test_e2e -timeout=50m -parallel=20 ./test/e2e \
"$run_command" \
-brokerclass=MTChannelBasedBroker \
Expand All @@ -272,8 +143,6 @@ function run_e2e_tests(){

function run_conformance_tests(){
header "Running Conformance tests with Multi Tenant Channel Based Broker"
oc get ns ${SYSTEM_NAMESPACE} 2>/dev/null || SYSTEM_NAMESPACE="knative-eventing"
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" ${CONFIG_TRACING_CONFIG} | oc replace -f -
local test_name="${1:-}"
local run_command=""
local failed=0
Expand All @@ -285,9 +154,6 @@ function run_conformance_tests(){
local run_command="-run ^(${test_name})$"
fi

oc -n knative-eventing set env deployment/mt-broker-controller BROKER_INJECTION_DEFAULT=true || return 1
wait_until_pods_running $EVENTING_NAMESPACE || return 2

go_test_e2e -timeout=30m -parallel=12 ./test/conformance \
"$run_command" \
-brokerclass=MTChannelBasedBroker \
Expand Down
6 changes: 0 additions & 6 deletions openshift/e2e-conformance-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ failed=0

(( !failed )) && install_serverless || failed=1

(( !failed )) && install_knative_eventing || failed=1

(( !failed )) && install_tracing || failed=1

(( !failed )) && run_conformance_tests || failed=1

(( !failed )) && uninstall_knative_eventing || failed=1

(( failed )) && dump_cluster_state

(( failed )) && exit 1
Expand Down
6 changes: 0 additions & 6 deletions openshift/e2e-rekt-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ failed=0

(( !failed )) && install_serverless || failed=1

(( !failed )) && install_knative_eventing || failed=1

(( !failed )) && install_tracing || failed=1

(( !failed )) && run_e2e_rekt_tests || failed=1

(( !failed )) && uninstall_knative_eventing || failed=1

(( failed )) && dump_cluster_state

(( failed )) && exit 1
Expand Down
6 changes: 0 additions & 6 deletions openshift/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ failed=0

(( !failed )) && install_serverless || failed=1

(( !failed )) && install_knative_eventing || failed=1

(( !failed )) && install_tracing || failed=1

(( !failed )) && run_e2e_tests || failed=1

(( !failed )) && uninstall_knative_eventing || failed=1

(( failed )) && dump_cluster_state

(( failed )) && exit 1
Expand Down
4 changes: 2 additions & 2 deletions openshift/patches/005-k8s-min.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/vendor/knative.dev/pkg/version/version.go b/vendor/knative.dev/pkg/version/version.go
index 39e34464b..c79f442de 100644
index 3cbd846ea..81b1ba46a 100644
--- a/vendor/knative.dev/pkg/version/version.go
+++ b/vendor/knative.dev/pkg/version/version.go
@@ -33,7 +33,7 @@ const (
// NOTE: If you are changing this line, please also update the minimum kubernetes
// version listed here:
// https://github.com/knative/docs/blob/mkdocs/docs/snippets/prerequisites.md
- defaultMinimumVersion = "v1.22.0"
- defaultMinimumVersion = "v1.21.0"
+ defaultMinimumVersion = "v1.19.0"
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/config/openshift-serverless-view-eventing-configmaps.yaml b/config/openshift-serverless-view-eventing-configmaps.yaml
new file mode 100644
index 000000000..6f8fb0439
--- /dev/null
+++ b/config/openshift-serverless-view-eventing-configmaps.yaml
@@ -0,0 +1,41 @@
+# Copyright 2022 The Knative Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ namespace: knative-eventing
+ name: openshift-serverless-view-eventing-configmaps
+rules:
+ - apiGroups:
+ - ""
+ resources:
+ - configmaps
+ verbs:
+ - get
+ - list
+ - watch
+---
+kind: RoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: openshift-serverless-view-eventing-configmaps
+ namespace: knative-eventing
+subjects:
+ - kind: Group
+ name: system:authenticated
+ apiGroup: rbac.authorization.k8s.io
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: openshift-serverless-view-eventing-configmaps
13 changes: 13 additions & 0 deletions openshift/patches/024-webhook-pdb.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/config/core/deployments/webhook-hpa.yaml b/config/core/deployments/webhook-hpa.yaml
index 45811e552..7483fd880 100644
--- a/config/core/deployments/webhook-hpa.yaml
+++ b/config/core/deployments/webhook-hpa.yaml
@@ -49,7 +49,7 @@ metadata:
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing
spec:
- minAvailable: 80%
+ minAvailable: 1
selector:
matchLabels:
app: eventing-webhook
Loading