Skip to content

Commit a810ff7

Browse files
committed
[testsets] Rename misleading testset names, adjust subnet matching
Tool: gitpod/catfood.gitpod.cloud
1 parent 225cb7b commit a810ff7

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

gitpod-network-check/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ A CLI to check if your network setup is suitable for the installation of Gitpod.
3434

3535
1. Preparation
3636

37-
To run a diagnosis of the network that you want to use for Gitpod, the CLI command needs to know the subnets you have chosen to be used as the `Main` subnets and the `Pod` subnets. You can read more about the distinction here in [our docs](https://www.gitpod.io/docs/enterprise/getting-started/networking#2-subnet-separation). The CLI expects to read the IDs of these subnets in a configuration file. By default it tries to read it from a file name `gitpod-network-check.yaml` in your current directory, but you can override this behavior by using the `--config` flag of the CLI.
37+
To run a diagnosis of the network that you want to use for Gitpod, the CLI command needs to know the subnets you have chosen to be used as the `Main` subnets. You can read more about those here in [our docs](https://www.gitpod.io/docs/enterprise/getting-started/networking#2-subnet-separation). The CLI expects to read the IDs of these subnets in a configuration file. By default it tries to read it from a file name `gitpod-network-check.yaml` in your current directory, but you can override this behavior by using the `--config` flag of the CLI.
3838

3939
For the sake of simplicity, let us create a file `gitpod-network-check.yaml` in the current directory and populate it with the subnet IDs and AWS region as shown below:
4040
```yaml
4141
log-level: debug # Options: debug, info, warning, error
4242
region: eu-central-1
4343
main-subnets: subnet-0554e84f033a64c56, subnet-08584621e7754e505, subnet-094c6fd68aea493b7
44-
pod-subnets: subnet-028d11dce93b8eefc, subnet-04ec8257d95c434b7,subnet-00a83550ce709f39c
4544
https-hosts: accounts.google.com, github.com
46-
instance-ami: # put your custom ami id here if you want to use it, otherwise it will using latest ubuntu AMI from aws
4745
api-endpoint: # optional, put your API endpoint regional sub-domain here to test connectivity, like when the execute-api vpc endpoint is not in the same account as Gitpod
46+
47+
## EC2 runner
48+
#instance-ami: # put your custom ami id here if you want to use it, otherwise it will using latest ubuntu AMI from aws
49+
50+
## Lambda runner
4851
# lambda-role-arn: arn:aws:iam::123456789012:role/MyExistingLambdaRole # Optional: Use existing IAM Role for Lambda mode
4952
# lambda-sg-id: sg-0123456789abcdef0 # Optional: Use existing Security Group for Lambda mode
5053
```

gitpod-network-check/cmd/root.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ func init() {
131131
NetworkCheckCmd.PersistentFlags().StringSliceVar(&NetworkConfig.HttpsHosts, "https-hosts", []string{}, "Hosts to test for outbound HTTPS connectivity")
132132
NetworkCheckCmd.PersistentFlags().StringVar(&NetworkConfig.InstanceAMI, "instance-ami", "", "Custom ec2 instance AMI id, if not set will use latest ubuntu")
133133
NetworkCheckCmd.PersistentFlags().StringVar(&NetworkConfig.ApiEndpoint, "api-endpoint", "", "The Gitpod Enterprise control plane's regional API endpoint subdomain")
134-
NetworkCheckCmd.PersistentFlags().StringSliceVar(&Flags.SelectedTestsets, "testsets", []string{"aws-services-pod-subnet", "aws-services-main-subnet", "https-hosts-main-subnet"}, "List of testsets to run (options: aws-services-pod-subnet, aws-services-main-subnet, https-hosts-main-subnet)")
134+
testsetOptions := []string{string(checks.TestsetNameAwsServicesApp), string(checks.TestSetNameAwsServicesSubstrate), string(checks.TestSetNameHttpsHosts)}
135+
NetworkCheckCmd.PersistentFlags().StringSliceVar(&Flags.SelectedTestsets, "testsets", testsetOptions, fmt.Sprintf("List of testsets to run (options: %v)", testsetOptions))
135136
// Rename flag, variable, and update help text
136137
NetworkCheckCmd.PersistentFlags().StringVar(&Flags.RunnerTypeStr, "runner", string(runner.RunnerTypeEC2), fmt.Sprintf("Specify the runner for executing tests (default: %s, options: %s, %s, %s)", runner.RunnerTypeEC2, runner.RunnerTypeEC2, runner.RunnerTypeLambda, runner.RunnerTypeLocal))
137138
// Lambda-specific flags

gitpod-network-check/pkg/checks/types.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ func (nc *NetworkConfig) GetAllSubnets() []Subnet {
4040
type TestsetName string
4141

4242
const (
43-
TestsetNameAwsServicesPodSubnet TestsetName = "aws-services-pod-subnet"
44-
TestSetNameAwsServicesMainSubnet TestsetName = "aws-services-main-subnet"
45-
TestSetNameHttpsHostsMainSubnet TestsetName = "https-hosts-main-subnet"
43+
TestsetNameAwsServicesApp TestsetName = "aws-services-app"
44+
TestSetNameAwsServicesSubstrate TestsetName = "aws-services-substrate"
45+
TestSetNameHttpsHosts TestsetName = "https-hosts"
4646
)
4747

4848
type SubnetType string
@@ -79,10 +79,11 @@ func (sns Subnets) String() string {
7979
return strings.Join(result, ", ")
8080
}
8181

82+
// TODO(gpl) We should re-consider the assignment of the subnet type to a test-set. For BYON, it's actually only all from main only.
8283
type TestSet func(networkConfig *NetworkConfig) (endpoints map[string]string, subnetType SubnetType)
8384

8485
var TestSets = map[TestsetName]TestSet{
85-
TestsetNameAwsServicesPodSubnet: func(networkConfig *NetworkConfig) (map[string]string, SubnetType) {
86+
TestsetNameAwsServicesApp: func(networkConfig *NetworkConfig) (map[string]string, SubnetType) {
8687
return map[string]string{
8788
"SSM": fmt.Sprintf("https://ssm.%s.amazonaws.com", networkConfig.AwsRegion),
8889
"SSMmessages": fmt.Sprintf("https://ssmmessages.%s.amazonaws.com", networkConfig.AwsRegion),
@@ -99,19 +100,21 @@ var TestSets = map[TestsetName]TestSet{
99100
"Sts": fmt.Sprintf("https://sts.%s.amazonaws.com", networkConfig.AwsRegion),
100101
"ECR Api": fmt.Sprintf("https://api.ecr.%s.amazonaws.com", networkConfig.AwsRegion),
101102
"ECR": fmt.Sprintf("https://869456089606.dkr.ecr.%s.amazonaws.com", networkConfig.AwsRegion),
102-
}, SubnetTypePod
103+
}, SubnetTypeMain
103104
},
104-
TestSetNameAwsServicesMainSubnet: func(networkConfig *NetworkConfig) (map[string]string, SubnetType) {
105+
TestSetNameAwsServicesSubstrate: func(networkConfig *NetworkConfig) (map[string]string, SubnetType) {
105106
endpoints := map[string]string{
106107
"S3": fmt.Sprintf("https://s3.%s.amazonaws.com", networkConfig.AwsRegion),
107108
"DynamoDB": fmt.Sprintf("https://dynamodb.%s.amazonaws.com", networkConfig.AwsRegion),
108109
}
109110
if networkConfig.ApiEndpoint != "" {
110111
endpoints["ExecuteAPI"] = fmt.Sprintf("https://%s.execute-api.%s.amazonaws.com", networkConfig.ApiEndpoint, networkConfig.AwsRegion)
112+
} else {
113+
log.Warnf("🚧 No execute-api endpoint provided, skipping test")
111114
}
112115
return endpoints, SubnetTypeMain
113116
},
114-
TestSetNameHttpsHostsMainSubnet: func(networkConfig *NetworkConfig) (map[string]string, SubnetType) {
117+
TestSetNameHttpsHosts: func(networkConfig *NetworkConfig) (map[string]string, SubnetType) {
115118
endpoints := map[string]string{}
116119
for _, v := range networkConfig.HttpsHosts {
117120
host := strings.TrimSpace(v)

0 commit comments

Comments
 (0)