diff --git a/stable/gce-ingress/.helmignore b/stable/gce-ingress/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/gce-ingress/.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/stable/gce-ingress/Chart.yaml b/stable/gce-ingress/Chart.yaml new file mode 100644 index 0000000000..732bbac967 --- /dev/null +++ b/stable/gce-ingress/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +appVersion: "1.1.1" +description: A GCE Ingress Controller +name: gce-ingress +version: 1.0.0 +keywords: + - ingress + - gce +sources: + - https://github.com/kubernetes/ingress-gce +maintainers: + - name: paulczar + email: username.taken@gmail.com +engine: gotpl +home: https://github.com/kubernetes/ingress-gce diff --git a/stable/gce-ingress/OWNERS b/stable/gce-ingress/OWNERS new file mode 100644 index 0000000000..0391d176ae --- /dev/null +++ b/stable/gce-ingress/OWNERS @@ -0,0 +1,2 @@ +approvers: + - paulczar diff --git a/stable/gce-ingress/README.md b/stable/gce-ingress/README.md new file mode 100644 index 0000000000..59502ae491 --- /dev/null +++ b/stable/gce-ingress/README.md @@ -0,0 +1,82 @@ +# gce-ingress + +[gce-ingress](https://github.com/kubernetes/gce-gce) is an Ingress controller that configures GCE loadbalancers + +To use, add the `kubernetes.io/ingress.class: "gce"` annotation to your Ingress resources. + +## TL;DR; + +```console +$ helm install stable/gce-ingress +``` + +## Introduction + +This chart bootstraps a gce-ingress deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + - Kubernetes 1.9+ + +## Installing the Chart + +To install the chart with the release name `my-release` into the `kube-system` namespace: + +```console +$ helm install --namespace kube-system --name my-release stable/gce-ingress +``` + +The command deploys gce-ingress 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 table lists the configurable parameters of the gce-ingress chart and their default values. + +Parameter | Description | Default +--- | --- | --- +`controller.name` | name of the controller component | `controller` +`controller.image.repository` | controller container image repository | `k8s.gcr.io/ingress-gce-glbc-amd64` +`controller.image.tag` | controller container image tag | `v1.1.1` +`controller.image.pullPolicy` | controller container image pull policy | `IfNotPresent` +`controller.config` | gce ConfigMap entries | none +`controller.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | `[]` +`controller.affinity` | node/pod affinities (requires Kubernetes >=1.6) | `{}` +`controller.nodeSelector` | node labels for pod assignment | `{}` +`controller.replicaCount` | desired number of controller pods | `1` +`controller.resources` | controller pod resource requests & limits | `{}` +`defaultBackend.name` | name of the default backend component | `default-backend` +`defaultBackend.image.repository` | default backend container image repository | `k8s.gcr.io/defaultbackend` +`defaultBackend.image.tag` | default backend container image tag | `1.4` +`defaultBackend.image.pullPolicy` | default backend container image pull policy | `IfNotPresent` +`defaultBackend.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | `[]` +`defaultBackend.affinity` | node/pod affinities (requires Kubernetes >=1.6) | `{}` +`defaultBackend.nodeSelector` | node labels for pod assignment | `{}` +`defaultBackend.replicaCount` | desired number of default backend pods | `1` +`defaultBackend.resources` | default backend pod resource requests & limits | `{}` +`rbac.enabled` | use RBAC ? | `true` + +```console +$ helm install stable/gce-ingress --name my-release +``` + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```console +$ helm install stable/gce-ingress --name my-release -f values.yaml +``` + + +```console +$ helm install stable/gce-ingress --set controller.extraArgs.v=2 +``` diff --git a/stable/gce-ingress/templates/NOTES.txt b/stable/gce-ingress/templates/NOTES.txt new file mode 100644 index 0000000000..5774f1be1e --- /dev/null +++ b/stable/gce-ingress/templates/NOTES.txt @@ -0,0 +1,51 @@ +GCE Ingress has been deployed. You should be able to create Ingress resources. + +Example: +```yaml +apiVersion: extensions/v1 +kind: Deployment +metadata: + name: example + labels: + run: example +spec: + selector: + matchLabels: + run: example + template: + metadata: + labels: + run: example + spec: + containers: + - image: nginx:1.13.5-alpine + imagePullPolicy: IfNotPresent + name: example +--- +apiVersion: v1 +kind: Service + type: NodePort +metadata: + name: example + labels: + run: example +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 80 + selector: + run: example +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: example + annotations: + kubernetes.io/ingress.class: "gce" +spec: + backend: + # This assumes http-svc exists and routes to healthy endpoints. + serviceName: example + servicePort: 80 +``` \ No newline at end of file diff --git a/stable/gce-ingress/templates/_helpers.tpl b/stable/gce-ingress/templates/_helpers.tpl new file mode 100644 index 0000000000..6fdc47a677 --- /dev/null +++ b/stable/gce-ingress/templates/_helpers.tpl @@ -0,0 +1,43 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "gce-ingress.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 "gce-ingress.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 "gce-ingress.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "gce-ingress.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "gce-ingress.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/gce-ingress/templates/config-map.yaml b/stable/gce-ingress/templates/config-map.yaml new file mode 100644 index 0000000000..24b84db313 --- /dev/null +++ b/stable/gce-ingress/templates/config-map.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "gce-ingress.fullname" . }} + labels: + app: {{ include "gce-ingress.name" . }} + chart: {{ include "gce-ingress.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + gce.conf: | + [global] + token-url = {{ .Values.config.tokenUrl }} + project-id = {{ .Values.config.projectID }} + network = {{ .Values.config.network }} + subnetwork = {{ .Values.config.subnetwork }} + node-instance-prefix = {{ .Values.config.nodeInstancePrefix }} + node-tags = {{ .Values.config.nodeTags }} \ No newline at end of file diff --git a/stable/gce-ingress/templates/deployment-backend.yaml b/stable/gce-ingress/templates/deployment-backend.yaml new file mode 100644 index 0000000000..c9702956f7 --- /dev/null +++ b/stable/gce-ingress/templates/deployment-backend.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "gce-ingress.fullname" . }}-backend + labels: + app: {{ include "gce-ingress.name" . }}-backend + chart: {{ include "gce-ingress.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + kubernetes.io/name: "GLBC" + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile +spec: + replicas: {{ .Values.defaultBackend.replicaCount }} + selector: + matchLabels: + app: {{ include "gce-ingress.name" . }}-backend + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ include "gce-ingress.name" . }}-backend + release: {{ .Release.Name }} + spec: + containers: + - name: backend + image: "{{ .Values.defaultBackend.image.repository }}:{{ .Values.defaultBackend.image.tag }}" + imagePullPolicy: {{ .Values.defaultBackend.image.pullPolicy }} + livenessProbe: + httpGet: + path: /healthz + port: http + scheme: HTTP + readinessProbe: + httpGet: + path: /healthz + port: http + scheme: HTTP + initialDelaySeconds: 30 + timeoutSeconds: 5 + ports: + - name: http + containerPort: 8080 + resources: +{{ toYaml .Values.defaultBackend.resources | indent 12 }} + {{- with .Values.defaultBackend.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.defaultBackend.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.defaultBackend.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} diff --git a/stable/gce-ingress/templates/deployment-controller.yaml b/stable/gce-ingress/templates/deployment-controller.yaml new file mode 100644 index 0000000000..be5a2c38c0 --- /dev/null +++ b/stable/gce-ingress/templates/deployment-controller.yaml @@ -0,0 +1,84 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "gce-ingress.fullname" . }} + labels: + app: {{ include "gce-ingress.name" . }} + chart: {{ include "gce-ingress.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.controller.replicaCount }} + selector: + matchLabels: + app: {{ include "gce-ingress.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ include "gce-ingress.name" . }} + release: {{ .Release.Name }} + spec: + {{- if .Values.rbac.enabled }} + serviceAccountName: {{ include "gce-ingress.fullname" . }} + {{- end }} + terminationGracePeriodSeconds: 600 + hostNetwork: true + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}" + imagePullPolicy: {{ .Values.controller.image.pullPolicy }} + livenessProbe: + httpGet: + path: /healthz + port: 8086 + scheme: HTTP + initialDelaySeconds: 30 + # healthz reaches out to GCE + periodSeconds: 30 + timeoutSeconds: 15 + successThreshold: 1 + failureThreshold: 5 + volumeMounts: + - name: gce-config-volume + mountPath: /etc/gce/ + {{- if .Values.secret }} + - name: google-cloud-key + mountPath: /var/secrets/google + env: + - name: GOOGLE_APPLICATION_CREDENTIALS + value: /var/secrets/google/key.json + {{- end }} + command: + - sh + - -c + - 'exec /glbc --gce-ratelimit=ga.Operations.Get,qps,10,100 --gce-ratelimit=alpha.Operations.Get,qps,10,100 --gce-ratelimit=ga.BackendServices.Get,qps,1.8,1 --gce-ratelimit=ga.HealthChecks.Get,qps,1.8,1 --gce-ratelimit=alpha.HealthChecks.Get,qps,1.8,1 --verbose --default-backend-service={{ .Release.Namespace }}/{{ include "gce-ingress.fullname" . }} --sync-period=600s --running-in-cluster=true --use-real-cloud=true --config-file-path=/etc/gce/gce.conf --healthz-port=8086 2>&1' + resources: +{{ toYaml .Values.controller.resources | indent 12 }} + volumes: + {{- if .Values.secret }} + - name: google-cloud-key + secret: + secretName: {{ .Values.secret }} + items: + - key: key.json + path: key.json + {{- end }} + - name: gce-config-volume + configMap: + name: {{ include "gce-ingress.fullname" . }} + items: + - key: gce.conf + path: gce.conf + {{- with .Values.controller.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.controller.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.controller.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} diff --git a/stable/gce-ingress/templates/rbac.yaml b/stable/gce-ingress/templates/rbac.yaml new file mode 100644 index 0000000000..ab2320babb --- /dev/null +++ b/stable/gce-ingress/templates/rbac.yaml @@ -0,0 +1,36 @@ +{{ if .Values.rbac.create -}} +{{ if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "gce-ingress.serviceAccountName" . }} +{{ end -}} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "gce-ingress.fullname" . }} +rules: +- apiGroups: [""] + resources: ["secrets", "endpoints", "services", "pods", "nodes", "namespaces", "configmaps", "events"] + verbs: ["get", "list", "watch", "update", "create", "patch"] +- apiGroups: ["extensions"] + resources: ["ingresses"] + verbs: ["get", "list", "watch", "update"] +- apiGroups: ["extensions"] + resources: ["ingresses/status"] + verbs: ["update"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "gce-ingress.fullname" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "gce-ingress.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ include "gce-ingress.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{ end -}} \ No newline at end of file diff --git a/stable/gce-ingress/templates/service.yaml b/stable/gce-ingress/templates/service.yaml new file mode 100644 index 0000000000..522a2a80a0 --- /dev/null +++ b/stable/gce-ingress/templates/service.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "gce-ingress.fullname" . }} + labels: + app: {{ include "gce-ingress.name" . }} + chart: {{ include "gce-ingress.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + k8s-app: glbc + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile + kubernetes.io/name: "GLBCDefaultBackend" +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app: {{ include "gce-ingress.name" . }} + release: {{ .Release.Name }} + + name: default-http-backend + namespace: kube-system + labels: + k8s-app: glbc + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile + kubernetes.io/name: "GLBCDefaultBackend" diff --git a/stable/gce-ingress/values.yaml b/stable/gce-ingress/values.yaml new file mode 100644 index 0000000000..29ffc546c7 --- /dev/null +++ b/stable/gce-ingress/values.yaml @@ -0,0 +1,78 @@ +# Default values for gce-ingress. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + + +nameOverride: "" +fullnameOverride: "" + +rbac: + # Specifies whether RBAC resources should be created + create: true + +serviceAccount: + # Specifies whether a ServiceAccount should be created + create: true + # The name of the ServiceAccount to use. + # If not set and create is true, a name is generated using the fullname template + name: + +# gce-ingress needs credentials to log into GCE. Create a secret with the key +# of key.json with the contents of a GCE service account that has permissions to create +# and modify load balancers. The key should be in the JSON format. +# Example: +# Your secret should look like: +# apiVersion: v1 +# kind: Secret +# metadata: +# name: gce-key +# type: Opaque +# data: +# key.json: < base64 encoded JSON service account key> +secret: ~ + +# gce config, replace values to match your environment +config: + projectID: + network: + subnetwork: + nodeInstancePrefix: + nodeTags: + # tokenUrl should probably be left as nil + tokenUrl: "nil" + + +controller: + replicaCount: 1 + image: + repository: k8s.gcr.io/ingress-gce-glbc-amd64 + tag: v1.1.1 + pullPolicy: IfNotPresent + resources: {} + # requests: + # cpu: 10m + # memory: 50Mi + nodeSelector: {} + tolerations: [] + affinity: {} + +defaultBackend: + replicaCount: 1 + image: + repository: k8s.gcr.io/defaultbackend + tag: "1.4" + pullPolicy: IfNotPresent + resources: {} + # limits: + # cpu: 10m + # memory: 20Mi + # requests: + # cpu: 10m + # memory: 20Mi + nodeSelector: {} + tolerations: [] + affinity: {} + +service: + type: NodePort + port: 80