Skip to content

Private link service controller #549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gowrisankar22 opened this issue Dec 3, 2020 · 1 comment
Closed

Private link service controller #549

gowrisankar22 opened this issue Dec 3, 2020 · 1 comment
Labels
kind/new-service Categorizes issue or PR as related to a new service.

Comments

@gowrisankar22
Copy link

gowrisankar22 commented Dec 3, 2020

New ACK Service Controller

Support for [Private link service]

List of API resources

List the API resources in order of importance to you:

  1. [resource 1] https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/ec2#CreateVpcEndpointInput
  2. [resource 2] https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#EC2.CreateVpcEndpoint

It would be great if the operator supports the creation of the securityGroupParts by passing the vpcendpointservice name.

Internally controller should use the vpcids, subnetsids, security groups, and notifiers etc.

CRD spec example:

apiVersion: privatelink.ecr.services.k8s.aws/alphav1
kind: Vpcendpoint
metadata:
  name: vpcendpoint1
  namespace: default
spec:
  parameters:
    servicename: com.amazonaws.vpce.eu-central-1.vpce-svc-xxxxx
  writeConnectionSecretToRef:
    name: vpcendpoint-conn

Code snippets:

package main

import (
	"context"
	"flag"
	"fmt"
	"strings"

	"github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/service/ec2"
	"github.com/aws/aws-sdk-go-v2/service/ec2/types"
	"github.com/aws/aws-sdk-go/aws"
)

func main() {
	vpcID := flag.String("i", "", "The ID of the VPC")
	serviceName := flag.String("n", "", "The name of the service")
	subNets := flag.String("s", "", "A list of subnet IDs, separated by spaces")
	securityGroups := flag.String("g", "", "A list of security group IDs, separated by spaces")
	flag.Parse()

	if *vpcID == "" || *serviceName == "" || *subNets == "" || *securityGroups == "" {
		fmt.Println("You must supply a VPC ID, service name, list of subnet IDs, and list of security group IDs")
		fmt.Println("(-i VPC-ID -n SERVICE-NAME -s \"SUBNET-ID1 ... SUBNET-IDn\" -g \"SECURITY-ID1 ... Security-IDn\"")
		return
	}

	cfg, err := config.LoadDefaultConfig()
	if err != nil {
		panic("configuration error, " + err.Error())
	}

	client := ec2.NewFromConfig(cfg)

	subNetParts := strings.Split(*subNets, " ")
	securityGroupParts := strings.Split(*securityGroups, " ")


	input := &ec2.CreateVpcEndpointInput{
		VpcId:            vpcID,
		ServiceName:      serviceName,
		VpcEndpointType:  types.VpcEndpointTypeInterface,
		SubnetIds:        subNetParts,
		SecurityGroupIds: securityGroupParts,
	}

	resp, err := client.CreateVpcEndpoint(context.Background(), input)
	if err != nil {
		fmt.Println("Got an error creating VPC endpoint:")
		fmt.Println(err)
		return
	}

	fmt.Println("VPC endpoint:")
	fmt.Println(*resp.VpcEndpoint) // See https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/[email protected]/types#VpcEndpoint
}

@gowrisankar22 gowrisankar22 added the kind/new-service Categorizes issue or PR as related to a new service. label Dec 3, 2020
@gowrisankar22 gowrisankar22 changed the title [name] service controller Private link service controller Dec 3, 2020
@jaypipes
Copy link
Collaborator

Hi @gowrisankar22, sorry for the late response! We have VPC Endpoint covered in the EC2 VPC service controller:

#489

Please do 👍 that issue and add a comment in that one with your thoughts on this! Also, for the notifiers stuff, this issue might be of interest to you as well: #292. I'm going to close this one out as a duplicate. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/new-service Categorizes issue or PR as related to a new service.
Projects
None yet
Development

No branches or pull requests

2 participants