Skip to content

Commit 355e5fc

Browse files
authored
Test https-hosts as part of diagnose (#7)
* Test `https-hosts` as part of `diagnose` This helps customers test outbound HTTPS connectivity from the main subnet. This helps assert connectivity (or not) for SSO and VCS integration * update docs
1 parent d48a8c7 commit 355e5fc

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

gitpod-network-check/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ A CLI to check if your network setup is suitable for the installation of Gitpod.
4242
region: eu-central-1
4343
main-subnets: subnet-0554e84f033a64c56, subnet-08584621e7754e505, subnet-094c6fd68aea493b7
4444
pod-subnets: subnet-028d11dce93b8eefc, subnet-04ec8257d95c434b7,subnet-00a83550ce709f39c
45+
https-hosts: accounts.google.com, github.com
4546
```
4647
4748
2. Run the network diagnosis
@@ -79,6 +80,9 @@ A CLI to check if your network setup is suitable for the installation of Gitpod.
7980
INFO[0190] ✅ Sts is available
8081
INFO[0190] ✅ DynamoDB is available
8182
INFO[0191] ✅ S3 is available
83+
INFO[0194] ✅ accounts.google.com is available
84+
INFO[0194] ✅ github.com is available
85+
INFO[0194] ✅ Instances terminated
8286
```
8387

8488
3. Clean up after network diagnosis

gitpod-network-check/cmd/checks.go

+13
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ var checkCommand = &cobra.Command{ // nolint:gochecknoglobals
6969
if err != nil {
7070
return err
7171
}
72+
log.Infof("ℹ️ Main EC2 instances: %v", mainInstanceIds)
7273
InstanceIds = append(InstanceIds, mainInstanceIds...)
7374

7475
log.Infof("ℹ️ Launching EC2 instances in a Pod subnets")
7576
podInstanceIds, err := launchInstances(cmd.Context(), ec2Client, networkConfig.PodSubnets, instanceProfile.Arn)
7677
if err != nil {
7778
return err
7879
}
80+
log.Infof("ℹ️ Pod EC2 instances: %v", podInstanceIds)
7981
InstanceIds = append(InstanceIds, podInstanceIds...)
8082

8183
log.Infof("ℹ️ Waiting for EC2 instances to become ready (can take up to 2 minutes)")
@@ -117,12 +119,23 @@ var checkCommand = &cobra.Command{ // nolint:gochecknoglobals
117119
}
118120
checkServicesAvailability(cmd.Context(), ssmClient, InstanceIds, serviceEndpoints)
119121

122+
log.Infof("ℹ️ Checking if certain AWS Services can be reached from ec2 instances in the main subnet")
120123
serviceEndpointsForMain := map[string]string{
121124
"S3": fmt.Sprintf("https://s3.%s.amazonaws.com", networkConfig.AwsRegion),
122125
"DynamoDB": fmt.Sprintf("https://dynamodb.%s.amazonaws.com", networkConfig.AwsRegion),
123126
}
124127
checkServicesAvailability(cmd.Context(), ssmClient, mainInstanceIds, serviceEndpointsForMain)
125128

129+
httpHosts := map[string]string{}
130+
for _, v := range networkConfig.HttpsHosts {
131+
host := strings.TrimSpace(v)
132+
httpHosts[host] = fmt.Sprintf("https://%s", host)
133+
}
134+
if len(httpHosts) > 0 {
135+
log.Infof("ℹ️ Checking if hosts can be reached with HTTPS from ec2 instances in the main subnets")
136+
}
137+
checkServicesAvailability(cmd.Context(), ssmClient, mainInstanceIds, httpHosts)
138+
126139
return nil
127140
},
128141
}

gitpod-network-check/cmd/root.go

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type NetworkConfig struct {
2222

2323
MainSubnets []string
2424
PodSubnets []string
25+
HttpsHosts []string
2526
}
2627

2728
var networkConfig = NetworkConfig{LogLevel: "INFO"}
@@ -86,6 +87,7 @@ func init() {
8687
networkCheckCmd.PersistentFlags().StringVar(&networkConfig.AwsRegion, "region", "eu-central-1", "AWS Region to create the cell in")
8788
networkCheckCmd.PersistentFlags().StringSliceVar(&networkConfig.MainSubnets, "main-subnets", []string{}, "List of main subnets")
8889
networkCheckCmd.PersistentFlags().StringSliceVar(&networkConfig.PodSubnets, "pod-subnets", []string{}, "List of pod subnets")
90+
networkCheckCmd.PersistentFlags().StringSliceVar(&networkConfig.HttpsHosts, "https-hosts", []string{}, "Hosts to test for outbound HTTPS connectivity")
8991
bindFlags(networkCheckCmd, v)
9092
}
9193

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
log-level: debug # Options: debug, info, warning, error
22
region: eu-central-1
3-
main-subnets: subnet-066f10c3118b91fbf, subnet-01354c88639f6ab5b, subnet-09a1e3e52d326a98c
4-
pod-subnets: subnet-0ee87ba9eb4eb392b, subnet-0ddc62bfffe224a43, subnet-090c0ae61faad3588
3+
main-subnets: subnet-0a195092eb78c7674, subnet-05db6651c2ef39639
4+
pod-subnets: subnet-00a5f0d10253fb33c, subnet-09f658fd789fc9b84
5+
https-hosts: accounts.google.com, github.com

0 commit comments

Comments
 (0)