Skip to content

Commit

Permalink
📂 Update openshift specific files.
Browse files Browse the repository at this point in the history
  • Loading branch information
serverless-qe committed Aug 4, 2023
1 parent 21a0058 commit 03f4a63
Show file tree
Hide file tree
Showing 19 changed files with 660 additions and 32 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
generate:
./openshift/generate.sh
.PHONY: generate

generate-release: generate
.PHONY: generate

e2e-tests:
./openshift/install.sh
./openshift/e2e-tests.sh
.PHONY: e2e-tests
23 changes: 23 additions & 0 deletions openshift/ci-operator/build-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# DO NOT EDIT! Generated Dockerfile.

# Dockerfile to bootstrap build and test in openshift-ci
FROM registry.ci.openshift.org/openshift/release:golang-1.19 as builder

RUN echo "[kubernetes]" >> /etc/yum.repos.d/kubernetes.repo && \
echo "name=Kubernetes" >> /etc/yum.repos.d/kubernetes.repo && \
echo "baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64" >> /etc/yum.repos.d/kubernetes.repo && \
echo "enabled=1" >> /etc/yum.repos.d/kubernetes.repo && \
echo "gpgcheck=1" >> /etc/yum.repos.d/kubernetes.repo && \
echo "repo_gpgcheck=0" >> /etc/yum.repos.d/kubernetes.repo && \
echo "gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" >> /etc/yum.repos.d/kubernetes.repo

RUN yum install -y kubectl httpd-tools

RUN GOFLAGS='' go install github.com/mikefarah/yq/v3@latest

# go install creates $GOPATH/.cache with root permissions, we delete it here
# to avoid permission issues with the runtime users
RUN rm -rf $GOPATH/.cache

# Allow runtime users to add entries to /etc/passwd
RUN chmod g+rw /etc/passwd
20 changes: 20 additions & 0 deletions openshift/ci-operator/knative-images/controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# DO NOT EDIT! Generated Dockerfile for cmd/controller.
FROM registry.ci.openshift.org/openshift/release:golang-1.19 as builder

COPY . .

RUN mkdir -p /var/run/ko && \
mkdir -p cmd/controller/kodata && \
go build -o /usr/bin/main ./cmd/controller && \
cp -r cmd/controller/kodata /var/run/ko

FROM registry.access.redhat.com/ubi8/ubi-minimal

# install the missing zoneinfo to ubi-minimal
RUN microdnf install tzdata

USER 65532

COPY --from=builder /usr/bin/main /usr/bin/main
COPY --from=builder /var/run/ko /var/run/ko
ENTRYPOINT ["/usr/bin/main"]
3 changes: 3 additions & 0 deletions openshift/ci-operator/source-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DO NOT EDIT! Generated Dockerfile.

FROM src
15 changes: 15 additions & 0 deletions openshift/e2e-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

repo_root_dir=$(dirname "$(realpath "${BASH_SOURCE[0]}")")/..

export SKIP_INITIALIZE=true
export GOPATH=/tmp/go
export GOCACHE=/tmp/go-cache
export ARTIFACTS=${ARTIFACT_DIR:-$(mktemp -u -t -d)}

