Skip to content

Commit 1d1eac4

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

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

install/kots/manifests/kots-preflight.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,29 @@ 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+
URL="https://eu.gcr.io/v2/"
57+
if [ '{{repl HasLocalRegistry }}' = "true" ];
58+
then
59+
URL="{{repl LocalRegistryAddress }}/v2"
60+
fi
61+
62+
echo "URL: ${URL}"
63+
64+
if curl --silent --max-time 5 "${URL}" > /dev/null;
65+
then
66+
echo "connection: ok"
67+
else
68+
echo "connection: error"
69+
fi
4770
analyzers:
4871
- clusterVersion:
4972
outcomes:
@@ -206,3 +229,13 @@ spec:
206229
message: Object storage connection is valid
207230
- fail:
208231
message: Object storage connection is invalid. Please check your settings and that the resource is accessible from your cluster
232+
- textAnalyze:
233+
checkName: Pull registry is accessible from cluster
234+
fileName: ping-registry/ping-registry.log
235+
regexGroups: 'connection: (?P<Connection>\w+)'
236+
outcomes:
237+
- pass:
238+
when: "Connection == ok"
239+
message: Registry is accessible
240+
- fail:
241+
message: Registry is inaccessible. Please check your network and firewall settings

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,29 @@ 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+
URL="https://eu.gcr.io/v2/"
48+
if [ '{{repl HasLocalRegistry }}' = "true" ];
49+
then
50+
URL="{{repl LocalRegistryAddress }}/v2"
51+
fi
52+
53+
echo "URL: ${URL}"
54+
55+
if curl --silent --max-time 5 "${URL}" > /dev/null;
56+
then
57+
echo "connection: ok"
58+
else
59+
echo "connection: error"
60+
fi
3861
- clusterInfo: {}
3962
- clusterResources: {}
4063
- logs:

0 commit comments

Comments
 (0)