Skip to content

Commit 2397f19

Browse files
author
Simon Emms
committed
[kots]: add firewall check for the pull registry
1 parent 0708df5 commit 2397f19

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

install/kots/manifests/kots-preflight.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ spec:
4444
- '{{repl ConfigOption "store_s3_access_key_id" }}' # S3_ACCESS_KEY_ID
4545
- '{{repl ConfigOption "store_s3_secret_access_key" }}' # S3_SECRET_ACCESS_KEY
4646
- '{{repl ConfigOption "store_s3_bucket" }}' # S3_BUCKET_NAME
47+
- run:
48+
collectorName: ping-registry
49+
image: alpine/curl
50+
name: ping-registry
51+
command:
52+
- /bin/sh
53+
- -c
54+
args:
55+
- |
56+
set -e
57+
58+
URL="https://eu.gcr.io/v2/"
59+
if [ '{{repl HasLocalRegistry }}' = "true" ];
60+
then
61+
URL="{{repl LocalRegistryAddress }}"
62+
fi
63+
64+
echo "URL: ${URL}"
65+
66+
if curl --silent --max-time 5 "${URL}" > /dev/null;
67+
then
68+
echo "connection: ok"
69+
else
70+
echo "connection: error"
71+
fi
4772
analyzers:
4873
- clusterVersion:
4974
outcomes:
@@ -206,3 +231,13 @@ spec:
206231
message: Object storage connection is valid
207232
- fail:
208233
message: Object storage connection is invalid. Please check your settings and that the resource is accessible from your cluster
234+
- textAnalyze:
235+
checkName: Pull registry is accessible from cluster
236+
fileName: ping-registry/ping-registry.log
237+
regexGroups: 'connection: (?P<Connection>\w+)'
238+
outcomes:
239+
- pass:
240+
when: "Connection == ok"
241+
message: Registry is accessible
242+
- fail:
243+
message: Registry is inaccessible. Please check your network and firewall settings

install/kots/manifests/kots-support-bundle.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,31 @@ spec:
3535
- '{{repl ConfigOption "store_s3_access_key_id" }}' # S3_ACCESS_KEY_ID
3636
- '{{repl ConfigOption "store_s3_secret_access_key" }}' # S3_SECRET_ACCESS_KEY
3737
- '{{repl ConfigOption "store_s3_bucket" }}' # S3_BUCKET_NAME
38+
- run:
39+
collectorName: ping-registry
40+
image: alpine/curl
41+
name: ping-registry
42+
command:
43+
- /bin/sh
44+
- -c
45+
args:
46+
- |
47+
set -e
48+
49+
URL="https://eu.gcr.io/v2/"
50+
if [ '{{repl HasLocalRegistry }}' = "true" ];
51+
then
52+
URL="{{repl LocalRegistryAddress }}/v2"
53+
fi
54+
55+
echo "URL: ${URL}"
56+
57+
if curl --silent --max-time 5 "${URL}" > /dev/null;
58+
then
59+
echo "connection: ok"
60+
else
61+
echo "connection: error"
62+
fi
3863
- clusterInfo: {}
3964
- clusterResources: {}
4065
- logs:

0 commit comments

Comments
 (0)