Skip to content

Commit 2946c9f

Browse files
Simon Emmsroboquat
Simon Emms
authored andcommitted
[kots]: add firewall check for the pull registry
1 parent 4cb2627 commit 2946c9f

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

install/kots/manifests/kots-preflight.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,32 @@ 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+
# Check that the pull registry is accessible from the cluster
49+
collectorName: ping-registry
50+
image: alpine/curl
51+
name: ping-registry
52+
command:
53+
- /bin/sh
54+
- -c
55+
args:
56+
- |
57+
CONNECTION="error"
58+
59+
if [ '{{repl HasLocalRegistry }}' = "true" ];
60+
then
61+
# Don't test for airgapped
62+
CONNECTION="ok"
63+
else
64+
URL="https://eu.gcr.io/v2/"
65+
echo "ping ${URL}"
66+
if curl --silent --max-time 5 "${URL}" > /dev/null;
67+
then
68+
CONNECTION="ok"
69+
fi
70+
fi
71+
72+
echo "connection: ${CONNECTION}"
4773
analyzers:
4874
- clusterVersion:
4975
outcomes:
@@ -206,3 +232,13 @@ spec:
206232
message: Object storage connection is valid
207233
- fail:
208234
message: Object storage connection is invalid. Please check your settings and that the resource is accessible from your cluster
235+
- textAnalyze:
236+
checkName: Pull registry is accessible from cluster
237+
fileName: ping-registry/ping-registry.log
238+
regexGroups: 'connection: (?P<Connection>\w+)'
239+
outcomes:
240+
- pass:
241+
when: "Connection == ok"
242+
message: Registry is accessible
243+
- fail:
244+
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+
CONNECTION="error"
48+
49+
if [ '{{repl HasLocalRegistry }}' = "true" ];
50+
then
51+
# Don't test for airgapped
52+
CONNECTION="ok"
53+
else
54+
URL="https://eu.gcr.io/v2/"
55+
echo "ping ${URL}"
56+
if curl --silent --max-time 5 "${URL}" > /dev/null;
57+
then
58+
CONNECTION="ok"
59+
fi
60+
fi
61+
62+
echo "connection: ${CONNECTION}"
3863
- clusterInfo: {}
3964
- clusterResources: {}
4065
- logs:

0 commit comments

Comments
 (0)