From e194600119b383e083f52d7d0ea4350267feace3 Mon Sep 17 00:00:00 2001 From: afield Date: Tue, 22 Jun 2021 20:34:30 -0400 Subject: [PATCH] :open_file_folder: Update openshift specific files. --- Makefile | 85 ++ OWNERS | 28 +- openshift/ci-operator/Dockerfile.in | 5 + openshift/ci-operator/build-image/Dockerfile | 13 + .../ci-operator/build-image/kubernetes.repo | 7 + openshift/ci-operator/generate-ci-config.sh | 109 +++ openshift/ci-operator/generate-dockerfiles.sh | 15 + .../consolidated_controller/Dockerfile | 5 + .../consolidated_dispatcher/Dockerfile | 5 + .../distributed_controller/Dockerfile | 5 + .../distributed_dispatcher/Dockerfile | 5 + .../knative-images/mtcontroller/Dockerfile | 5 + .../mtreceive_adapter/Dockerfile | 5 + .../knative-images/receive_adapter/Dockerfile | 5 + .../knative-images/receiver/Dockerfile | 5 + .../source_controller/Dockerfile | 5 + .../knative-images/webhook/Dockerfile | 5 + .../event-sender/Dockerfile | 5 + .../knative-test-images/heartbeats/Dockerfile | 5 + .../kafka-publisher/Dockerfile | 5 + .../kafka_performance/Dockerfile | 5 + .../performance/Dockerfile | 5 + .../knative-test-images/print/Dockerfile | 5 + .../recordevents/Dockerfile | 5 + .../wathola-fetcher/Dockerfile | 5 + .../wathola-forwarder/Dockerfile | 5 + .../wathola-kafka-sender/Dockerfile | 5 + .../wathola-receiver/Dockerfile | 5 + .../wathola-sender/Dockerfile | 5 + openshift/ci-operator/source-image/Dockerfile | 1 + openshift/ci-operator/update-ci.sh | 56 ++ openshift/e2e-common.sh | 190 ++++ openshift/e2e-tests.sh | 31 + openshift/release/create-release-branch.sh | 28 + openshift/release/generate-release.sh | 26 + .../knative-eventing-kafka-channel-ci.yaml | 897 ++++++++++++++++++ ...eventing-kafka-distributed-channel-ci.yaml | 835 ++++++++++++++++ .../knative-eventing-kafka-source-ci.yaml | 457 +++++++++ openshift/release/mirror-upstream-branches.sh | 37 + openshift/release/resolve.sh | 38 + openshift/release/update-to-head.sh | 52 + 41 files changed, 3012 insertions(+), 8 deletions(-) create mode 100644 Makefile create mode 100644 openshift/ci-operator/Dockerfile.in create mode 100644 openshift/ci-operator/build-image/Dockerfile create mode 100644 openshift/ci-operator/build-image/kubernetes.repo create mode 100755 openshift/ci-operator/generate-ci-config.sh create mode 100755 openshift/ci-operator/generate-dockerfiles.sh create mode 100644 openshift/ci-operator/knative-images/consolidated_controller/Dockerfile create mode 100644 openshift/ci-operator/knative-images/consolidated_dispatcher/Dockerfile create mode 100644 openshift/ci-operator/knative-images/distributed_controller/Dockerfile create mode 100644 openshift/ci-operator/knative-images/distributed_dispatcher/Dockerfile create mode 100644 openshift/ci-operator/knative-images/mtcontroller/Dockerfile create mode 100644 openshift/ci-operator/knative-images/mtreceive_adapter/Dockerfile create mode 100644 openshift/ci-operator/knative-images/receive_adapter/Dockerfile create mode 100644 openshift/ci-operator/knative-images/receiver/Dockerfile create mode 100644 openshift/ci-operator/knative-images/source_controller/Dockerfile create mode 100644 openshift/ci-operator/knative-images/webhook/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/event-sender/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/heartbeats/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/kafka-publisher/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/kafka_performance/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/performance/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/print/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/recordevents/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/wathola-fetcher/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/wathola-forwarder/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/wathola-kafka-sender/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/wathola-receiver/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/wathola-sender/Dockerfile create mode 100644 openshift/ci-operator/source-image/Dockerfile create mode 100755 openshift/ci-operator/update-ci.sh create mode 100755 openshift/e2e-common.sh create mode 100755 openshift/e2e-tests.sh create mode 100755 openshift/release/create-release-branch.sh create mode 100755 openshift/release/generate-release.sh create mode 100644 openshift/release/knative-eventing-kafka-channel-ci.yaml create mode 100644 openshift/release/knative-eventing-kafka-distributed-channel-ci.yaml create mode 100644 openshift/release/knative-eventing-kafka-source-ci.yaml create mode 100755 openshift/release/mirror-upstream-branches.sh create mode 100755 openshift/release/resolve.sh create mode 100755 openshift/release/update-to-head.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..6f0e920b3c --- /dev/null +++ b/Makefile @@ -0,0 +1,85 @@ +# This file is needed by kubebuilder but all functionality should exist inside +# the hack/ files. + +CGO_ENABLED=0 +GOOS=linux +# Ignore errors if there are no images. +CORE_IMAGES=$(shell find ./cmd -name main.go ! -path "./cmd/source/controller/*" ! -path "./cmd/channel/distributed/controller/*" ! -path "./cmd/channel/consolidated/controller/*" ! -path "./cmd/channel/consolidated/dispatcher/*" ! -path "./cmd/channel/distributed/dispatcher/*" | sed 's/main.go//') +TEST_IMAGES=$(shell find ./test/test_images ./vendor/knative.dev/eventing/test/test_images -mindepth 1 -maxdepth 1 -type d 2> /dev/null) +KO_DOCKER_REPO=${DOCKER_REPO_OVERRIDE} +BRANCH= +TEST= +IMAGE= + +# Guess location of openshift/release repo. NOTE: override this if it is not correct. +OPENSHIFT=${CURDIR}/../../github.com/openshift/release + +# Build and install commands. +install: + for img in $(CORE_IMAGES); do \ + go install $$img ; \ + done + #Build the controllers/dispatcher with a prefix to avoid problems + go build -o $(GOPATH)/bin/source_controller ./cmd/source/controller/ + go build -o $(GOPATH)/bin/consolidated_controller ./cmd/channel/consolidated/controller/ + go build -o $(GOPATH)/bin/consolidated_dispatcher ./cmd/channel/consolidated/dispatcher/ + go build -o $(GOPATH)/bin/distributed_controller ./cmd/channel/distributed/controller/ + go build -o $(GOPATH)/bin/distributed_dispatcher ./cmd/channel/distributed/dispatcher/ +.PHONY: install + +test-install: + for img in $(TEST_IMAGES); do \ + go install $$img ; \ + done +.PHONY: test-install + +test-e2e: + sh openshift/e2e-tests.sh +.PHONY: test-e2e + +# Requires ko 0.2.0 or newer. +test-images: + for img in $(TEST_IMAGES); do \ + ko resolve --tags=latest -RBf $$img ; \ + done +.PHONY: test-images + +test-image-single: + ko resolve --tags=latest -RBf test/test_images/$(IMAGE) +.PHONY: test-image-single + +# Run make DOCKER_REPO_OVERRIDE= test-e2e-local if test images are available +# in the given repository. Make sure you first build and push them there by running `make test-images`. +# Run make BRANCH= test-e2e-local if test images from the latest CI +# build for this branch should be used. Example: `make BRANCH=knative-v0.14.2 test-e2e-local`. +# If neither DOCKER_REPO_OVERRIDE nor BRANCH are defined the tests will use test images +# from the last nightly build. +# If TEST is defined then only the single test will be run. +test-e2e-local: + ./openshift/e2e-tests-local.sh $(TEST) +.PHONY: test-e2e-local + +# Generate Dockerfiles used by ci-operator. The files need to be committed manually. +generate-dockerfiles: + rm -rf openshift/ci-operator/knative-images/* + ./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/knative-images $(CORE_IMAGES) + ./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/knative-images source_controller + ./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/knative-images distributed_controller + ./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/knative-images distributed_dispatcher + ./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/knative-images consolidated_controller + ./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/knative-images consolidated_dispatcher + + rm -rf openshift/ci-operator/knative-test-images/* + ./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/knative-test-images $(TEST_IMAGES) +.PHONY: generate-dockerfiles + +# Generate an aggregated knative release yaml file, as well as a CI file with replaced image references +generate-release: + ./openshift/release/generate-release.sh $(RELEASE) +.PHONY: generate-release + +# Update CI configuration in the $(OPENSHIFT) directory. +# NOTE: Makes changes outside this repository. +update-ci: + sh ./openshift/ci-operator/update-ci.sh $(OPENSHIFT) $(CORE_IMAGES) +.PHONY: update-ci diff --git a/OWNERS b/OWNERS index 70fed6301e..231fbd9fe2 100644 --- a/OWNERS +++ b/OWNERS @@ -1,11 +1,23 @@ -# Initial set of approvers taken from eventing WG leads, Kafka approvers and original developers of the channel added +# The OWNERS file is used by prow to automatically merge approved PRs. + approvers: -- technical-oversight-committee -- knative-release-leads -- eventing-writers -- eventing-kafka-approvers +- devguyio +- alanfx +- aliok +- lberk +- markusthoemmes +- matzew +- mgencur +- slinkydeveloper +- warrenvw reviewers: -- eventing-writers -- eventing-kafka-approvers - +- devguyio +- alanfx +- aliok +- lberk +- markusthoemmes +- matzew +- mgencur +- slinkydeveloper +- warrenvw diff --git a/openshift/ci-operator/Dockerfile.in b/openshift/ci-operator/Dockerfile.in new file mode 100644 index 0000000000..f71321af52 --- /dev/null +++ b/openshift/ci-operator/Dockerfile.in @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD ${bin} /usr/bin/${bin} +ENTRYPOINT ["/usr/bin/${bin}"] diff --git a/openshift/ci-operator/build-image/Dockerfile b/openshift/ci-operator/build-image/Dockerfile new file mode 100644 index 0000000000..519514a122 --- /dev/null +++ b/openshift/ci-operator/build-image/Dockerfile @@ -0,0 +1,13 @@ +# Dockerfile to bootstrap build and test in openshift-ci + +FROM registry.ci.openshift.org/openshift/release:golang-1.16 + +# Add kubernetes repository +ADD openshift/ci-operator/build-image/kubernetes.repo /etc/yum.repos.d/ + +RUN yum install -y kubectl ansible httpd-tools + +RUN GO111MODULE=on go get github.com/mikefarah/yq/v3 + +# Allow runtime users to add entries to /etc/passwd +RUN chmod g+rw /etc/passwd diff --git a/openshift/ci-operator/build-image/kubernetes.repo b/openshift/ci-operator/build-image/kubernetes.repo new file mode 100644 index 0000000000..65eda50b5b --- /dev/null +++ b/openshift/ci-operator/build-image/kubernetes.repo @@ -0,0 +1,7 @@ +[kubernetes] +name=Kubernetes +baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 +enabled=1 +gpgcheck=1 +repo_gpgcheck=1 +gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg diff --git a/openshift/ci-operator/generate-ci-config.sh b/openshift/ci-operator/generate-ci-config.sh new file mode 100755 index 0000000000..4adb305737 --- /dev/null +++ b/openshift/ci-operator/generate-ci-config.sh @@ -0,0 +1,109 @@ +#!/bin/bash + +branch=${1-'knative-v0.19.1'} +openshift=${2-'4.6'} +promotion_disabled=${3-false} + +if [[ "$branch" == "knative-next" ]]; then + branch="knative-nightly" +fi + +cat < $target_dir/$image_base/Dockerfile + done +} + +generate_dockefiles $@ \ No newline at end of file diff --git a/openshift/ci-operator/knative-images/consolidated_controller/Dockerfile b/openshift/ci-operator/knative-images/consolidated_controller/Dockerfile new file mode 100644 index 0000000000..a8dbe53731 --- /dev/null +++ b/openshift/ci-operator/knative-images/consolidated_controller/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD consolidated_controller /usr/bin/consolidated_controller +ENTRYPOINT ["/usr/bin/consolidated_controller"] diff --git a/openshift/ci-operator/knative-images/consolidated_dispatcher/Dockerfile b/openshift/ci-operator/knative-images/consolidated_dispatcher/Dockerfile new file mode 100644 index 0000000000..9bf983ce40 --- /dev/null +++ b/openshift/ci-operator/knative-images/consolidated_dispatcher/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD consolidated_dispatcher /usr/bin/consolidated_dispatcher +ENTRYPOINT ["/usr/bin/consolidated_dispatcher"] diff --git a/openshift/ci-operator/knative-images/distributed_controller/Dockerfile b/openshift/ci-operator/knative-images/distributed_controller/Dockerfile new file mode 100644 index 0000000000..ea3d5a3cb6 --- /dev/null +++ b/openshift/ci-operator/knative-images/distributed_controller/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD distributed_controller /usr/bin/distributed_controller +ENTRYPOINT ["/usr/bin/distributed_controller"] diff --git a/openshift/ci-operator/knative-images/distributed_dispatcher/Dockerfile b/openshift/ci-operator/knative-images/distributed_dispatcher/Dockerfile new file mode 100644 index 0000000000..c41691b1b0 --- /dev/null +++ b/openshift/ci-operator/knative-images/distributed_dispatcher/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD distributed_dispatcher /usr/bin/distributed_dispatcher +ENTRYPOINT ["/usr/bin/distributed_dispatcher"] diff --git a/openshift/ci-operator/knative-images/mtcontroller/Dockerfile b/openshift/ci-operator/knative-images/mtcontroller/Dockerfile new file mode 100644 index 0000000000..1659c06d98 --- /dev/null +++ b/openshift/ci-operator/knative-images/mtcontroller/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD mtcontroller /usr/bin/mtcontroller +ENTRYPOINT ["/usr/bin/mtcontroller"] diff --git a/openshift/ci-operator/knative-images/mtreceive_adapter/Dockerfile b/openshift/ci-operator/knative-images/mtreceive_adapter/Dockerfile new file mode 100644 index 0000000000..9530595add --- /dev/null +++ b/openshift/ci-operator/knative-images/mtreceive_adapter/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD mtreceive_adapter /usr/bin/mtreceive_adapter +ENTRYPOINT ["/usr/bin/mtreceive_adapter"] diff --git a/openshift/ci-operator/knative-images/receive_adapter/Dockerfile b/openshift/ci-operator/knative-images/receive_adapter/Dockerfile new file mode 100644 index 0000000000..a8a7c83297 --- /dev/null +++ b/openshift/ci-operator/knative-images/receive_adapter/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD receive_adapter /usr/bin/receive_adapter +ENTRYPOINT ["/usr/bin/receive_adapter"] diff --git a/openshift/ci-operator/knative-images/receiver/Dockerfile b/openshift/ci-operator/knative-images/receiver/Dockerfile new file mode 100644 index 0000000000..5de32558e5 --- /dev/null +++ b/openshift/ci-operator/knative-images/receiver/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD receiver /usr/bin/receiver +ENTRYPOINT ["/usr/bin/receiver"] diff --git a/openshift/ci-operator/knative-images/source_controller/Dockerfile b/openshift/ci-operator/knative-images/source_controller/Dockerfile new file mode 100644 index 0000000000..a34141b911 --- /dev/null +++ b/openshift/ci-operator/knative-images/source_controller/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD source_controller /usr/bin/source_controller +ENTRYPOINT ["/usr/bin/source_controller"] diff --git a/openshift/ci-operator/knative-images/webhook/Dockerfile b/openshift/ci-operator/knative-images/webhook/Dockerfile new file mode 100644 index 0000000000..8dd11d46ed --- /dev/null +++ b/openshift/ci-operator/knative-images/webhook/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD webhook /usr/bin/webhook +ENTRYPOINT ["/usr/bin/webhook"] diff --git a/openshift/ci-operator/knative-test-images/event-sender/Dockerfile b/openshift/ci-operator/knative-test-images/event-sender/Dockerfile new file mode 100644 index 0000000000..bcd20cd208 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/event-sender/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD event-sender /usr/bin/event-sender +ENTRYPOINT ["/usr/bin/event-sender"] diff --git a/openshift/ci-operator/knative-test-images/heartbeats/Dockerfile b/openshift/ci-operator/knative-test-images/heartbeats/Dockerfile new file mode 100644 index 0000000000..0685b47899 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/heartbeats/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD heartbeats /usr/bin/heartbeats +ENTRYPOINT ["/usr/bin/heartbeats"] diff --git a/openshift/ci-operator/knative-test-images/kafka-publisher/Dockerfile b/openshift/ci-operator/knative-test-images/kafka-publisher/Dockerfile new file mode 100644 index 0000000000..ecf09f5952 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/kafka-publisher/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD kafka-publisher /usr/bin/kafka-publisher +ENTRYPOINT ["/usr/bin/kafka-publisher"] diff --git a/openshift/ci-operator/knative-test-images/kafka_performance/Dockerfile b/openshift/ci-operator/knative-test-images/kafka_performance/Dockerfile new file mode 100644 index 0000000000..240ee34640 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/kafka_performance/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD kafka_performance /usr/bin/kafka_performance +ENTRYPOINT ["/usr/bin/kafka_performance"] diff --git a/openshift/ci-operator/knative-test-images/performance/Dockerfile b/openshift/ci-operator/knative-test-images/performance/Dockerfile new file mode 100644 index 0000000000..ac46a9e8c4 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/performance/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD performance /usr/bin/performance +ENTRYPOINT ["/usr/bin/performance"] diff --git a/openshift/ci-operator/knative-test-images/print/Dockerfile b/openshift/ci-operator/knative-test-images/print/Dockerfile new file mode 100644 index 0000000000..2139c9a2a4 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/print/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD print /usr/bin/print +ENTRYPOINT ["/usr/bin/print"] diff --git a/openshift/ci-operator/knative-test-images/recordevents/Dockerfile b/openshift/ci-operator/knative-test-images/recordevents/Dockerfile new file mode 100644 index 0000000000..262b014fbf --- /dev/null +++ b/openshift/ci-operator/knative-test-images/recordevents/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD recordevents /usr/bin/recordevents +ENTRYPOINT ["/usr/bin/recordevents"] diff --git a/openshift/ci-operator/knative-test-images/wathola-fetcher/Dockerfile b/openshift/ci-operator/knative-test-images/wathola-fetcher/Dockerfile new file mode 100644 index 0000000000..f2ee2a4d9c --- /dev/null +++ b/openshift/ci-operator/knative-test-images/wathola-fetcher/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD wathola-fetcher /usr/bin/wathola-fetcher +ENTRYPOINT ["/usr/bin/wathola-fetcher"] diff --git a/openshift/ci-operator/knative-test-images/wathola-forwarder/Dockerfile b/openshift/ci-operator/knative-test-images/wathola-forwarder/Dockerfile new file mode 100644 index 0000000000..321ab5cfff --- /dev/null +++ b/openshift/ci-operator/knative-test-images/wathola-forwarder/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD wathola-forwarder /usr/bin/wathola-forwarder +ENTRYPOINT ["/usr/bin/wathola-forwarder"] diff --git a/openshift/ci-operator/knative-test-images/wathola-kafka-sender/Dockerfile b/openshift/ci-operator/knative-test-images/wathola-kafka-sender/Dockerfile new file mode 100644 index 0000000000..fedd01d828 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/wathola-kafka-sender/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD wathola-kafka-sender /usr/bin/wathola-kafka-sender +ENTRYPOINT ["/usr/bin/wathola-kafka-sender"] diff --git a/openshift/ci-operator/knative-test-images/wathola-receiver/Dockerfile b/openshift/ci-operator/knative-test-images/wathola-receiver/Dockerfile new file mode 100644 index 0000000000..0afe134045 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/wathola-receiver/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD wathola-receiver /usr/bin/wathola-receiver +ENTRYPOINT ["/usr/bin/wathola-receiver"] diff --git a/openshift/ci-operator/knative-test-images/wathola-sender/Dockerfile b/openshift/ci-operator/knative-test-images/wathola-sender/Dockerfile new file mode 100644 index 0000000000..2195d9beb8 --- /dev/null +++ b/openshift/ci-operator/knative-test-images/wathola-sender/Dockerfile @@ -0,0 +1,5 @@ +# Do not edit! This file was generate via Makefile +FROM openshift/origin-base + +ADD wathola-sender /usr/bin/wathola-sender +ENTRYPOINT ["/usr/bin/wathola-sender"] diff --git a/openshift/ci-operator/source-image/Dockerfile b/openshift/ci-operator/source-image/Dockerfile new file mode 100644 index 0000000000..c6c622fb95 --- /dev/null +++ b/openshift/ci-operator/source-image/Dockerfile @@ -0,0 +1 @@ +FROM src diff --git a/openshift/ci-operator/update-ci.sh b/openshift/ci-operator/update-ci.sh new file mode 100755 index 0000000000..909b26d505 --- /dev/null +++ b/openshift/ci-operator/update-ci.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# A script that will update the mapping file in github.com/openshift/release + +set -e +readonly TMPDIR=$(mktemp -d knativeEventingPeriodicReporterXXXX -p /tmp/) +fail() { echo; echo "$*"; exit 1; } + +cat >> "$TMPDIR"/reporterConfig < :rainbow: {{else}} :volcano: Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> :volcano: {{end}}' +EOF + + +# Deduce X.Y version from branch name +BRANCH=$(git rev-parse --abbrev-ref HEAD) +VERSION=$(echo $BRANCH | sed -E 's/^.*(v[0-9]+\.[0-9]+|next)|.*/\1/') +test -n "$VERSION" || fail "'$BRANCH' is not a release branch" +VER=$(echo $VERSION | sed 's/\./_/;s/\.[0-9]\+$//') # X_Y form of version + + +# Set up variables for important locations in the openshift/release repo. +OPENSHIFT=$(realpath "$1"); shift +test -d "$OPENSHIFT/.git" || fail "'$OPENSHIFT' is not a git repo" +MIRROR="$OPENSHIFT/core-services/image-mirroring/knative/mapping_knative_${VER}_quay" +CONFIGDIR=$OPENSHIFT/ci-operator/config/openshift-knative/eventing-kafka +test -d "$CONFIGDIR" || fail "'$CONFIGDIR' is not a directory" +PERIODIC_CONFIGDIR=$OPENSHIFT/ci-operator/jobs/openshift-knative/eventing-kafka +test -d "$PERIODIC_CONFIGDIR" || fail "'$PERIODIC_CONFIGDIR' is not a directory" + +# Generate CI config files +CONFIG=$CONFIGDIR/openshift-knative-eventing-kafka-release-$VERSION +PERIODIC_CONFIG=$PERIODIC_CONFIGDIR/openshift-knative-eventing-kafka-release-$VERSION-periodics.yaml +CURDIR=$(dirname $0) +$CURDIR/generate-ci-config.sh knative-$VERSION 4.7 > ${CONFIG}__47.yaml +$CURDIR/generate-ci-config.sh knative-$VERSION 4.8 true > ${CONFIG}__48.yaml + +# Switch to openshift/release to generate PROW files +cd $OPENSHIFT +echo "Generating PROW files in $OPENSHIFT" +make jobs +make ci-operator-config +# We have to do this manually, see: https://docs.ci.openshift.org/docs/how-tos/notification/ +echo "==== Adding reporter_config to periodics ====" +# These version MUST match the ocp version we used above +for OCP_VERSION in 47; do + sed -i "/ name: periodic-ci-openshift-knative-eventing-kafka-release-${VERSION}-${OCP_VERSION}-e2e-aws-ocp-${OCP_VERSION}-continuous\n spec:/ r $TMPDIR/reporterConfig" "$PERIODIC_CONFIG" +done +echo "==== Changes made to $OPENSHIFT ====" +git status +echo "==== Commit changes to $OPENSHIFT and create a PR" diff --git a/openshift/e2e-common.sh b/openshift/e2e-common.sh new file mode 100755 index 0000000000..168af7f2e9 --- /dev/null +++ b/openshift/e2e-common.sh @@ -0,0 +1,190 @@ +#!/usr/bin/env bash + +export EVENTING_NAMESPACE="${EVENTING_NAMESPACE:-knative-eventing}" +export SYSTEM_NAMESPACE=$EVENTING_NAMESPACE +export KNATIVE_DEFAULT_NAMESPACE=$EVENTING_NAMESPACE +export ZIPKIN_NAMESPACE=$EVENTING_NAMESPACE +export CONFIG_TRACING_CONFIG="test/config/config-tracing.yaml" +export STRIMZI_INSTALLATION_CONFIG_TEMPLATE="test/config/100-strimzi-cluster-operator-0.23.0.yaml" +export STRIMZI_INSTALLATION_CONFIG="$(mktemp)" +export KAFKA_INSTALLATION_CONFIG="test/config/100-kafka-ephemeral-triple-2.8.0.yaml" +export KAFKA_USERS_CONFIG="test/config/100-strimzi-users-0.23.0.yaml" +export KAFKA_PLAIN_CLUSTER_URL="my-cluster-kafka-bootstrap.kafka.svc.cluster.local:9092" +readonly KNATIVE_EVENTING_MONITORING_YAML="test/config/monitoring.yaml" +KAFKA_CLUSTER_URL=${KAFKA_PLAIN_CLUSTER_URL} + +function scale_up_workers(){ + local cluster_api_ns="openshift-machine-api" + + oc get machineset -n ${cluster_api_ns} --show-labels + + # Get the name of the first machineset that has at least 1 replica + local machineset + machineset=$(oc get machineset -n ${cluster_api_ns} -o custom-columns="name:{.metadata.name},replicas:{.spec.replicas}" | grep " 1" | head -n 1 | awk '{print $1}') + # Bump the number of replicas to 6 (+ 1 + 1 == 8 workers) + oc patch machineset -n ${cluster_api_ns} "${machineset}" -p '{"spec":{"replicas":6}}' --type=merge + wait_until_machineset_scales_up ${cluster_api_ns} "${machineset}" 6 +} + +# Waits until the machineset in the given namespaces scales up to the +# desired number of replicas +# Parameters: $1 - namespace +# $2 - machineset name +# $3 - desired number of replicas +function wait_until_machineset_scales_up() { + echo -n "Waiting until machineset $2 in namespace $1 scales up to $3 replicas" + for _ in {1..150}; do # timeout after 15 minutes + local available + available=$(oc get machineset -n "$1" "$2" -o jsonpath="{.status.availableReplicas}") + if [[ ${available} -eq $3 ]]; then + echo -e "\nMachineSet $2 in namespace $1 successfully scaled up to $3 replicas" + return 0 + fi + echo -n "." + sleep 6 + done + echo - "Error: timeout waiting for machineset $2 in namespace $1 to scale up to $3 replicas" + return 1 +} + +# Loops until duration (car) is exceeded or command (cdr) returns non-zero +function timeout() { + SECONDS=0; TIMEOUT=$1; shift + while eval $*; do + sleep 5 + [[ $SECONDS -gt $TIMEOUT ]] && echo "ERROR: Timed out" && return 1 + done + return 0 +} + +# Setup zipkin +function install_tracing() { + echo "Installing Zipkin..." + sed "s/\${SYSTEM_NAMESPACE}/${SYSTEM_NAMESPACE}/g" < "${KNATIVE_EVENTING_MONITORING_YAML}" | oc apply -f - + wait_until_pods_running "${SYSTEM_NAMESPACE}" || fail_test "Zipkin inside eventing did not come up" +} + +function install_strimzi(){ + header "Installing Kafka cluster" + oc create namespace kafka || return 1 + sed 's/namespace: .*/namespace: kafka/' ${STRIMZI_INSTALLATION_CONFIG_TEMPLATE} > ${STRIMZI_INSTALLATION_CONFIG} + oc apply -f "${STRIMZI_INSTALLATION_CONFIG}" -n kafka || return 1 + # Wait for the CRD we need to actually be active + oc wait crd --timeout=900s kafkas.kafka.strimzi.io --for=condition=Established || return 1 + + oc apply -f ${KAFKA_INSTALLATION_CONFIG} -n kafka + oc wait kafka --all --timeout=900s --for=condition=Ready -n kafka || return 1 + + # Create some Strimzi Kafka Users + oc apply -f "${KAFKA_USERS_CONFIG}" -n kafka || return 1 +} + +function install_serverless(){ + header "Installing Serverless Operator" + local operator_dir=/tmp/serverless-operator + local failed=0 + git clone --branch release-1.15 https://github.com/openshift-knative/serverless-operator.git $operator_dir || return 1 + # 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 + + ./hack/install.sh && header "Serverless Operator installed successfully" || failed=1 + popd + return $failed +} + +function install_knative_kafka { + install_consolidated_knative_kafka_channel || return 1 + install_knative_kafka_source || return 1 +} + +function install_consolidated_knative_kafka_channel(){ + header "Installing Knative Kafka Channel" + + RELEASE_YAML="openshift/release/knative-eventing-kafka-channel-ci.yaml" + + sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-consolidated-controller|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-consolidated-controller}|g" ${RELEASE_YAML} + sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-consolidated-dispatcher|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-consolidated-dispatcher}|g" ${RELEASE_YAML} + sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-webhook|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-webhook}|g" ${RELEASE_YAML} + + cat ${RELEASE_YAML} \ + | sed "s/REPLACE_WITH_CLUSTER_URL/${KAFKA_CLUSTER_URL}/" \ + | oc apply --filename - + + wait_until_pods_running $EVENTING_NAMESPACE || return 1 +} + +function install_knative_kafka_source(){ + header "Installing Knative Kafka Source" + + RELEASE_YAML="openshift/release/knative-eventing-kafka-source-ci.yaml" + + sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-source-controller|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-source-controller}|g" ${RELEASE_YAML} + sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-receive-adapter|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-receive-adapter}|g" ${RELEASE_YAML} + + cat ${RELEASE_YAML} \ + | oc apply --filename - + + wait_until_pods_running $EVENTING_NAMESPACE || return 1 +} + +function create_auth_secrets() { + create_tls_secrets + create_sasl_secrets +} + +function create_tls_secrets() { + header "Creating TLS Kafka secret" + STRIMZI_CRT=$(oc -n kafka get secret my-cluster-cluster-ca-cert --template='{{index .data "ca.crt"}}' | base64 --decode ) + TLSUSER_CRT=$(oc -n kafka get secret my-tls-user --template='{{index .data "user.crt"}}' | base64 --decode ) + TLSUSER_KEY=$(oc -n kafka get secret my-tls-user --template='{{index .data "user.key"}}' | base64 --decode ) + + sleep 10 + + oc create secret --namespace knative-eventing generic strimzi-tls-secret \ + --from-literal=ca.crt="$STRIMZI_CRT" \ + --from-literal=user.crt="$TLSUSER_CRT" \ + --from-literal=user.key="$TLSUSER_KEY" || return 1 +} + +function create_sasl_secrets() { + header "Creating SASL Kafka secret" + STRIMZI_CRT=$(oc -n kafka get secret my-cluster-cluster-ca-cert --template='{{index .data "ca.crt"}}' | base64 --decode ) + SASL_PASSWD=$(oc -n kafka get secret my-sasl-user --template='{{index .data "password"}}' | base64 --decode ) + + sleep 10 + + oc create secret --namespace knative-eventing generic strimzi-sasl-secret \ + --from-literal=ca.crt="$STRIMZI_CRT" \ + --from-literal=password="$SASL_PASSWD" \ + --from-literal=saslType="SCRAM-SHA-512" \ + --from-literal=user="my-sasl-user" || return 1 +} + +function run_e2e_tests(){ + header "Testing the KafkaChannel with no AUTH" + + # the source tests REQUIRE the secrets, hence we create it here: + create_auth_secrets || return 1 + + oc get ns ${SYSTEM_NAMESPACE} 2>/dev/null || SYSTEM_NAMESPACE="knative-eventing" + oc -n ${SYSTEM_NAMESPACE} patch knativeeventing/knative-eventing --type=merge --patch='{"spec": {"config": { "tracing": {"enable":"true","backend":"zipkin", "zipkin-endpoint":"http://zipkin.'${SYSTEM_NAMESPACE}'.svc.cluster.local:9411/api/v2/spans", "debug":"true", "sample-rate":"1.0"}}}}' + + local test_name="${1:-}" + local run_command="" + local failed=0 + local channels=messaging.knative.dev/v1beta1:KafkaChannel + + local common_opts=" -channels=$channels --kubeconfig $KUBECONFIG --imagetemplate $TEST_IMAGE_TEMPLATE" + if [ -n "$test_name" ]; then + local run_command="-run ^(${test_name})$" + fi + + go_test_e2e -tags=e2e,source -timeout=90m -parallel=12 ./test/e2e \ + "$run_command" \ + $common_opts || failed=$? + + return $failed +} diff --git a/openshift/e2e-tests.sh b/openshift/e2e-tests.sh new file mode 100755 index 0000000000..7d17f055bd --- /dev/null +++ b/openshift/e2e-tests.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# shellcheck disable=SC1090 +source "$(dirname "$0")/../vendor/knative.dev/hack/e2e-tests.sh" +source "$(dirname "$0")/e2e-common.sh" + +set -Eeuox pipefail + +export TEST_IMAGE_TEMPLATE="${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-test-{{.Name}}}" + +env + +scale_up_workers || exit 1 + +failed=0 + +(( !failed )) && install_strimzi || failed=1 + +(( !failed )) && install_serverless || failed=1 + +(( !failed )) && install_knative_kafka || failed=1 + +(( !failed )) && install_tracing || failed=1 + +(( !failed )) && run_e2e_tests || failed=1 + +(( failed )) && dump_cluster_state + +(( failed )) && exit 1 + +success diff --git a/openshift/release/create-release-branch.sh b/openshift/release/create-release-branch.sh new file mode 100755 index 0000000000..fd1405edfb --- /dev/null +++ b/openshift/release/create-release-branch.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Usage: create-release-branch.sh v0.4.1 release-0.4 + +set -ex # Exit immediately on error. + +release=$1 +target=$2 + +# Fetch the latest tags and checkout a new branch from the wanted tag. +git fetch upstream -v --tags +git checkout -b "$target" "$release" + +# Copy the openshift extra files from the OPENSHIFT/main branch. +git fetch openshift main +git checkout openshift/main -- openshift OWNERS Makefile +make generate-dockerfiles +make RELEASE=$release generate-release +git add openshift OWNERS Makefile +git commit -m "Add openshift specific files." + +# Apply patches if present +PATCHES_DIR="$(pwd)/openshift/patches/" +if [ -d "$PATCHES_DIR" ] && [ "$(ls -A "$PATCHES_DIR")" ]; then + git apply openshift/patches/* + make RELEASE=$release generate-release + git commit -am ":fire: Apply carried patches." +fi diff --git a/openshift/release/generate-release.sh b/openshift/release/generate-release.sh new file mode 100755 index 0000000000..63302c4e8c --- /dev/null +++ b/openshift/release/generate-release.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +source $(dirname $0)/resolve.sh + +release=$1 + +source_output_file="openshift/release/knative-eventing-kafka-source-ci.yaml" +channel_output_file="openshift/release/knative-eventing-kafka-channel-ci.yaml" +distributed_channel_output_file="openshift/release/knative-eventing-kafka-distributed-channel-ci.yaml" + +if [ "$release" == "ci" ]; then + image_prefix="registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-" + tag="" +else + image_prefix="registry.ci.openshift.org/openshift/knative-${release}:knative-eventing-kafka-" + tag="" +fi + +# the source parts +resolve_resources config/source/single $source_output_file $image_prefix $tag + +# the channel parts +resolve_resources config/channel/consolidated $channel_output_file $image_prefix $tag + +# the distributed channel parts +resolve_resources config/channel/distributed $distributed_channel_output_file $image_prefix $tag diff --git a/openshift/release/knative-eventing-kafka-channel-ci.yaml b/openshift/release/knative-eventing-kafka-channel-ci.yaml new file mode 100644 index 0000000000..40d211924c --- /dev/null +++ b/openshift/release/knative-eventing-kafka-channel-ci.yaml @@ -0,0 +1,897 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kafka-addressable-resolver + labels: + kafka.eventing.knative.dev/release: devel + duck.knative.dev/addressable: "true" +rules: + - apiGroups: + - messaging.knative.dev + resources: + - kafkachannels + - kafkachannels/status + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kafka-channelable-manipulator + labels: + kafka.eventing.knative.dev/release: devel + duck.knative.dev/channelable: "true" +rules: + - apiGroups: + - messaging.knative.dev + resources: + - kafkachannels + - kafkachannels/status + verbs: + - create + - get + - list + - watch + - update + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kafka-ch-controller + labels: + kafka.eventing.knative.dev/release: devel +rules: + - apiGroups: + - messaging.knative.dev + resources: + - kafkachannels + - kafkachannels/status + verbs: + - get + - list + - watch + - update + - patch + - apiGroups: + - messaging.knative.dev + resources: + - kafkachannels/finalizers + verbs: + - update + - apiGroups: + - "" # Core API group. + resources: + - configmaps + - secrets + verbs: + - get + - list + - watch + - create + - apiGroups: + - "" # Core API group. + resources: + - services + - serviceaccounts + verbs: &everything + - get + - list + - watch + - create + - patch + - update + - apiGroups: + - "" # Core API Group. + resources: + - configmaps + resourceNames: + - kafka-ch-dispatcher + verbs: + - update + - apiGroups: + - "" # Core API Group. + resources: + - events + verbs: + - create + - patch + - update + - apiGroups: + - "" # Core API group. + resources: + - endpoints + - pods + verbs: + - get + - list + - watch + - apiGroups: + - apps + resources: + - deployments + - deployments/status + verbs: *everything + - apiGroups: + - rbac.authorization.k8s.io + resources: + - rolebindings + verbs: *everything + - apiGroups: + - "coordination.k8s.io" + resources: + - leases + verbs: *everything +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kafka-ch-controller + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kafka-ch-dispatcher + labels: + kafka.eventing.knative.dev/release: devel +rules: + - apiGroups: + - messaging.knative.dev + resources: + - kafkachannels + verbs: + - get + - list + - watch + - patch + - apiGroups: + - messaging.knative.dev + resources: + - kafkachannels/status + verbs: + - get + - update + - patch + - apiGroups: + - "" # Core API group. + resources: + - events + verbs: + - create + - patch + - update + - apiGroups: + - messaging.knative.dev + resources: + - kafkachannels + verbs: + - get + - list + - watch + - patch + - apiGroups: + - "" + resources: + - configmaps + - secrets + verbs: + - get + - list + - watch + - apiGroups: + - "" # Core API Group. + resources: + - events + verbs: + - create + - patch + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - patch + - update +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kafka-ch-dispatcher + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kafka-webhook + labels: + kafka.eventing.knative.dev/release: devel +rules: + - apiGroups: + - "" + resources: + - "configmaps" + verbs: + - "get" + - "list" + - "watch" + - apiGroups: + - "" + resources: + - "secrets" + verbs: + - "get" + - "create" + - "list" + - "watch" + - "update" + - apiGroups: + - "apps" + resources: + - "deployments" + verbs: + - "get" + - apiGroups: + - "" + resources: + - "namespaces/finalizers" + verbs: + - "update" + - apiGroups: + - "apps" + resources: + - "deployments/finalizers" + verbs: + - update + - apiGroups: + - "admissionregistration.k8s.io" + resources: + - "mutatingwebhookconfigurations" + - "validatingwebhookconfigurations" + verbs: &everything + - "get" + - "list" + - "create" + - "update" + - "delete" + - "patch" + - "watch" + - apiGroups: + - "messaging.knative.dev" + resources: + - "kafkachannels" + - "kafkachannels/status" + verbs: + - "get" + - "list" + - "watch" + - apiGroups: + - "coordination.k8s.io" + resources: + - "leases" + verbs: *everything + - apiGroups: + - "apiextensions.k8s.io" + resources: + - "customresourcedefinitions" + verbs: + - "get" + - "list" + - "create" + - "update" + - "delete" + - "patch" + - "watch" +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: kafka-ch-controller + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: kafka-ch-controller + namespace: knative-eventing +roleRef: + kind: ClusterRole + name: kafka-ch-controller + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: kafka-ch-dispatcher + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: kafka-ch-dispatcher + namespace: knative-eventing +roleRef: + kind: ClusterRole + name: kafka-ch-dispatcher + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: kafka-webhook + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: kafka-webhook + namespace: knative-eventing +roleRef: + kind: ClusterRole + name: kafka-webhook + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: kafkachannels.messaging.knative.dev + labels: + kafka.eventing.knative.dev/release: devel + knative.dev/crd-install: "true" + messaging.knative.dev/subscribable: "true" + duck.knative.dev/addressable: "true" +spec: + group: messaging.knative.dev + versions: + - name: v1beta1 + served: true + storage: true + subresources: + status: { } + schema: + openAPIV3Schema: + description: 'KafkaChannel is a resource representing a Channel that is backed by a topic of an Apache Kafka cluster.' + type: object + properties: + spec: + description: Spec defines the desired state of the Channel. + type: object + properties: + numPartitions: + description: NumPartitions is the number of partitions of a Kafka topic. By default, it is set to 1. + type: integer + format: int32 + default: 1 + replicationFactor: + description: ReplicationFactor is the replication factor of a Kafka topic. By default, it is set to 1. + type: integer + maximum: 32767 + default: 1 + delivery: + description: DeliverySpec contains the default delivery spec for each subscription to this Channelable. Each subscription delivery spec, if any, overrides this global delivery spec. + type: object + properties: + backoffDelay: + description: 'BackoffDelay is the delay before retrying. More information on Duration format: - https://www.iso.org/iso-8601-date-and-time-format.html - https://en.wikipedia.org/wiki/ISO_8601 For linear policy, backoff delay is backoffDelay*. For exponential policy, backoff delay is backoffDelay*2^.' + type: string + backoffPolicy: + description: BackoffPolicy is the retry backoff policy (linear, exponential). + type: string + deadLetterSink: + description: DeadLetterSink is the sink receiving event that could not be sent to a destination. + type: object + properties: + ref: + description: Ref points to an Addressable. + type: object + properties: + apiVersion: + description: API version of the referent. + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.' + type: string + uri: + description: URI can be an absolute URL(non-empty scheme and non-empty host) pointing to the target or a relative URI. Relative URIs will be resolved using the base URI retrieved from Ref. + type: string + retry: + description: Retry is the minimum number of retries the sender should attempt when sending an event before moving it to the dead letter sink. + type: integer + format: int32 + subscribers: + description: This is the list of subscriptions for this subscribable. + type: array + items: + type: object + properties: + delivery: + description: DeliverySpec contains options controlling the event delivery + type: object + properties: + backoffDelay: + description: 'BackoffDelay is the delay before retrying. More information on Duration format: - https://www.iso.org/iso-8601-date-and-time-format.html - https://en.wikipedia.org/wiki/ISO_8601 For linear policy, backoff delay is backoffDelay*. For exponential policy, backoff delay is backoffDelay*2^.' + type: string + backoffPolicy: + description: BackoffPolicy is the retry backoff policy (linear, exponential). + type: string + deadLetterSink: + description: DeadLetterSink is the sink receiving event that could not be sent to a destination. + type: object + properties: + ref: + description: Ref points to an Addressable. + type: object + properties: + apiVersion: + description: API version of the referent. + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.' + type: string + uri: + description: URI can be an absolute URL(non-empty scheme and non-empty host) pointing to the target or a relative URI. Relative URIs will be resolved using the base URI retrieved from Ref. + type: string + retry: + description: Retry is the minimum number of retries the sender should attempt when sending an event before moving it to the dead letter sink. + type: integer + format: int32 + generation: + description: Generation of the origin of the subscriber with uid:UID. + type: integer + format: int64 + replyUri: + description: ReplyURI is the endpoint for the reply + type: string + subscriberUri: + description: SubscriberURI is the endpoint for the subscriber + type: string + uid: + description: UID is used to understand the origin of the subscriber. + type: string + status: + description: Status represents the current state of the KafkaChannel. This data may be out of date. + type: object + required: + - address + properties: + address: + type: object + required: + - url + properties: + url: + type: string + annotations: + description: Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards. + type: object + x-kubernetes-preserve-unknown-fields: true + conditions: + description: Conditions the latest available observations of a resource's current state. + type: array + items: + type: object + required: + - type + - status + properties: + lastTransitionTime: + description: LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant). + type: string + message: + description: A human readable message indicating details about the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + severity: + description: Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition. + type: string + deadLetterChannel: + description: DeadLetterChannel is a KReference and is set by the channel when it supports native error handling via a channel Failed messages are delivered here. + type: object + properties: + apiVersion: + description: API version of the referent. + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.' + type: string + observedGeneration: + description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller. + type: integer + format: int64 + subscribers: + description: This is the list of subscription's statuses for this channel. + type: array + items: + type: object + properties: + message: + description: A human readable message indicating details of Ready status. + type: string + observedGeneration: + description: Generation of the origin of the subscriber with uid:UID. + type: integer + format: int64 + ready: + description: Status of the subscriber. + type: string + uid: + description: UID is used to understand the origin of the subscriber. + type: string + additionalPrinterColumns: + - name: Ready + type: string + jsonPath: ".status.conditions[?(@.type==\"Ready\")].status" + - name: Reason + type: string + jsonPath: ".status.conditions[?(@.type==\"Ready\")].reason" + - name: URL + type: string + jsonPath: .status.address.url + - name: Age + type: date + jsonPath: .metadata.creationTimestamp + names: + kind: KafkaChannel + plural: kafkachannels + singular: kafkachannel + categories: + - all + - knative + - messaging + - channel + shortNames: + - kc + scope: Namespaced + conversion: + strategy: Webhook + webhook: + conversionReviewVersions: [ "v1", "v1beta1" ] + clientConfig: + service: + name: kafka-webhook + namespace: knative-eventing +--- +apiVersion: v1 +data: + version: 1.0.0 + eventing-kafka: | + kafka: + brokers: REPLACE_WITH_CLUSTER_URL + topic: + defaultNumPartitions: 4 + defaultReplicationFactor: 1 # Cannot exceed the number of Kafka Brokers! + defaultRetentionMillis: 604800000 # 1 week +kind: ConfigMap +metadata: + name: config-kafka + namespace: knative-eventing +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel + role: kafka-webhook +spec: + ports: + - name: https-webhook + port: 443 + targetPort: 8443 + selector: + role: kafka-webhook +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-ch-controller + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +spec: + replicas: 1 + selector: + matchLabels: &labels + messaging.knative.dev/channel: kafka-channel + messaging.knative.dev/role: controller + template: + metadata: + labels: *labels + spec: + serviceAccountName: kafka-ch-controller + containers: + - name: controller + image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-consolidated-controller + env: + - name: CONFIG_LOGGING_NAME + value: config-logging + - name: METRICS_DOMAIN + value: knative.dev/eventing + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: CONFIG_LEADERELECTION_NAME + value: config-leader-election + - name: DISPATCHER_IMAGE + value: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-consolidated-dispatcher + - name: SERVICE_ACCOUNT + value: kafka-ch-dispatcher + ports: + - containerPort: 9090 + name: metrics + volumeMounts: + - name: config-logging + mountPath: /etc/config-logging + volumes: + - name: config-logging + configMap: + name: config-logging +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-ch-dispatcher + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +spec: + replicas: 0 + selector: + matchLabels: + messaging.knative.dev/channel: kafka-channel + messaging.knative.dev/role: dispatcher + template: + metadata: + annotations: + kafka.eventing.knative.dev/configmap-hash: '' + labels: + messaging.knative.dev/channel: kafka-channel + messaging.knative.dev/role: dispatcher + kafka.eventing.knative.dev/release: devel + spec: + containers: + - name: dispatcher + image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-consolidated-dispatcher + env: + - name: SYSTEM_NAMESPACE + value: '' + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: METRICS_DOMAIN + value: knative.dev/eventing + - name: CONFIG_LOGGING_NAME + value: config-logging + - name: CONFIG_LEADERELECTION_NAME + value: config-leader-election + - name: CONTAINER_NAME + value: dispatcher + ports: + - containerPort: 9090 + name: metrics + protocol: TCP + - containerPort: 8081 + name: sub-status + protocol: TCP + volumeMounts: + - name: config-kafka + mountPath: /etc/config-kafka + serviceAccountName: kafka-ch-dispatcher + volumes: + - name: config-kafka + configMap: + name: config-kafka +--- +apiVersion: v1 +kind: Service +metadata: + labels: + messaging.knative.dev/channel: kafka-channel + messaging.knative.dev/role: dispatcher + name: kafka-ch-dispatcher + namespace: knative-eventing +spec: + ports: + - name: http-dispatcher + port: 80 + protocol: TCP + targetPort: 8080 + - name: http-sub-status + port: 8081 + protocol: TCP + targetPort: 8081 + selector: + messaging.knative.dev/channel: kafka-channel + messaging.knative.dev/role: dispatcher +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + name: defaulting.webhook.kafka.messaging.knative.dev + labels: + kafka.eventing.knative.dev/release: devel +webhooks: +- admissionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + name: kafka-webhook + namespace: knative-eventing + sideEffects: None + failurePolicy: Fail + name: defaulting.webhook.kafka.messaging.knative.dev +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + name: validation.webhook.kafka.messaging.knative.dev + labels: + kafka.eventing.knative.dev/release: devel +webhooks: +- admissionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + name: kafka-webhook + namespace: knative-eventing + sideEffects: None + failurePolicy: Fail + name: validation.webhook.kafka.messaging.knative.dev +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +spec: + replicas: 1 + selector: + matchLabels: &labels + app: kafka-webhook + role: kafka-webhook + template: + metadata: + annotations: + sidecar.istio.io/inject: "false" + labels: *labels + spec: + serviceAccountName: kafka-webhook + containers: + - name: kafka-webhook + terminationMessagePolicy: FallbackToLogsOnError + image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-webhook + env: + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: CONFIG_LOGGING_NAME + value: config-logging + - name: METRICS_DOMAIN + value: knative.dev/eventing + - name: WEBHOOK_NAME + value: kafka-webhook + - name: WEBHOOK_PORT + value: "8443" + ports: + - name: https-webhook + containerPort: 8443 + - name: metrics + containerPort: 9090 + - name: profiling + containerPort: 8008 + resources: + requests: + cpu: 100m + memory: 50Mi + limits: + cpu: 200m + memory: 1024Mi + readinessProbe: &probe + periodSeconds: 1 + httpGet: + scheme: HTTPS + port: 8443 + httpHeaders: + - name: k-kubelet-probe + value: "webhook" + livenessProbe: + <<: *probe + initialDelaySeconds: 20 + terminationGracePeriodSeconds: 300 +--- +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + eventing.knative.dev/release: devel +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: kafka-webhook + minReplicas: 1 + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 100 +--- +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + eventing.knative.dev/release: devel +spec: + minAvailable: 80% + selector: + matchLabels: + app: kafka-webhook +--- +apiVersion: v1 +kind: Secret +metadata: + name: messaging-webhook-certs + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel diff --git a/openshift/release/knative-eventing-kafka-distributed-channel-ci.yaml b/openshift/release/knative-eventing-kafka-distributed-channel-ci.yaml new file mode 100644 index 0000000000..bf25714653 --- /dev/null +++ b/openshift/release/knative-eventing-kafka-distributed-channel-ci.yaml @@ -0,0 +1,835 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: eventing-kafka-addressable-resolver + labels: + kafka.eventing.knative.dev/release: devel + duck.knative.dev/addressable: "true" +rules: +- apiGroups: + - messaging.knative.dev + resources: + - kafkachannels + - kafkachannels/status + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + duck.knative.dev/channelable: "true" + kafka.eventing.knative.dev/release: devel + name: kafka-channelable-manipulator +rules: +- apiGroups: + - messaging.knative.dev + resources: + - kafkachannels + - kafkachannels/status + verbs: + - create + - get + - list + - watch + - update + - patch +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: eventing-kafka-channel-controller + labels: + kafka.eventing.knative.dev/release: devel +rules: +- apiGroups: + - "" # Core API Group + resources: + - services + verbs: + - get + - list + - watch + - create + - delete + - patch + - update +- apiGroups: + - apps + resources: + - deployments + verbs: + - get + - list + - watch + - create + - delete + - patch + - update +- apiGroups: + - "" # Core API Group. + resources: + - events + verbs: + - create + - patch + - update +- apiGroups: + - messaging.knative.dev + resources: + - channels + - channels/status + - subscriptions + - subscriptions/status + verbs: + - get + - list + - watch + - patch + - update +- apiGroups: + - messaging.knative.dev + resources: + - kafkachannels + verbs: + - get + - list + - watch + - update + - patch +- apiGroups: + - messaging.knative.dev + resources: + - kafkachannels/status + verbs: + - get + - update + - patch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: eventing-kafka-channel-controller + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +rules: +- apiGroups: + - "" # Core API Group + resources: + - configmaps + - secrets + verbs: + - get + - list + - watch + - update + - patch +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: eventing-kafka-channel-controller + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kafka-webhook + labels: + kafka.eventing.knative.dev/release: devel +rules: + - apiGroups: + - "" + resources: + - "configmaps" + verbs: + - "get" + - "list" + - "watch" + - apiGroups: + - "" + resources: + - "secrets" + verbs: + - "get" + - "create" + - "list" + - "watch" + - "update" + - apiGroups: + - "apps" + resources: + - "deployments" + verbs: + - "get" + - apiGroups: + - "" + resources: + - "namespaces/finalizers" + verbs: + - "update" + - apiGroups: + - "apps" + resources: + - "deployments/finalizers" + verbs: + - update + - apiGroups: + - "admissionregistration.k8s.io" + resources: + - "mutatingwebhookconfigurations" + - "validatingwebhookconfigurations" + verbs: &everything + - "get" + - "list" + - "create" + - "update" + - "delete" + - "patch" + - "watch" + - apiGroups: + - "messaging.knative.dev" + resources: + - "kafkachannels" + - "kafkachannels/status" + verbs: + - "get" + - "list" + - "watch" + - apiGroups: + - "coordination.k8s.io" + resources: + - "leases" + verbs: *everything + - apiGroups: + - "apiextensions.k8s.io" + resources: + - "customresourcedefinitions" + verbs: + - "get" + - "list" + - "create" + - "update" + - "delete" + - "patch" + - "watch" +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: eventing-kafka-channel-controller + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: eventing-kafka-channel-controller + namespace: knative-eventing +roleRef: + kind: ClusterRole + name: eventing-kafka-channel-controller + apiGroup: rbac.authorization.k8s.io +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: eventing-kafka-channel-controller + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: eventing-kafka-channel-controller + namespace: knative-eventing +roleRef: + kind: Role + name: eventing-kafka-channel-controller + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: kafka-webhook + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: kafka-webhook + namespace: knative-eventing +roleRef: + kind: ClusterRole + name: kafka-webhook + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: v1 +data: + version: 1.0.0 + sarama: | + enableLogging: false + config: | + Version: 2.0.0 # Kafka Version Compatibility From Sarama's Supported List (Major.Minor.Patch) + Admin: + Timeout: 10000000000 # 10 seconds + Net: + KeepAlive: 30000000000 # 30 seconds + MaxOpenRequests: 1 # Set to 1 for use with Idempotent Producer + TLS: + Enable: true + SASL: + Enable: true + Version: 1 + Metadata: + RefreshFrequency: 300000000000 # 5 minutes + Consumer: + Offsets: + AutoCommit: + Interval: 5000000000 # 5 seconds + Retention: 604800000000000 # 1 week + Producer: + Idempotent: true # Must be false for Azure EventHubs + RequiredAcks: -1 # -1 = WaitForAll, Most stringent option for "at-least-once" delivery. + eventing-kafka: | + cloudevents: + maxIdleConns: 1000 + maxIdleConnsPerHost: 100 + kafka: + authSecretName: kafka-cluster + authSecretNamespace: knative-eventing + brokers: REPLACE_WITH_CLUSTER_URL + topic: + defaultNumPartitions: 4 + defaultReplicationFactor: 1 # Cannot exceed the number of Kafka Brokers! + defaultRetentionMillis: 604800000 # 1 week + channel: + adminType: kafka # One of "kafka", "azure", "custom" + dispatcher: + cpuRequest: 100m + memoryRequest: 50Mi + receiver: + cpuRequest: 100m + memoryRequest: 50Mi +kind: ConfigMap +metadata: + name: config-kafka + namespace: knative-eventing +--- +apiVersion: v1 +data: + namespace: "" + password: "" + username: "" + sasltype: "" +kind: Secret +metadata: + name: kafka-cluster + namespace: knative-eventing +type: Opaque +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: kafkachannels.messaging.knative.dev + labels: + kafka.eventing.knative.dev/release: devel + knative.dev/crd-install: "true" + messaging.knative.dev/subscribable: "true" + duck.knative.dev/addressable: "true" +spec: + group: messaging.knative.dev + versions: + - name: v1beta1 + served: true + storage: true + subresources: + status: { } + schema: + openAPIV3Schema: + description: 'KafkaChannel is a resource representing a Channel that is backed by a topic of an Apache Kafka cluster.' + type: object + properties: + spec: + description: Spec defines the desired state of the Channel. + type: object + properties: + numPartitions: + description: NumPartitions is the number of partitions of a Kafka topic. By default, it is set to 1. + type: integer + format: int32 + default: 1 + replicationFactor: + description: ReplicationFactor is the replication factor of a Kafka topic. By default, it is set to 1. + type: integer + maximum: 32767 + default: 1 + delivery: + description: DeliverySpec contains the default delivery spec for each subscription to this Channelable. Each subscription delivery spec, if any, overrides this global delivery spec. + type: object + properties: + backoffDelay: + description: 'BackoffDelay is the delay before retrying. More information on Duration format: - https://www.iso.org/iso-8601-date-and-time-format.html - https://en.wikipedia.org/wiki/ISO_8601 For linear policy, backoff delay is backoffDelay*. For exponential policy, backoff delay is backoffDelay*2^.' + type: string + backoffPolicy: + description: BackoffPolicy is the retry backoff policy (linear, exponential). + type: string + deadLetterSink: + description: DeadLetterSink is the sink receiving event that could not be sent to a destination. + type: object + properties: + ref: + description: Ref points to an Addressable. + type: object + properties: + apiVersion: + description: API version of the referent. + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.' + type: string + uri: + description: URI can be an absolute URL(non-empty scheme and non-empty host) pointing to the target or a relative URI. Relative URIs will be resolved using the base URI retrieved from Ref. + type: string + retry: + description: Retry is the minimum number of retries the sender should attempt when sending an event before moving it to the dead letter sink. + type: integer + format: int32 + subscribers: + description: This is the list of subscriptions for this subscribable. + type: array + items: + type: object + properties: + delivery: + description: DeliverySpec contains options controlling the event delivery + type: object + properties: + backoffDelay: + description: 'BackoffDelay is the delay before retrying. More information on Duration format: - https://www.iso.org/iso-8601-date-and-time-format.html - https://en.wikipedia.org/wiki/ISO_8601 For linear policy, backoff delay is backoffDelay*. For exponential policy, backoff delay is backoffDelay*2^.' + type: string + backoffPolicy: + description: BackoffPolicy is the retry backoff policy (linear, exponential). + type: string + deadLetterSink: + description: DeadLetterSink is the sink receiving event that could not be sent to a destination. + type: object + properties: + ref: + description: Ref points to an Addressable. + type: object + properties: + apiVersion: + description: API version of the referent. + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.' + type: string + uri: + description: URI can be an absolute URL(non-empty scheme and non-empty host) pointing to the target or a relative URI. Relative URIs will be resolved using the base URI retrieved from Ref. + type: string + retry: + description: Retry is the minimum number of retries the sender should attempt when sending an event before moving it to the dead letter sink. + type: integer + format: int32 + generation: + description: Generation of the origin of the subscriber with uid:UID. + type: integer + format: int64 + replyUri: + description: ReplyURI is the endpoint for the reply + type: string + subscriberUri: + description: SubscriberURI is the endpoint for the subscriber + type: string + uid: + description: UID is used to understand the origin of the subscriber. + type: string + status: + description: Status represents the current state of the KafkaChannel. This data may be out of date. + type: object + required: + - address + properties: + address: + type: object + required: + - url + properties: + url: + type: string + annotations: + description: Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards. + type: object + x-kubernetes-preserve-unknown-fields: true + conditions: + description: Conditions the latest available observations of a resource's current state. + type: array + items: + type: object + required: + - type + - status + properties: + lastTransitionTime: + description: LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant). + type: string + message: + description: A human readable message indicating details about the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + severity: + description: Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition. + type: string + deadLetterChannel: + description: DeadLetterChannel is a KReference and is set by the channel when it supports native error handling via a channel Failed messages are delivered here. + type: object + properties: + apiVersion: + description: API version of the referent. + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.' + type: string + observedGeneration: + description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller. + type: integer + format: int64 + subscribers: + description: This is the list of subscription's statuses for this channel. + type: array + items: + type: object + properties: + message: + description: A human readable message indicating details of Ready status. + type: string + observedGeneration: + description: Generation of the origin of the subscriber with uid:UID. + type: integer + format: int64 + ready: + description: Status of the subscriber. + type: string + uid: + description: UID is used to understand the origin of the subscriber. + type: string + additionalPrinterColumns: + - name: Ready + type: string + jsonPath: ".status.conditions[?(@.type==\"Ready\")].status" + - name: Reason + type: string + jsonPath: ".status.conditions[?(@.type==\"Ready\")].reason" + - name: URL + type: string + jsonPath: .status.address.url + - name: Age + type: date + jsonPath: .metadata.creationTimestamp + names: + kind: KafkaChannel + plural: kafkachannels + singular: kafkachannel + categories: + - all + - knative + - messaging + - channel + shortNames: + - kc + scope: Namespaced + conversion: + strategy: Webhook + webhook: + conversionReviewVersions: [ "v1", "v1beta1" ] + clientConfig: + service: + name: kafka-webhook + namespace: knative-eventing +--- +apiVersion: v1 +kind: Secret +metadata: + name: messaging-webhook-certs + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +--- +apiVersion: v1 +kind: Service +metadata: + name: eventing-kafka-channel-controller + namespace: knative-eventing + labels: + k8s-app: eventing-kafka-channel-controller + kafka.eventing.knative.dev/release: devel +spec: + selector: + app: eventing-kafka-channel-controller + ports: + - name: metrics + protocol: TCP + port: 8081 + targetPort: 8081 +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel + role: kafka-webhook +spec: + ports: + - name: https-webhook + port: 443 + targetPort: 8443 + selector: + role: kafka-webhook +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: eventing-kafka-channel-controller + namespace: knative-eventing + labels: + app: eventing-kafka-channel-controller + kafka.eventing.knative.dev/release: devel +spec: + replicas: 1 + selector: + matchLabels: + app: eventing-kafka-channel-controller + name: eventing-kafka-channel-controller + template: + metadata: + labels: + app: eventing-kafka-channel-controller + name: eventing-kafka-channel-controller + spec: + serviceAccountName: eventing-kafka-channel-controller + containers: + - name: eventing-kafka + image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-distributed-controller + imagePullPolicy: IfNotPresent # Must be IfNotPresent or Never if used with ko.local + ports: + - containerPort: 8081 + name: metrics + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: CONFIG_LOGGING_NAME + value: config-logging + - name: CONFIG_LEADERELECTION_NAME + value: config-leader-election + - name: SERVICE_ACCOUNT + valueFrom: + fieldRef: + fieldPath: spec.serviceAccountName + - name: METRICS_PORT + value: "8081" + - name: METRICS_DOMAIN + value: "eventing-kafka" + - name: RECEIVER_IMAGE + value: "registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-receiver" + - name: DISPATCHER_IMAGE + value: "registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-distributed-dispatcher" + resources: + requests: + cpu: 20m + memory: 25Mi + volumeMounts: + - name: config-kafka + mountPath: /etc/config-kafka + volumes: + - name: config-kafka + configMap: + name: config-kafka +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +spec: + replicas: 1 + selector: + matchLabels: &labels + app: kafka-webhook + role: kafka-webhook + template: + metadata: + annotations: + sidecar.istio.io/inject: "false" + labels: *labels + spec: + serviceAccountName: kafka-webhook + containers: + - name: kafka-webhook + terminationMessagePolicy: FallbackToLogsOnError + image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-webhook + env: + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: CONFIG_LOGGING_NAME + value: config-logging + - name: METRICS_DOMAIN + value: knative.dev/eventing + - name: WEBHOOK_NAME + value: kafka-webhook + - name: WEBHOOK_PORT + value: "8443" + ports: + - name: https-webhook + containerPort: 8443 + - name: metrics + containerPort: 9090 + - name: profiling + containerPort: 8008 + resources: + requests: + cpu: 100m + memory: 50Mi + limits: + cpu: 200m + memory: 1024Mi + readinessProbe: &probe + periodSeconds: 1 + httpGet: + scheme: HTTPS + port: 8443 + httpHeaders: + - name: k-kubelet-probe + value: "webhook" + livenessProbe: + <<: *probe + initialDelaySeconds: 20 + terminationGracePeriodSeconds: 300 +--- +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + eventing.knative.dev/release: devel +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: kafka-webhook + minReplicas: 1 + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 100 +--- +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: kafka-webhook + namespace: knative-eventing + labels: + eventing.knative.dev/release: devel +spec: + minAvailable: 80% + selector: + matchLabels: + app: kafka-webhook +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + name: defaulting.webhook.kafka.messaging.knative.dev + labels: + kafka.eventing.knative.dev/release: devel +webhooks: +- admissionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + name: kafka-webhook + namespace: knative-eventing + sideEffects: None + failurePolicy: Fail + name: defaulting.webhook.kafka.messaging.knative.dev +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + name: validation.webhook.kafka.messaging.knative.dev + labels: + kafka.eventing.knative.dev/release: devel +webhooks: +- admissionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + name: kafka-webhook + namespace: knative-eventing + sideEffects: None + failurePolicy: Fail + name: validation.webhook.kafka.messaging.knative.dev diff --git a/openshift/release/knative-eventing-kafka-source-ci.yaml b/openshift/release/knative-eventing-kafka-source-ci.yaml new file mode 100644 index 0000000000..b4b3a31760 --- /dev/null +++ b/openshift/release/knative-eventing-kafka-source-ci.yaml @@ -0,0 +1,457 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kafka-controller-manager + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: eventing-sources-kafka-controller + labels: + kafka.eventing.knative.dev/release: devel +rules: +- apiGroups: + - sources.knative.dev + resources: + - kafkasources + - kafkasources/finalizers + verbs: &everything + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - sources.knative.dev + resources: + - kafkasources/status + verbs: + - get + - update + - patch +- apiGroups: + - bindings.knative.dev + resources: + - kafkabindings + - kafkabindings/finalizers + verbs: &everything + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - bindings.knative.dev + resources: + - kafkabindings/status + verbs: + - get + - update + - patch +- apiGroups: + - apps + resources: + - deployments + verbs: *everything +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - events + - configmaps + - secrets + verbs: *everything +- apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - create + - update + - list + - watch + - patch +- apiGroups: + - "" + resources: + - "namespaces/finalizers" + verbs: + - "update" +- apiGroups: + - "coordination.k8s.io" + resources: + - leases + verbs: *everything +- apiGroups: + - "admissionregistration.k8s.io" + resources: + - "mutatingwebhookconfigurations" + - "validatingwebhookconfigurations" + verbs: &everything + - "get" + - "list" + - "create" + - "update" + - "delete" + - "patch" + - "watch" +- apiGroups: + - "apiextensions.k8s.io" + resources: + - "customresourcedefinitions" + verbs: + - "get" + - "list" + - "create" + - "update" + - "delete" + - "patch" + - "watch" +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: eventing-kafka-source-observer + labels: + kafka.eventing.knative.dev/release: devel + duck.knative.dev/source: "true" +rules: +- apiGroups: + - "sources.knative.dev" + resources: + - "kafkasources" + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: eventing-sources-kafka-controller + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: kafka-controller-manager + namespace: knative-eventing +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: eventing-sources-kafka-controller +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: eventing-sources-kafka-controller-addressable-resolver + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: kafka-controller-manager + namespace: knative-eventing +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: addressable-resolver +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: eventing-sources-kafka-controller-podspecable-binding + labels: + kafka.eventing.knative.dev/release: devel +subjects: +- kind: ServiceAccount + name: kafka-controller-manager + namespace: knative-eventing +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: podspecable-binding +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + labels: + kafka.eventing.knative.dev/release: devel + duck.knative.dev/binding: "true" + knative.dev/crd-install: "true" + name: kafkabindings.bindings.knative.dev +spec: + group: bindings.knative.dev + versions: + - name: v1beta1 + served: true + storage: true + subresources: + status: { } + schema: + openAPIV3Schema: + type: object + x-kubernetes-preserve-unknown-fields: true + additionalPrinterColumns: + - name: BootstrapServers + type: string + jsonPath: ".spec.bootstrapServers" + - name: Ready + type: string + jsonPath: ".status.conditions[?(@.type==\"Ready\")].status" + - name: Reason + type: string + jsonPath: ".status.conditions[?(@.type==\"Ready\")].reason" + - name: Age + type: date + jsonPath: .metadata.creationTimestamp + names: + categories: + - all + - knative + - eventing + - bindings + kind: KafkaBinding + plural: kafkabindings + scope: Namespaced + conversion: + strategy: Webhook + webhook: + conversionReviewVersions: [ "v1", "v1beta1" ] + clientConfig: + service: + name: kafka-source-webhook + namespace: knative-eventing +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + labels: + kafka.eventing.knative.dev/release: devel + eventing.knative.dev/source: "true" + duck.knative.dev/source: "true" + knative.dev/crd-install: "true" + annotations: + registry.knative.dev/eventTypes: | + [ + { "type": "dev.knative.kafka.event" } + ] + name: kafkasources.sources.knative.dev +spec: + group: sources.knative.dev + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + x-kubernetes-preserve-unknown-fields: true + subresources: + status: { } + scale: + specReplicasPath: .spec.consumers + statusReplicasPath: .status.consumers + labelSelectorPath: .status.selector + additionalPrinterColumns: + - name: Topics + type: string + jsonPath: ".spec.topics" + - name: BootstrapServers + type: string + jsonPath: ".spec.bootstrapServers" + - name: Ready + type: string + jsonPath: ".status.conditions[?(@.type==\"Ready\")].status" + - name: Reason + type: string + jsonPath: ".status.conditions[?(@.type==\"Ready\")].reason" + - name: Age + type: date + jsonPath: .metadata.creationTimestamp + names: + categories: + - all + - knative + - eventing + - sources + kind: KafkaSource + plural: kafkasources + scope: Namespaced + conversion: + strategy: Webhook + webhook: + conversionReviewVersions: [ "v1", "v1beta1" ] + clientConfig: + service: + name: kafka-source-webhook + namespace: knative-eventing +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka-controller + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel + control-plane: kafka-controller-manager +spec: + selector: + control-plane: kafka-controller-manager + ports: + - name: https-kafka + port: 443 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-controller-manager + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel + control-plane: kafka-controller-manager +spec: + replicas: 1 + selector: + matchLabels: &labels + control-plane: kafka-controller-manager + template: + metadata: + labels: *labels + spec: + serviceAccountName: kafka-controller-manager + containers: + - name: manager + image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-source-controller + env: + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: METRICS_DOMAIN + value: knative.dev/sources + - name: CONFIG_OBSERVABILITY_NAME + value: config-observability + - name: CONFIG_LEADERELECTION_NAME + value: config-leader-election + - name: KAFKA_RA_IMAGE + value: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-kafka-receive-adapter + volumeMounts: + resources: + requests: + cpu: 20m + memory: 20Mi + readinessProbe: &probe + periodSeconds: 1 + httpGet: + scheme: HTTPS + port: 8443 + httpHeaders: + - name: k-kubelet-probe + value: "webhook" + livenessProbe: + <<: *probe + initialDelaySeconds: 20 + serviceAccount: kafka-controller-manager + terminationGracePeriodSeconds: 10 +--- +apiVersion: v1 +kind: Service +metadata: + labels: + role: webhook + kafka.eventing.knative.dev/release: devel + name: kafka-source-webhook + namespace: knative-eventing +spec: + ports: + - name: https-webhook + port: 443 + targetPort: 8443 + selector: + control-plane: kafka-controller-manager +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + name: defaulting.webhook.kafka.sources.knative.dev + labels: + kafka.eventing.knative.dev/release: devel +webhooks: +- admissionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + name: kafka-source-webhook + namespace: knative-eventing + sideEffects: None + failurePolicy: Fail + name: defaulting.webhook.kafka.sources.knative.dev +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + name: kafkabindings.webhook.kafka.sources.knative.dev + labels: + kafka.eventing.knative.dev/release: devel +webhooks: +- admissionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + name: kafka-source-webhook + namespace: knative-eventing + sideEffects: None + failurePolicy: Fail + name: kafkabindings.webhook.kafka.sources.knative.dev +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + name: validation.webhook.kafka.sources.knative.dev + labels: + kafka.eventing.knative.dev/release: devel +webhooks: +- admissionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + name: kafka-source-webhook + namespace: knative-eventing + sideEffects: None + failurePolicy: Fail + name: validation.webhook.kafka.sources.knative.dev +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + name: config.webhook.kafka.sources.knative.dev + labels: + kafka.eventing.knative.dev/release: devel +webhooks: +- admissionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + name: kafka-source-webhook + namespace: knative-eventing + sideEffects: None + failurePolicy: Fail + name: config.webhook.kafka.sources.knative.dev + namespaceSelector: + matchExpressions: + - key: kafka.eventing.knative.dev/release + operator: Exists +--- +apiVersion: v1 +kind: Secret +metadata: + name: kafka-source-webhook-certs + namespace: knative-eventing + labels: + kafka.eventing.knative.dev/release: devel diff --git a/openshift/release/mirror-upstream-branches.sh b/openshift/release/mirror-upstream-branches.sh new file mode 100755 index 0000000000..242f32ca81 --- /dev/null +++ b/openshift/release/mirror-upstream-branches.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Usage: openshift/release/mirror-upstream-branches.sh +# This should be run from the basedir of the repo with no arguments + + +set -ex +readonly TMPDIR=$(mktemp -d knativeEventingBranchingCheckXXXX -p /tmp/) + +git fetch upstream +git fetch openshift + +# We need to seed this with a few releases that, otherwise, would make +# the processing regex less clear with more anomalies +cat >> "$TMPDIR"/midstream_branches < "$TMPDIR"/upstream_branches +git branch --list -a "openshift/release-v0.*" | cut -f3 -d'/' | cut -f2 -d'v' | rev | cut -f2- -d'.' | rev >> "$TMPDIR"/midstream_branches + +sort -o "$TMPDIR"/midstream_branches "$TMPDIR"/midstream_branches +sort -o "$TMPDIR"/upstream_branches "$TMPDIR"/upstream_branches +comm -32 "$TMPDIR"/upstream_branches "$TMPDIR"/midstream_branches > "$TMPDIR"/new_branches + +UPSTREAM_BRANCH=$(cat "$TMPDIR"/new_branches) +if [ -z "$UPSTREAM_BRANCH" ]; then + echo "no new branch, exiting" + exit 0 +fi +echo "found upstream branch: $UPSTREAM_BRANCH" +readonly UPSTREAM_TAG="v$UPSTREAM_BRANCH.0" +readonly MIDSTREAM_BRANCH="release-v$UPSTREAM_BRANCH" +openshift/release/create-release-branch.sh "$UPSTREAM_TAG" "$MIDSTREAM_BRANCH" +# we would check the error code, but we 'set -e', so assume we're fine +git push openshift "$MIDSTREAM_BRANCH" diff --git a/openshift/release/resolve.sh b/openshift/release/resolve.sh new file mode 100755 index 0000000000..1607d9ce0e --- /dev/null +++ b/openshift/release/resolve.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +function resolve_resources(){ + local dir=$1 + local resolved_file_name=$2 + local image_prefix=$3 + local image_tag=$4 + + [[ -n $image_tag ]] && image_tag=":$image_tag" + + echo "Writing resolved yaml to $resolved_file_name" + + > $resolved_file_name + + for yaml in "$dir"/*.yaml; do + echo "---" >> $resolved_file_name + # 1. Prefix test image references with test- + # 2. Rewrite image references + # 3. Remove comment lines + # 4. Remove empty lines + sed -e "s+\(.* image: \)\(knative.dev\)\(.*/\)\(test/\)\(.*\)+\1\2 \3\4test-\5+g" \ + -e "s+ko://++" \ + -e "s+knative-sources+knative-eventing+" \ + -e "s+contrib.eventing.knative.dev/release: devel+contrib.eventing.knative.dev/release: ${release}+" \ + -e "s+knative.dev/eventing-kafka/cmd/source/receive_adapter+${image_prefix}receive-adapter${image_tag}+" \ + -e "s+knative.dev/eventing-kafka/cmd/source/controller+${image_prefix}source-controller${image_tag}+" \ + -e "s+knative.dev/eventing-kafka/cmd/channel/consolidated/controller+${image_prefix}consolidated-controller${image_tag}+" \ + -e "s+knative.dev/eventing-kafka/cmd/channel/consolidated/dispatcher+${image_prefix}consolidated-dispatcher${image_tag}+" \ + -e "s+knative.dev/eventing-kafka/cmd/webhook+${image_prefix}webhook${image_tag}+" \ + -e "s+knative.dev/eventing-kafka/cmd/channel/distributed/controller+${image_prefix}distributed-controller${image_tag}+" \ + -e "s+knative.dev/eventing-kafka/cmd/channel/distributed/receiver+${image_prefix}receiver${image_tag}+" \ + -e "s+knative.dev/eventing-kafka/cmd/channel/distributed/dispatcher+${image_prefix}distributed-dispatcher${image_tag}+" \ + -e "s+\(.* image: \)\(knative.dev\)\(.*/\)\(.*\)+\1${image_prefix}\4${image_tag}+g" \ + -e '/^[ \t]*#/d' \ + -e '/^[ \t]*$/d' \ + "$yaml" >> $resolved_file_name + done +} diff --git a/openshift/release/update-to-head.sh b/openshift/release/update-to-head.sh new file mode 100755 index 0000000000..f53b190afd --- /dev/null +++ b/openshift/release/update-to-head.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +# Synchs the REPO_BRANCH branch to main and then triggers CI +# Usage: update-to-head.sh + +set -e +REPO_NAME="eventing-kafka" +REPO_OWNER_NAME="openshift-knative" +REPO_BRANCH="release-next" +REPO_BRANCH_CI="${REPO_BRANCH}-ci" + +# Check if there's an upstream release we need to mirror downstream +openshift/release/mirror-upstream-branches.sh + +# Reset REPO_BRANCH to upstream/main. +git fetch upstream main +git checkout upstream/main -B ${REPO_BRANCH} + +# Update openshift's main and take all needed files from there. +git fetch openshift main +git checkout openshift/main openshift OWNERS Makefile +make generate-dockerfiles +make RELEASE=ci generate-release +git add openshift OWNERS Makefile +git commit -m ":open_file_folder: Update openshift specific files." + +# Apply patches if present +PATCHES_DIR="$(pwd)/openshift/patches/" +if [ -d "$PATCHES_DIR" ] && [ "$(ls -A "$PATCHES_DIR")" ]; then + git apply openshift/patches/* + make RELEASE=ci generate-release + git commit -am ":fire: Apply carried patches." +fi +git push -f openshift ${REPO_BRANCH} + +# Trigger CI +git checkout ${REPO_BRANCH} -B ${REPO_BRANCH_CI} +date > ci +git add ci +git commit -m ":robot: Triggering CI on branch '${REPO_BRANCH}' after synching to upstream/main" +git push -f openshift ${REPO_BRANCH_CI} + +if hash hub 2>/dev/null; then + # Test if there is already a sync PR in + COUNT=$(hub api -H "Accept: application/vnd.github.v3+json" repos/${REPO_OWNER_NAME}/${REPO_NAME}/pulls --flat \ + | grep -c ":robot: Triggering CI on branch '${REPO_BRANCH}' after synching to upstream/main") || true + if [ "$COUNT" = "0" ]; then + hub pull-request --no-edit -l "kind/sync-fork-to-upstream" -b ${REPO_OWNER_NAME}/${REPO_NAME}:${REPO_BRANCH} -h ${REPO_OWNER_NAME}/${REPO_NAME}:${REPO_BRANCH_CI} + fi +else + echo "hub (https://github.com/github/hub) is not installed, so you'll need to create a PR manually." +fi