Skip to content

Commit

Permalink
Prow integration test: mac friendly by using port 5001
Browse files Browse the repository at this point in the history
  • Loading branch information
chaodaiG committed Feb 5, 2022
1 parent 685d49d commit 7e71cfd
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 30 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ filegroup(
".git/**",
"*.db",
"*.gz",
"_bin/**",
],
),
visibility = ["//visibility:private"],
Expand Down
16 changes: 8 additions & 8 deletions prow/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ prow_push(
images = image_tags(
targets = {
# Local registry as documented: https://kind.sigs.k8s.io/docs/user/local-registry/
"localhost:5000/sinker": "//prow/cmd/sinker:image",
"localhost:5000/crier": "//prow/cmd/crier:image",
"localhost:5000/hook": "//prow/cmd/hook:image",
"localhost:5000/horologium": "//prow/cmd/horologium:image",
"localhost:5000/prow-controller-manager": "//prow/cmd/prow-controller-manager:image",
"localhost:5000/deck": "//prow/cmd/deck:image",
"localhost:5000/tide": "//prow/cmd/tide:image",
"localhost:5000/fakeghserver": "//prow/test/integration/fakeghserver:image",
"localhost:5001/sinker": "//prow/cmd/sinker:image",
"localhost:5001/crier": "//prow/cmd/crier:image",
"localhost:5001/hook": "//prow/cmd/hook:image",
"localhost:5001/horologium": "//prow/cmd/horologium:image",
"localhost:5001/prow-controller-manager": "//prow/cmd/prow-controller-manager:image",
"localhost:5001/deck": "//prow/cmd/deck:image",
"localhost:5001/tide": "//prow/cmd/tide:image",
"localhost:5001/fakeghserver": "//prow/test/integration/fakeghserver:image",
},
),
)
Expand Down
4 changes: 2 additions & 2 deletions prow/test/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ Delete the local cluster and the local registry.

(Assume the component to be added is named `most-awesome-component`)

