Skip to content

Commit 4510198

Browse files
committed
chore: use imagePullSecrets in tests to avoid Docker Hub rate limiting
This adds a new requirement of having extra environment variables. They are used to create imagePullSecrets to use for our fixtures, thus avoiding getting rate limited by Docker Hub when these images need to be pulled by KinD. This does not solve the rate limiting from inside snyk-monitor using skopeo, which we've seen only very rarely. If that happens then the workaround is to set the dockercfg.json of snyk-monitor with auth details for Docker Hub.
1 parent cf44c9b commit 4510198

18 files changed

+76
-6
lines changed

test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ All integration tests require the Kubernetes-Monitor to be built into an image o
4949
The easiest way to achieve it is by running the `scripts/docker/build-image.sh` script.
5050
Please note that `docker` needs to be installed in order for this script to succeed.
5151

52-
As part of these tests, we attempt pulling and scanning an image hosted on a private GCR registry. For this test case to work, one has to define the following environment variables: `GCR_IO_SERVICE_ACCOUNT`, `GCR_IO_DOCKERCFG`.
52+
As part of these tests, we attempt pulling and scanning an image hosted on a private GCR registry. For this test case to work, one has to define the following environment variables: `GCR_IO_SERVICE_ACCOUNT`, `GCR_IO_DOCKERCFG`, `DOCKER_HUB_RO_USERNAME`, `DOCKER_HUB_RO_PASSWORD`.
5353

5454
Our integration tests may use different Kubernetes platforms to host the Kubernetes-Monitor. These platforms may use an existing cluster, or create a new one. Both decisions are based on the environment variables:
5555
* `TEST_PLATFORM` (`kind`, `kindolm`, `eks`)

test/fixtures/alpine-pod.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ metadata:
66
labels:
77
app: alpine
88
spec:
9+
imagePullSecrets:
10+
- name: docker-io
911
containers:
1012
- name: alpine
1113
image: alpine

test/fixtures/binaries-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ spec:
1515
labels:
1616
app: binaries
1717
spec:
18+
imagePullSecrets:
19+
- name: docker-io
1820
containers:
1921
- name: node
2022
image: node@sha256:215a9fbef4df2c1ceb7c79481d3cfd94ad8f1f0105bade39f3be907bf386c5e1

test/fixtures/centos-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ spec:
1414
labels:
1515
app.kubernetes.io/name: centos
1616
spec:
17+
imagePullSecrets:
18+
- name: docker-io
1719
containers:
1820
- image: centos:7
1921
imagePullPolicy: Always

test/fixtures/consul-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ spec:
1515
labels:
1616
app.kubernetes.io/name: consul
1717
spec:
18+
imagePullSecrets:
19+
- name: docker-io
1820
containers:
1921
- image: snyk/runtime-fixtures:consul
2022
imagePullPolicy: Always

test/fixtures/insecure-registries/push-dockerhub-image-to-local-registry.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ metadata:
55
spec:
66
template:
77
spec:
8+
imagePullSecrets:
9+
- name: docker-io
810
containers:
911
- name: my-container
1012
image: golang:1.13.1-alpine3.10

test/fixtures/java-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ spec:
1515
labels:
1616
app.kubernetes.io/name: java
1717
spec:
18+
imagePullSecrets:
19+
- name: docker-io
1820
containers:
1921
- image: java:latest
2022
imagePullPolicy: Always

test/fixtures/nginx-replicationcontroller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ spec:
1313
labels:
1414
app: nginx
1515
spec:
16+
imagePullSecrets:
17+
- name: docker-io
1618
containers:
1719
- name: nginx
1820
image: nginx

test/fixtures/proxying/tinyproxy-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ spec:
1212
labels:
1313
app: forwarding-proxy
1414
spec:
15+
imagePullSecrets:
16+
- name: docker-io
1517
containers:
1618
- name: forwarding-proxy
1719
image: snyk/runtime-fixtures:tinyproxy

test/fixtures/redis-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ spec:
1515
labels:
1616
app.kubernetes.io/name: redis
1717
spec:
18+
imagePullSecrets:
19+
- name: docker-io
1820
containers:
1921
- image: redis:latest
2022
imagePullPolicy: Always

0 commit comments

Comments
 (0)