Skip to content

Commit

Permalink
📂 Update openshift specific files.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanfx committed Jun 23, 2021
1 parent 98b1b1a commit e194600
Show file tree
Hide file tree
Showing 41 changed files with 3,012 additions and 8 deletions.
85 changes: 85 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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=<your_repo> 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=<ci_promotion_name> 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
28 changes: 20 additions & 8 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions openshift/ci-operator/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -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}"]
13 changes: 13 additions & 0 deletions openshift/ci-operator/build-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions openshift/ci-operator/build-image/kubernetes.repo
Original file line number Diff line number Diff line change
@@ -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
109 changes: 109 additions & 0 deletions openshift/ci-operator/generate-ci-config.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF
tag_specification:
cluster: https://api.ci.openshift.org
name: '$openshift'
namespace: ocp
promotion:
additional_images:
knative-eventing-kafka-src: src
disabled: $promotion_disabled
cluster: https://api.ci.openshift.org
namespace: openshift
name: $branch.0
base_images:
base:
name: '$openshift'
namespace: ocp
tag: base
build_root:
project_image:
dockerfile_path: openshift/ci-operator/build-image/Dockerfile
canonical_go_repository: knative.dev/eventing-kafka
binary_build_commands: make install
test_binary_build_commands: make test-install
tests:
- as: e2e-aws-ocp-${openshift//./}
steps:
cluster_profile: aws
test:
- as: test
cli: latest
commands: make test-e2e
from: src
resources:
requests:
cpu: 100m
workflow: ipi-aws
- as: e2e-aws-ocp-${openshift//./}-continuous
cron: 0 */12 * * 1-5
steps:
cluster_profile: aws
test:
- as: test
cli: latest
commands: make test-e2e
from: src
resources:
requests:
cpu: 100m
workflow: ipi-aws
resources:
'*':
limits:
memory: 6Gi
requests:
cpu: 4
memory: 6Gi
'bin':
limits:
memory: 6Gi
requests:
cpu: 4
memory: 6Gi
images:
EOF

core_images=$(find ./openshift/ci-operator/knative-images -mindepth 1 -maxdepth 1 -type d | LC_COLLATE=posix sort)
for img in $core_images; do
image_base=$(basename $img)
to_image=$(echo ${image_base//[_.]/-})
to_image=$(echo ${to_image//v0/upgrade-v0})
to_image=$(echo ${to_image//migrate/storage-version-migration})
to_image=$(echo ${to_image//kafka-kafka-/kafka-})
cat <<EOF
- dockerfile_path: openshift/ci-operator/knative-images/$image_base/Dockerfile
from: base
inputs:
bin:
paths:
- destination_dir: .
source_path: /go/bin/$image_base
to: knative-eventing-kafka-$to_image
EOF
done

test_images=$(find ./openshift/ci-operator/knative-test-images -mindepth 1 -maxdepth 1 -type d | LC_COLLATE=posix sort)
for img in $test_images; do
image_base=$(basename $img)
to_image=$(echo ${image_base//_/-})
cat <<EOF
- dockerfile_path: openshift/ci-operator/knative-test-images/$image_base/Dockerfile
from: base
inputs:
test-bin:
paths:
- destination_dir: .
source_path: /go/bin/$image_base
to: knative-eventing-kafka-test-$to_image
EOF
done
15 changes: 15 additions & 0 deletions openshift/ci-operator/generate-dockerfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

function generate_dockefiles() {
local target_dir=$1; shift
# Remove old images and re-generate, avoid stale images hanging around.
for img in $@; do
local image_base=$(basename $img)
mkdir -p $target_dir/$image_base
bin=$image_base envsubst < openshift/ci-operator/Dockerfile.in > $target_dir/$image_base/Dockerfile
done
}

generate_dockefiles $@
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/mtcontroller/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/receiver/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/webhook/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-test-images/print/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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"]
Loading

0 comments on commit e194600

Please sign in to comment.