* Add `most-awesome-component` at [`testimage-push`](https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/BUILD.bazel#L66) target, so that the component is pushed to `localhost:5000` registry
* Add `most-awesome-component` at [`testimage-push`](https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/BUILD.bazel#L66) target, so that the component is pushed to `localhost:5001` registry
* Deploy `most-awesome-component` during integration test https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/test/integration/setup-cluster.sh#L33, and cleanup the component after integration test https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/test/integration/cleanup.sh#L23
* Add `most-awesome-component` deployment yaml at https://github.com/kubernetes/test-infra/tree/master/prow/test/integration/prow/cluster, so that the deployment works. Modifications involve:
* `most-awesome-component_service.yaml` and `most-awesome-component_rbac.yaml` can be symlinks from https://github.com/kubernetes/test-infra/tree/master/config/prow/cluster.
* `most-awesome-component_deployment.yaml` will at least requires changing image registry to `localhost:5000` like https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/test/integration/prow/cluster/hook_deployment.yaml#L41.
* `most-awesome-component_deployment.yaml` will at least requires changing image registry to `localhost:5001` like https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/test/integration/prow/cluster/hook_deployment.yaml#L41.
* [If using github client] `github-endpoint` should be changed to `fakeghserver`, which was from https://github.com/kubernetes/test-infra/tree/master/prow/test/integration/fakeghserver.
* [If using github client] Existing fake github server only implemented partial github APIs, will need to add APIs that `most-awesome-component` uses at https://github.com/kubernetes/test-infra/tree/master/prow/test/integration/fakeghserver

Expand Down
2 changes: 1 addition & 1 deletion prow/test/integration/prow/cluster/crier_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
terminationGracePeriodSeconds: 30
containers:
- name: crier
image: localhost:5000/crier
image: localhost:5001/crier
args:
- --config-path=/etc/config/config.yaml
- --github-endpoint=http://fakeghserver
Expand Down
2 changes: 1 addition & 1 deletion prow/test/integration/prow/cluster/deck_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
terminationGracePeriodSeconds: 30
containers:
- name: deck
image: localhost:5000/deck
image: localhost:5001/deck
imagePullPolicy: Always
ports:
- name: http
Expand Down
2 changes: 1 addition & 1 deletion prow/test/integration/prow/cluster/fakeghserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: fakeghserver
image: localhost:5000/fakeghserver
image: localhost:5001/fakeghserver
ports:
- containerPort: 8888
---
Expand Down
2 changes: 1 addition & 1 deletion prow/test/integration/prow/cluster/hook_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
terminationGracePeriodSeconds: 180
containers:
- name: hook
image: localhost:5000/hook
image: localhost:5001/hook
imagePullPolicy: Always
args:
- --dry-run=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
terminationGracePeriodSeconds: 30
containers:
- name: horologium
image: localhost:5000/horologium
image: localhost:5001/horologium
args:
- --config-path=/etc/config/config.yaml
- --job-config-path=/etc/job-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
serviceAccountName: prow-controller-manager
containers:
- name: prow-controller-manager
image: localhost:5000/prow-controller-manager
image: localhost:5001/prow-controller-manager
args:
- --config-path=/etc/config/config.yaml
- --dry-run=false
Expand Down
2 changes: 1 addition & 1 deletion prow/test/integration/prow/cluster/sinker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ spec:
args:
- --config-path=/etc/config/config.yaml
- --dry-run=false
image: localhost:5000/sinker
image: localhost:5001/sinker
volumeMounts:
- name: config
mountPath: /etc/config
Expand Down
2 changes: 1 addition & 1 deletion prow/test/integration/prow/cluster/tide_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
serviceAccountName: tide
containers:
- name: tide
image: localhost:5000/tide
image: localhost:5001/tide
args:
- --dry-run=true
- --github-endpoint=http://fakeghserver
Expand Down
2 changes: 1 addition & 1 deletion prow/test/integration/prow/jobs/periodics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ periodics:
- echo
args:
- "Hello World!"
image: localhost:5000/alpine
image: localhost:5001/alpine
8 changes: 4 additions & 4 deletions prow/test/integration/setup-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi
readonly DEFAULT_CLUSTER_NAME="kind-prow-integration"
readonly DEFAULT_CONTEXT="kind-${DEFAULT_CLUSTER_NAME}"
readonly DEFAULT_REGISTRY_NAME="kind-registry"
readonly DEFAULT_REGISTRY_PORT="5000"
readonly DEFAULT_REGISTRY_PORT="5001"
readonly PROW_COMPONENTS="sinker crier hook horologium prow-controller-manager fakeghserver deck tide deck-tenanted"

if [[ -z "${HOME:-}" ]]; then # kubectl looks for HOME which is not set in bazel
Expand All @@ -54,7 +54,7 @@ apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${DEFAULT_REGISTRY_PORT}"]
endpoint = ["http://${DEFAULT_REGISTRY_NAME}:${DEFAULT_REGISTRY_PORT}"]
endpoint = ["http://${DEFAULT_REGISTRY_NAME}:5000"]
nodes:
- role: control-plane
kubeadmConfigPatches:
Expand Down Expand Up @@ -142,8 +142,8 @@ function deploy_prow() {
function push_prow_job_image() {
echo "Push test image to registry"
docker pull gcr.io/k8s-prow/alpine
docker tag gcr.io/k8s-prow/alpine:latest localhost:5000/alpine:latest
docker push localhost:5000/alpine:latest
docker tag gcr.io/k8s-prow/alpine:latest localhost:5001/alpine:latest
docker push localhost:5001/alpine:latest
}

function main() {
Expand Down
4 changes: 2 additions & 2 deletions prow/test/integration/setup-local-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ set -o pipefail
readonly DEFAULT_CLUSTER_NAME="kind-prow-integration"
readonly DEFAULT_CONTEXT="kind-${DEFAULT_CLUSTER_NAME}"
readonly DEFAULT_REGISTRY_NAME="kind-registry"
readonly DEFAULT_REGISTRY_PORT="5000"
readonly DEFAULT_REGISTRY_PORT="5001"

# create registry container unless it already exists
running="$(docker inspect -f '{{.State.Running}}' "${DEFAULT_REGISTRY_NAME}" 2>/dev/null || true)"
if [ "${running}" != 'true' ]; then
echo "Creating docker container for hosting local registry localhost:${DEFAULT_REGISTRY_PORT}"
docker run \
-d --restart=always -p "127.0.0.1:${DEFAULT_REGISTRY_PORT}:${DEFAULT_REGISTRY_PORT}" --name "${DEFAULT_REGISTRY_NAME}" \
-d --restart=always -p "127.0.0.1:${DEFAULT_REGISTRY_PORT}:5000" --name "${DEFAULT_REGISTRY_NAME}" \
registry:2
else
echo "Local registry localhost:${DEFAULT_REGISTRY_PORT} already exist and running."
Expand Down
10 changes: 5 additions & 5 deletions prow/test/integration/test/sinker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestDeletePod(t *testing.T) {
Containers: []corev1.Container{
{
Name: "alpine",
Image: "localhost:5000/alpine",
Image: "localhost:5001/alpine",
Args: []string{
"sleep",
"1000000",
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestDeletePod(t *testing.T) {
Containers: []corev1.Container{
{
Name: "alpine",
Image: "localhost:5000/alpine",
Image: "localhost:5001/alpine",
Args: []string{
"sleep",
"1000000",
Expand Down Expand Up @@ -149,7 +149,7 @@ func TestDeletePod(t *testing.T) {
Containers: []corev1.Container{
{
Name: "alpine",
Image: "localhost:5000/alpine",
Image: "localhost:5001/alpine",
Args: []string{
"sleep",
"1000000",
Expand Down Expand Up @@ -191,7 +191,7 @@ func TestDeletePod(t *testing.T) {
Containers: []corev1.Container{
{
Name: "alpine",
Image: "localhost:5000/alpine",
Image: "localhost:5001/alpine",
Args: []string{
"sleep",
"1000000",
Expand All @@ -214,7 +214,7 @@ func TestDeletePod(t *testing.T) {
Containers: []corev1.Container{
{
Name: "alpine",
Image: "localhost:5000/alpine",
Image: "localhost:5001/alpine",
Args: []string{
"sleep",
"1000000",
Expand Down

0 comments on commit 7e71cfd

Please sign in to comment.