pushd "${repo_root_dir}/third_party/eventing"
echo "Apply eventing submodule patches"
git apply -v ../../openshift/submodule-patches/eventing/*
popd

"${repo_root_dir}/test/e2e-tests.sh"
49 changes: 49 additions & 0 deletions openshift/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

set -euo pipefail

repo_root_dir=$(dirname "$(realpath "${BASH_SOURCE[0]}")")/..

release=$(yq r openshift/project.yaml project.tag)
release=${release/knative/release}

function resolve_resources(){
echo $@

local dir=$1
local resolved_file_name=$2

local version=${release/release-/}

echo "Writing resolved yaml to $resolved_file_name"

for yaml in "$dir"/*.yaml; do
echo "Resolving ${yaml}"

echo "---" >> "$resolved_file_name"

sed \
-e "s+eventing.knative.dev/release: devel+eventing.knative.dev/release: ${version}+" \
-e "s+app.kubernetes.io/version: devel+app.kubernetes.io/version: ${version}+" \
"$yaml" >> "$resolved_file_name"
done
}

"${repo_root_dir}/hack/update-deps.sh"

GO111MODULE=off go get -u github.com/openshift-knative/hack/cmd/generate

$(go env GOPATH)/bin/generate \
--root-dir "${repo_root_dir}" \
--generators dockerfile \
--excludes "vendor.*" \
--excludes "third_party.*" \
--images-from eventing \
--images-from eventing-kafka-broker

"$repo_root_dir/hack/update-codegen.sh"

rm -rf "${repo_root_dir}/openshift/release/artifacts"
mkdir -p "${repo_root_dir}/openshift/release/artifacts"
resolve_resources "${repo_root_dir}/config/eventing-istio/roles" "${repo_root_dir}/openshift/release/artifacts/eventing-istio-controller.yaml"
resolve_resources "${repo_root_dir}/config/eventing-istio/controller" "${repo_root_dir}/openshift/release/artifacts/eventing-istio-controller.yaml"
37 changes: 37 additions & 0 deletions openshift/images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
knative.dev/eventing-istio/cmd/controller: registry.ci.openshift.org/openshift/knative-eventing-istio-controller:knative-nightly
knative.dev/eventing-kafka-broker/control-plane/cmd/kafka-controller: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-kafka-controller:knative-nightly
knative.dev/eventing-kafka-broker/control-plane/cmd/kafka-source-controller: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-kafka-source-controller:knative-nightly
knative.dev/eventing-kafka-broker/control-plane/cmd/post-install: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-post-install:knative-nightly
knative.dev/eventing-kafka-broker/control-plane/cmd/webhook-kafka: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-webhook-kafka:knative-nightly
knative.dev/eventing-kafka-broker/test/cmd/logs-exporter: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-test-logs-exporter:knative-nightly
knative.dev/eventing-kafka-broker/test/cmd/watch-cm: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-test-watch-cm:knative-nightly
knative.dev/eventing-kafka-broker/test/test_images/committed-offset: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-test-committed-offset:knative-nightly
knative.dev/eventing-kafka-broker/test/test_images/consumer-group-lag-provider-test: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-test-consumer-group-lag-provider-test:knative-nightly
knative.dev/eventing-kafka-broker/test/test_images/kafka-consumer: registry.ci.openshift.org/openshift/knative-eventing-kafka-broker-test-kafka-consumer:knative-nightly
knative.dev/eventing/cmd/apiserver_receive_adapter: registry.ci.openshift.org/openshift/knative-eventing-apiserver-receive-adapter:knative-nightly
knative.dev/eventing/cmd/appender: registry.ci.openshift.org/openshift/knative-eventing-appender:knative-nightly
knative.dev/eventing/cmd/broker/filter: registry.ci.openshift.org/openshift/knative-eventing-filter:knative-nightly
knative.dev/eventing/cmd/broker/ingress: registry.ci.openshift.org/openshift/knative-eventing-ingress:knative-nightly
knative.dev/eventing/cmd/controller: registry.ci.openshift.org/openshift/knative-eventing-controller:knative-nightly
knative.dev/eventing/cmd/event_display: registry.ci.openshift.org/openshift/knative-eventing-event-display:knative-nightly
knative.dev/eventing/cmd/heartbeats: registry.ci.openshift.org/openshift/knative-eventing-heartbeats:knative-nightly
knative.dev/eventing/cmd/heartbeats_receiver: registry.ci.openshift.org/openshift/knative-eventing-heartbeats-receiver:knative-nightly
knative.dev/eventing/cmd/in_memory/channel_controller: registry.ci.openshift.org/openshift/knative-eventing-channel-controller:knative-nightly
knative.dev/eventing/cmd/in_memory/channel_dispatcher: registry.ci.openshift.org/openshift/knative-eventing-channel-dispatcher:knative-nightly
knative.dev/eventing/cmd/mtchannel_broker: registry.ci.openshift.org/openshift/knative-eventing-mtchannel-broker:knative-nightly
knative.dev/eventing/cmd/mtping: registry.ci.openshift.org/openshift/knative-eventing-mtping:knative-nightly
knative.dev/eventing/cmd/pong: registry.ci.openshift.org/openshift/knative-eventing-pong:knative-nightly
knative.dev/eventing/cmd/schema: registry.ci.openshift.org/openshift/knative-eventing-schema:knative-nightly
knative.dev/eventing/cmd/webhook: registry.ci.openshift.org/openshift/knative-eventing-webhook:knative-nightly
knative.dev/eventing/cmd/websocketsource: registry.ci.openshift.org/openshift/knative-eventing-websocketsource:knative-nightly
knative.dev/eventing/test/test_images/event-sender: registry.ci.openshift.org/openshift/knative-eventing-test-event-sender:knative-nightly
knative.dev/eventing/test/test_images/performance: registry.ci.openshift.org/openshift/knative-eventing-test-performance:knative-nightly
knative.dev/eventing/test/test_images/print: registry.ci.openshift.org/openshift/knative-eventing-test-print:knative-nightly
knative.dev/eventing/test/test_images/recordevents: registry.ci.openshift.org/openshift/knative-eventing-test-recordevents:knative-nightly
knative.dev/eventing/test/test_images/request-sender: registry.ci.openshift.org/openshift/knative-eventing-test-request-sender:knative-nightly
knative.dev/eventing/test/test_images/wathola-fetcher: registry.ci.openshift.org/openshift/knative-eventing-test-wathola-fetcher:knative-nightly
knative.dev/eventing/test/test_images/wathola-forwarder: registry.ci.openshift.org/openshift/knative-eventing-test-wathola-forwarder:knative-nightly
knative.dev/eventing/test/test_images/wathola-receiver: registry.ci.openshift.org/openshift/knative-eventing-test-wathola-receiver:knative-nightly
knative.dev/eventing/test/test_images/wathola-sender: registry.ci.openshift.org/openshift/knative-eventing-test-wathola-sender:knative-nightly
knative.dev/pkg/apiextensions/storageversion/cmd/migrate: registry.ci.openshift.org/openshift/knative-eventing-migrate:knative-nightly
knative.dev/reconciler-test/cmd/eventshub: registry.ci.openshift.org/openshift/knative-eventing-test-eventshub:knative-nightly
17 changes: 17 additions & 0 deletions openshift/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

function install_eventing_with_mesh() {
local operator_dir=/tmp/serverless-operator
git clone --branch main https://github.com/openshift-knative/serverless-operator.git $operator_dir

pushd $operator_dir || return $?

export ON_CLUSTER_BUILDS=true
export DOCKER_REPO_OVERRIDE=image-registry.openshift-image-registry.svc:5000/openshift-marketplace

make OPENSHIFT_CI="true" SCALE_UP=5 TRACING_BACKEND=zipkin images install-certmanager install-strimzi install-kafka-with-mesh || return $?

popd || return $?
}

install_eventing_with_mesh || exit 1
85 changes: 85 additions & 0 deletions openshift/patches/01-openshift_tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
diff --git a/test/e2e-common.sh b/test/e2e-common.sh
index 8b67cf7..d690543 100755
--- a/test/e2e-common.sh
+++ b/test/e2e-common.sh
@@ -28,6 +28,8 @@ function run_eventing_core_tests() {
-parallel=12 \
-run TestPingSource \
./test/rekt/ \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

BROKER_TEMPLATES="${KAFKA_BROKER_TEMPLATES}" go_test_e2e \
@@ -35,6 +37,8 @@ function run_eventing_core_tests() {
-parallel=12 \
-run TestBrokerConformance \
./test/rekt/ \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

BROKER_TEMPLATES="${KAFKA_NAMESPACED_BROKER_TEMPLATES}" go_test_e2e \
@@ -42,6 +46,8 @@ function run_eventing_core_tests() {
-parallel=12 \
-run TestBrokerConformance \
./test/rekt/ \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

BROKER_TEMPLATES="${KAFKA_BROKER_TEMPLATES}" go_test_e2e \
@@ -49,6 +55,8 @@ function run_eventing_core_tests() {
-parallel=12 \
-run TestContainerSource \
./test/rekt/ \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

BROKER_TEMPLATES="${KAFKA_BROKER_TEMPLATES}" go_test_e2e \
@@ -56,6 +64,8 @@ function run_eventing_core_tests() {
-parallel=12 \
-run TestSinkBinding \
./test/rekt/ \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

CHANNEL_GROUP_KIND="InMemoryChannel.messaging.knative.dev" \
@@ -65,6 +75,8 @@ function run_eventing_core_tests() {
-parallel=18 \
-run TestChannel \
./test/rekt/ \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

CHANNEL_GROUP_KIND="KafkaChannel.messaging.knative.dev" \
@@ -74,6 +86,8 @@ function run_eventing_core_tests() {
-parallel=18 \
-run TestChannel \
./test/rekt/ \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

popd
@@ -87,6 +101,8 @@ function run_eventing_kafka_broker_tests() {
-parallel=12 \
-run TestKafkaSource \
./test/e2e_new/... \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

BROKER_TEMPLATES="${KAFKA_BROKER_TEMPLATES}" BROKER_CLASS="Kafka" go_test_e2e \
@@ -94,6 +110,8 @@ function run_eventing_kafka_broker_tests() {
-parallel=12 \
-run TestKafkaSink \
./test/e2e_new/... \
+ --images.producer.file="${REPO_ROOT_DIR}/openshift/images.yaml" \
+ --environment.namespace="serverless-tests" \
--istio.enabled=true || return $?

popd
3 changes: 3 additions & 0 deletions openshift/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project:
tag: knative-nightly
imagePrefix: knative-eventing-istio
Loading

0 comments on commit 03f4a63

Please sign in to comment.