Skip to content

Commit 50aea57

Browse files
thesurlydevalexellis
authored andcommitted
Add vpcId and subnetId params for EC2 provider. Resolves #91
Signed-off-by: Shane Witbeck <shane@digitalsanctum.com>
1 parent 06992b3 commit 50aea57

6 files changed

Lines changed: 35 additions & 7 deletions

File tree

chart/inlets-operator/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ Parameter | Description | Default
135135
`provider` | Your infrastructure provider - 'digitalocean', 'ec2', 'scaleway', 'packet', or 'gce' | `""`
136136
`region` | The region to provision hosts into | `""`
137137
`zone` | The zone where the exit node is to be provisioned (Used when Google Compute Engine is used as provider) | `us-central1-a`
138+
`vpcId` | The VPC ID to create the exit-server in (EC2) | `""`
139+
`subnetId` | The Subnet ID where the exit-server should be placed (EC2) | `""`
138140
`accessKeyFile` | Read the access key for your infrastructure provider from a file (recommended) | `/var/secrets/inlets/inlets-access-key`
139141
`projectId` | The project ID if using Google Compute Engine or Packet.com as the provider | `""`
140142
`annotatedOnly` | Only create a tunnel for annotated services. | `false`

chart/inlets-operator/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ spec:
3535
- "-access-key-file={{.Values.accessKeyFile}}"
3636
- "-license={{.Values.inletsProLicense}}"
3737
- "-project-id={{.Values.projectID}}"
38+
{{- if .Values.vpcId }}
39+
- "-vpc-id={{.Values.vpcId}}"
40+
{{- end }}
41+
{{- if .Values.subnetId }}
42+
- "-subnet-id={{.Values.subnetId}}"
43+
{{- end }}
3844
{{- if .Values.organizationID }}
3945
- "-organization-id={{.Values.organizationID}}"
4046
{{- end }}

chart/inlets-operator/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ accessKeyFile: "/var/secrets/inlets/inlets-access-key"
2626
# that requires an access key and secret key, such as EC2.
2727
secretKeyFile: ""
2828

29+
# The VPC ID to create the exit-server in (EC2)
30+
vpcId: ""
31+
32+
# The Subnet ID where the exit-server should be placed (EC2)
33+
subnetId: ""
34+
2935
annotatedOnly: false
3036

3137
image: "inlets/inlets-operator:0.9.0"

controller.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,24 @@ func getHostConfig(c *Controller, tunnel *inletsv1alpha1.Tunnel) provision.Basic
580580
inletsPort = inletsPROControlPort
581581
}
582582

583+
var additional = map[string]string{
584+
"inlets-port": strconv.Itoa(inletsPort),
585+
}
586+
587+
if len(c.infraConfig.VpcID) > 0 {
588+
additional["vpc-id"] = c.infraConfig.VpcID
589+
}
590+
591+
if len(c.infraConfig.SubnetID) > 0 {
592+
additional["subnet-id"] = c.infraConfig.SubnetID
593+
}
594+
583595
host = provision.BasicHost{
584-
Name: tunnel.Name,
585-
OS: "ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20191114",
586-
Plan: "t3.micro",
587-
UserData: base64.StdEncoding.EncodeToString([]byte(userData)),
588-
Additional: map[string]string{
589-
"inlets-port": strconv.Itoa(inletsPort),
590-
},
596+
Name: tunnel.Name,
597+
OS: "ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20191114",
598+
Plan: "t3.micro",
599+
UserData: base64.StdEncoding.EncodeToString([]byte(userData)),
600+
Additional: additional,
591601
}
592602
case "civo":
593603
host = provision.BasicHost{

docs/inlets-operator-0.8.8.tgz

127 Bytes
Binary file not shown.

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ type InfraConfig struct {
3939
AccessKey string
4040
SecretKey string
4141
OrganizationID string
42+
VpcID string
43+
SubnetID string
4244
AccessKeyFile string
4345
SecretKeyFile string
4446
ProjectID string
@@ -89,6 +91,8 @@ func main() {
8991
flag.StringVar(&infra.SecretKey, "secret-key", "", "The secret key if using Scaleway or EC2 as the provider")
9092
flag.StringVar(&infra.SecretKeyFile, "secret-key-file", "", "Read the access key for your infrastructure provider from a file (recommended)")
9193
flag.StringVar(&infra.OrganizationID, "organization-id", "", "The organization id if using Scaleway as the provider")
94+
flag.StringVar(&infra.VpcID, "vpc-id", "", "The VPC ID to create the exit-server in (EC2)")
95+
flag.StringVar(&infra.SubnetID, "subnet-id", "", "The Subnet ID where the exit-server should be placed (EC2)")
9296
flag.StringVar(&infra.ProjectID, "project-id", "", "The project ID if using Packet.com, or Google Compute Engine as the provider")
9397
flag.StringVar(&infra.ProConfig.License, "license", "", "Supply a license for use with inlets-pro")
9498
flag.StringVar(&infra.ProConfig.LicenseFile, "license-file", "", "Supply a file to read for the inlets-pro license")

0 commit comments

Comments
 (0)