diff --git a/incubator/aws-alb-ingress-controller/.helmignore b/incubator/aws-alb-ingress-controller/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/incubator/aws-alb-ingress-controller/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/incubator/aws-alb-ingress-controller/Chart.yaml b/incubator/aws-alb-ingress-controller/Chart.yaml new file mode 100644 index 0000000000..01aec32ddd --- /dev/null +++ b/incubator/aws-alb-ingress-controller/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +name: aws-alb-ingress-controller +description: A Helm chart for AWS ALB Ingress Controller +version: 0.1.4 +appVersion: "v1.0.1" +engine: gotpl +home: https://github.com/kubernetes-sigs/aws-alb-ingress-controller +sources: + - https://github.com/kubernetes-sigs/aws-alb-ingress-controller +keywords: + - aws + - ingress +maintainers: + - name: bigkraig + email: kraig.amador@ticketmaster.com + - name: M00nF1sh + email: yyyng@amazon.com diff --git a/incubator/aws-alb-ingress-controller/README.md b/incubator/aws-alb-ingress-controller/README.md new file mode 100644 index 0000000000..831753d6b0 --- /dev/null +++ b/incubator/aws-alb-ingress-controller/README.md @@ -0,0 +1,85 @@ +# aws-alb-ingress-controller + +[aws-alb-ingress-controller](https://github.com/kubernetes-sigs/aws-alb-ingress-controller) satisfies Kubernetes ingress resources by provisioning Application Load Balancers. + +## TL;DR: +```bash +helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator +helm install incubator/aws-alb-ingress-controller --set clusterName=MyClusterName --set autoDiscoverAwsRegion=true --set autoDiscoverAwsVpcID=true +``` + +## Introduction + +This chart bootstraps an alb-ingress-controller deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.9+ with Beta APIs enabled + +## Enable helm incubator repository +```bash +helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator +``` + +## Installing the Chart +To install the chart with the release name `my-release` into `kube-system`: + +```bash +helm install incubator/aws-alb-ingress-controller --set clusterName=MyClusterName --set autoDiscoverAwsRegion=true --set autoDiscoverAwsVpcID=true --name my-release --namespace kube-system +``` + +The command deploys alb-ingress-controller on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following tables lists the configurable parameters of the alb-ingress-controller chart and their default values. + +| Parameter | Description | Default | +| ------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `clusterName` | (REQUIRED) Resources created by the ALB Ingress controller will be prefixed with this string | N/A | +| `awsRegion` | AWS region of k8s cluster, required if ec2metadata is unavailable from controller pod | `us-west-2 ` | +| `autoDiscoverAwsRegion` | auto discover awsRegion from ec2metadata, omit awsRegion when this set to true | false | +| `awsVpcID` | AWS VPC ID of k8s cluster, required if ec2metadata is unavailable from controller pod | `vpc-xxx` | +| `autoDiscoverAwsVpcID` | auto discover awsVpcID from ec2metadata, omit awsRegion when this set to true | false | +| `image.repository` | controller container image repository | `894847497797.dkr.ecr.us-west-2.amazonaws.com/aws-alb-ingress-controller` | +| `image.tag` | controller container image tag | `v1.0.1` | +| `image.pullPolicy` | controller container image pull policy | `IfNotPresent` | +| `enableReadinessProbe` | enable readinessProbe on controller pod |`false` | +| `enableLivenessProbe` | enable livenessProbe on controller pod | `false` | +| `extraEnv` | map of environment variables to be injected into the controller pod | `{}` | +| `nodeSelector` | node labels for controller pod assignment | `{}` | +| `tolerations` | controller pod toleration for taints | `{}` | +| `podAnnotations` | annotations to be added to controller pod | `{}` | +| `podLabels` | labels to be added to controller pod | `{}` | +| `resources` | controller pod resource requests & limits | `{}` | +| `rbac.create` | If true, create & use RBAC resources | `true` | +| `rbac.serviceAccountName` | ServiceAccount ALB ingress controller will use (ignored if rbac.create=true) | `default` | +| `scope.ingressClass` | If provided, the ALB ingress controller will only act on Ingress resources annotated with this class | `alb` | +| `scope.singleNamespace` | If true, the ALB ingress controller will only act on Ingress resources in a single namespace | `false` (watch all namespaces) | +| `scope.watchNamespace` | If scope.singleNamespace=true, the ALB ingress controller will only act on Ingress resources in this namespace | `""` (namespace of the ALB ingress controller) | + +```bash +helm install incubator/aws-alb-ingress-controller --set clusterName=MyClusterName --set autoDiscoverAwsRegion=true --set autoDiscoverAwsVpcID=true --name my-release --namespace kube-system +``` + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +helm install incubator/aws-alb-ingress-controller --name my-release -f values.yaml +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +> **Tip**: If you use `aws-alb-ingress-controller` as releaseName, the generated pod name will be shorter.(e.g. `aws-alb-ingress-controller-66cc9fb67c-7mg4w` instead of `my-release-aws-alb-ingress-controller-66cc9fb67c-7mg4w`) \ No newline at end of file diff --git a/incubator/aws-alb-ingress-controller/templates/NOTES.txt b/incubator/aws-alb-ingress-controller/templates/NOTES.txt new file mode 100644 index 0000000000..485a54f640 --- /dev/null +++ b/incubator/aws-alb-ingress-controller/templates/NOTES.txt @@ -0,0 +1,23 @@ +To verify that alb-ingress-controller has started, run: + + kubectl --namespace={{ .Release.Namespace }} get pods -l "app.kubernetes.io/name={{ include "aws-alb-ingress-controller.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" + +An example Ingress that makes use of the controller: + + apiVersion: extensions/v1beta1 + kind: Ingress + metadata: + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/subnets: subnet-a4f0098e,subnet-457ed533,subnet-95c904cd + name: example + namespace: foo + spec: + rules: + - host: www.example.com + http: + paths: + - path: / + backend: + serviceName: exampleService + servicePort: 80 diff --git a/incubator/aws-alb-ingress-controller/templates/_helpers.tpl b/incubator/aws-alb-ingress-controller/templates/_helpers.tpl new file mode 100644 index 0000000000..7eb0c6eaab --- /dev/null +++ b/incubator/aws-alb-ingress-controller/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "aws-alb-ingress-controller.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "aws-alb-ingress-controller.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "aws-alb-ingress-controller.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/incubator/aws-alb-ingress-controller/templates/clusterrole.yaml b/incubator/aws-alb-ingress-controller/templates/clusterrole.yaml new file mode 100644 index 0000000000..1869a71a43 --- /dev/null +++ b/incubator/aws-alb-ingress-controller/templates/clusterrole.yaml @@ -0,0 +1,42 @@ +{{- if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "aws-alb-ingress-controller.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "aws-alb-ingress-controller.name" . }} + helm.sh/chart: {{ include "aws-alb-ingress-controller.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +rules: + - apiGroups: + - "" + - extensions + resources: + - configmaps + - endpoints + - events + - ingresses + - ingresses/status + - services + verbs: + - create + - get + - list + - update + - watch + - patch + - apiGroups: + - "" + - extensions + resources: + - nodes + - pods + - secrets + - services + - namespaces + verbs: + - get + - list + - watch +{{- end }} diff --git a/incubator/aws-alb-ingress-controller/templates/clusterrolebinding.yaml b/incubator/aws-alb-ingress-controller/templates/clusterrolebinding.yaml new file mode 100644 index 0000000000..d0130e06f8 --- /dev/null +++ b/incubator/aws-alb-ingress-controller/templates/clusterrolebinding.yaml @@ -0,0 +1,19 @@ +{{- if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "aws-alb-ingress-controller.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "aws-alb-ingress-controller.name" . }} + helm.sh/chart: {{ include "aws-alb-ingress-controller.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "aws-alb-ingress-controller.fullname" . }} +subjects: + - kind: ServiceAccount + name: {{ include "aws-alb-ingress-controller.fullname" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/incubator/aws-alb-ingress-controller/templates/deployment.yaml b/incubator/aws-alb-ingress-controller/templates/deployment.yaml new file mode 100644 index 0000000000..212ac6d31f --- /dev/null +++ b/incubator/aws-alb-ingress-controller/templates/deployment.yaml @@ -0,0 +1,93 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "aws-alb-ingress-controller.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "aws-alb-ingress-controller.name" . }} + helm.sh/chart: {{ include "aws-alb-ingress-controller.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "aws-alb-ingress-controller.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "aws-alb-ingress-controller.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{- if .Values.podLabels }} +{{ toYaml .Values.podLabels | indent 8}} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8}} + {{- end }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - --cluster-name={{ required "specify clusterName via --set clusterName=YourClusterName" .Values.clusterName }} + {{- if .Values.scope.ingressClass }} + - --ingress-class={{ .Values.scope.ingressClass }} + {{- end }} + {{- if .Values.scope.singleNamespace }} + - --watch-namespace={{ default .Release.Namespace .Values.scope.watchNamespace }} + {{- end }} + {{ if not .Values.autoDiscoverAwsRegion }} + - --aws-region={{ .Values.awsRegion }} + {{- end }} + {{- if not .Values.autoDiscoverAwsVpcID }} + - --aws-vpc-id={{ .Values.awsVpcID }} + {{- end }} + {{- range $key, $value := .Values.extraArgs }} + - --{{ $key }}={{ $value }} + {{- end }} + env: + {{- range $key, $value := .Values.extraEnv }} + - name: {{ $key }} + value: "{{ $value }}" + {{- end }} + ports: + - name: health + containerPort: 10254 + protocol: TCP + {{- if .Values.enableReadinessProbe }} + readinessProbe: + httpGet: + path: /healthz + port: health + scheme: HTTP + initialDelaySeconds: {{ .Values.readinessProbeInitialDelay }} + periodSeconds: {{ .Values.readinessProbeInterval }} + timeoutSeconds: {{ .Values.readinessProbeTimeout }} + {{- end }} + {{- if .Values.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /healthz + port: health + scheme: HTTP + initialDelaySeconds: {{ add .Values.livenessProbeInitialDelay .Values.readinessProbeInitialDelay }} + periodSeconds: 60 + {{- end }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} + serviceAccountName: {{ if .Values.rbac.create }}{{ include "aws-alb-ingress-controller.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }} + terminationGracePeriodSeconds: 60 diff --git a/incubator/aws-alb-ingress-controller/templates/serviceaccount.yaml b/incubator/aws-alb-ingress-controller/templates/serviceaccount.yaml new file mode 100644 index 0000000000..88c7401aae --- /dev/null +++ b/incubator/aws-alb-ingress-controller/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if .Values.rbac.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "aws-alb-ingress-controller.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "aws-alb-ingress-controller.name" . }} + helm.sh/chart: {{ include "aws-alb-ingress-controller.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} diff --git a/incubator/aws-alb-ingress-controller/values.yaml b/incubator/aws-alb-ingress-controller/values.yaml new file mode 100644 index 0000000000..ac3c4e1aed --- /dev/null +++ b/incubator/aws-alb-ingress-controller/values.yaml @@ -0,0 +1,101 @@ +# Default values for aws-alb-ingress-controller. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +## Resources created by the ALB Ingress controller will be prefixed with this string +## Required +clusterName: k8s + +## AWS region of k8s cluster, required if ec2metadata is unavailable from controller pod +## Required if autoDiscoverAwsRegion != true +awsRegion: "us-east-2" + +## Auto Discover awsRegion from ec2metadata, set this to true and omit awsRegion when ec2metadata is available. +autoDiscoverAwsRegion: false + +## VPC ID of k8s cluster, required if ec2metadata is unavailable from controller pod +## Required if autoDiscoverAwsVpcID != true +awsVpcID: "vpc-xxx" + +## Auto Discover awsVpcID from ec2metadata, set this to true and omit awsVpcID: " when ec2metadata is available. +autoDiscoverAwsVpcID: false + +scope: + ## If provided, the ALB ingress controller will only act on Ingress resources annotated with this class + ## Ref: https://github.com/kubernetes-sigs/aws-alb-ingress-controller/blob/master/docs/configuration.md#limiting-ingress-class + ingressClass: alb + + ## If true, the ALB ingress controller will only act on Ingress resources in a single namespace + ## Default: false; watch all namespaces + singleNamespace: false + + ## If scope.singleNamespace=true, the ALB ingress controller will only act on Ingress resources in this namespace + ## Ref: https://github.com/kubernetes-sigs/aws-alb-ingress-controller/blob/master/docs/configuration.md#limiting-namespaces + ## Default: namespace of the ALB ingress controller + watchNamespace: "" + +extraArgs: {} + +extraEnv: {} + # AWS_ACCESS_KEY_ID: "" + # AWS_SECRET_ACCESS_KEY: "" + +podAnnotations: {} + # iam.amazonaws.com/role: alb-ingress-controller + +podLabels: {} + +# whether configure readinessProbe on controller pod +enableReadinessProbe: false + +# How often (in seconds) to check controller readiness +readinessProbeInterval: 60 + +# How long to wait before timeout (in seconds) when checking controller readiness +readinessProbeTimeout: 3 + +# How long to wait (in seconds) before checking the readiness probe +readinessProbeInitialDelay: 30 + +# whether configure livenessProbe on controller pod +enableLivenessProbe: false + +# How long to wait (in seconds) before checking the liveness probe +livenessProbeInitialDelay: 30 + +rbac: + ## If true, create & use RBAC resources + ## + create: true + serviceAccountName: default + +image: + repository: docker.io/amazon/aws-alb-ingress-controller + tag: "v1.0.1" + pullPolicy: IfNotPresent + +replicaCount: 1 +nameOverride: "" +fullnameOverride: "" + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + # node-role.kubernetes.io/node: "true" + # tier: cs + +tolerations: [] + # - key: "node-role.kubernetes.io/master" + # effect: NoSchedule + +affinity: {}