Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 46 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,75 @@
[![build status](http://git.tmaws.io/kubernetes/alb-ingress/badges/master/build.svg)](http://git.tmaws.io/kubernetes/alb-ingress/commits/master) [![coverage report](http://git.tmaws.io/kubernetes/alb-ingress/badges/master/coverage.svg)](http://git.tmaws.io/kubernetes/alb-ingress/commits/master)


# ALB Ingress Controller

The ALB ingress controller satisfies Kubernetes [ingress resources](https://kubernetes.io/docs/user-guide/ingress) by provisioning an [Application Load Balancer](https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer) and Route 53 DNS record set.

## Usage
## Installation

The ALB container is installable via `kubectl` or `helm`. Follow one of the two options below.

### kubectl Install

```
kubectl create -f https://raw.githubusercontent.com/coreos/alb-ingress-controller/master/manifests/alb-ingress-controller.yaml
```

Optionally you can install a default backend to handle 404 pages:

TODO
```
kubectl create -f https://raw.githubusercontent.com/coreos/alb-ingress-controller/master/manifests/default-backend.yaml
```

### Helm App Reqistry Install

NOTE: you must have the [Helm App Registry plugin](https://coreos.com/apps) installed for these instructions to work.

```
helm registry install quay.io/coreos/
```

## Annotations

The following annotations, when added to an ingress resource, are respected by the ALB Ingress Controller.
The ALB Ingress Controller is configured by Annotations on the `Ingress` resource object. Some are required and some are optional.

### Required Annotations

```
alb.ingress.kubernetes.io/security-groups
alb.ingress.kubernetes.io/subnets
```

Required annotations use, the namespace is omitted for brevity.

- **security-groups**: Required. [Security groups](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) that should be applied to the ALB instance. Example value: `subnet-a4f0098e,subnet-457ed533,subnet-95c904cd`

- **subnets**: Required. The subnets where the ALB instance should be deployed. Must include 2 subnets, each in a different [availability zone](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html). Example value: `sg-723a380a,sg-a6181ede,sg-a5181edd`

### Optional Annotations

```
alb.ingress.kubernetes.io/backend-protocol
alb.ingress.kubernetes.io/certificate-arn
alb.ingress.kubernetes.io/healthcheck-path
alb.ingress.kubernetes.io/port
alb.ingress.kubernetes.io/scheme
alb.ingress.kubernetes.io/security-groups
alb.ingress.kubernetes.io/subnets
alb.ingress.kubernetes.io/successCodes
alb.ingress.kubernetes.io/tags
```

The following describes each annotations use, namespaces are omitted for brevity.

- **backend-protocol**: Optional. Enables selection of protocol for ALB to use to connect to backend service. When omitted, `HTTP` is used.

- **certificate-arn**: Optional. Enables HTTPS and uses the certificate defined, based on arn, stored in your [AWS Certificate Manager](https://aws.amazon.com/certificate-manager).
Optional annotations use, the namespace is omitted for brevity.

- **healthcheck-path**: Optional. Defines the path ALB health checks will occur. When omitted, `/` is used.
- **backend-protocol**: Enables selection of protocol for ALB to use to connect to backend service. When omitted, `HTTP` is used.

- **port**: Optional. Defines the port the ALB is exposed. When omitted, `80` is used for HTTP and `443` is used for HTTPS.
- **certificate-arn**: Enables HTTPS and uses the certificate defined, based on arn, stored in your [AWS Certificate Manager](https://aws.amazon.com/certificate-manager).

- **scheme**: Required. Defines whether an ALB should be `internal` or `internet-facing`. See [Load balancer scheme] in the AWS documentation for more details.
- **healthcheck-path**: Defines the path ALB health checks will occur. When omitted, `/` is used.

- **security-groups**: Required. [Security groups](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) that should be applied to the ALB instance.
- **port**: Defines the port the ALB is exposed. When omitted, `80` is used for HTTP and `443` is used for HTTPS.

- **subnets**: Required. The subnets where the ALB instance should be deployed. Must include 2 subnets, each in a different [availability zone](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html).
- **scheme**: Defines whether an ALB should be `internal` or `internet-facing`. See [Load balancer scheme] in the AWS documentation for more details.

- **successCodes**: Optional. Defines the HTTP status code that should be expected when doing health checks against the defined `healthcheck-path`. When omitted, `200` is used.
- **successCodes**: Defines the HTTP status code that should be expected when doing health checks against the defined `healthcheck-path`. When omitted, `200` is used.

- **Tags**: Optional. Defines [AWS Tags](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) that should be applied to the ALB instance and Target groups.
- **tags**: Defines [AWS Tags](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) that should be applied to the ALB instance and Target groups.

## Building

Expand Down
19 changes: 19 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Pre-OSS

- Vendor all of the dependencies into the repo
- Hook up to quay.io builds
- Create a helm chart and upload to quay.io
- Create a release script to build all assets

## Post OSS

- Go reportcard

## v1.0

- Automated testing
- Mocked out testing

## Kubernetes Incubator or Upstream

- Ask the upstream ingress team if we can integrate based on their docs/admin.md
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ metadata:
namespace: "2048-game"
annotations:
alb.ingress.kubernetes.io/scheme: internal
alb.ingress.kubernetes.io/subnets: cs-1.preprod,cs-2.preprod,cs-3.preprod
alb.ingress.kubernetes.io/security-groups: preprod.onprem,preprod.cs,preprod.web
alb.ingress.kubernetes.io/subnets: subnet-1234
alb.ingress.kubernetes.io/security-groups: sg-1234
labels:
app: 2048-nginx-ingress
spec:
rules:
- host: 2048.tmaws.io
- host: 2048.example.com
http:
paths:
- path: /
Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions examples/echoservice/echoserver-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: echoserver
namespace: echoserver
annotations:
alb.ingress.kubernetes.io/scheme: internal
alb.ingress.kubernetes.io/subnets: subnet-1234
alb.ingress.kubernetes.io/security-groups: sg-1234
alb.ingress.kubernetes.io/tags: Environment=dev,Team=test
spec:
rules:
- host: echoserver.example.com
http:
paths:
- path: /
backend:
serviceName: echoserver
servicePort: 80
Binary file removed manifests/2048/.2048-ingress.yaml.swp
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
image: 889199535989.dkr.ecr.us-east-1.amazonaws.com/kubernetes/alb-ingress:latest
image: quay.io/coreos/alb-ingress-controller:latest
imagePullPolicy: Always
name: server
resources: {}
Expand Down
19 changes: 0 additions & 19 deletions manifests/echoservice/echoserver-ingress.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions manifests/gopherserv-svc.yaml

This file was deleted.

61 changes: 0 additions & 61 deletions manifests/gopherserv.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions manifests/ingress-resource.yaml

This file was deleted.

25 changes: 6 additions & 19 deletions pkg/cmd/controller/util.go → pkg/awsutil/util.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package controller
package awsutil

import (
"crypto/md5"
Expand All @@ -9,37 +9,24 @@ import (
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/elbv2"
"github.com/karlseguin/ccache"
)

var cache = ccache.New(ccache.Configure())

type AwsStringSlice []*string
type AWSStringSlice []*string
type Tags []*elbv2.Tag
type EC2Tags []*ec2.Tag

func (n AwsStringSlice) Len() int { return len(n) }
func (n AwsStringSlice) Less(i, j int) bool { return *n[i] < *n[j] }
func (n AwsStringSlice) Swap(i, j int) { n[i], n[j] = n[j], n[i] }
func (n AWSStringSlice) Len() int { return len(n) }
func (n AWSStringSlice) Less(i, j int) bool { return *n[i] < *n[j] }
func (n AWSStringSlice) Swap(i, j int) { n[i], n[j] = n[j], n[i] }

func (n Tags) Len() int { return len(n) }
func (n Tags) Less(i, j int) bool { return *n[i].Key < *n[j].Key }
func (n Tags) Swap(i, j int) {
n[i].Key, n[j].Key, n[i].Value, n[j].Value = n[j].Key, n[i].Key, n[j].Value, n[i].Value
}

// GetNodes returns a list of the cluster node external ids
func GetNodes(ac *ALBController) AwsStringSlice {
var result AwsStringSlice
nodes, _ := ac.storeLister.Node.List()
for _, node := range nodes.Items {
result = append(result, aws.String(node.Spec.ExternalID))
}
sort.Sort(result)
return result
}

func (a AwsStringSlice) Hash() *string {
func (a AWSStringSlice) Hash() *string {
sort.Sort(a)
hasher := md5.New()
for _, str := range a {
Expand Down
15 changes: 15 additions & 0 deletions pkg/backendconfig/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package backendconfig

import "k8s.io/ingress/core/pkg/ingress/defaults"

// Configuration represents the configmap data. In core its only used
// to render configuration files, doesn't help us
type Configuration struct {
defaults.Backend `json:",squash"`
}

// NewDefault returns the default configuration
func NewDefault() Configuration {
cfg := Configuration{}
return cfg
}
7 changes: 0 additions & 7 deletions pkg/cmd/controller/config.go

This file was deleted.

Loading