[NEW] nginx-ingress (#399)

This commit is contained in:
Michael Goodness
2017-02-22 20:25:13 -06:00
committed by GitHub
parent 0e646ace48
commit eae290aea0
16 changed files with 889 additions and 0 deletions
+21
View File
@@ -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
+15
View File
@@ -0,0 +1,15 @@
name: nginx-ingress
version: 0.3.0
description: An nginx Ingress controller that uses ConfigMap to store the nginx configuration.
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Nginx_logo.svg/500px-Nginx_logo.svg.png
keywords:
- ingress
- nginx
sources:
- https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx
maintainers:
- name: Jack Zampolin
email: jack.zampolin@gmail.com
- name: Michael Goodness
email: mgoodness@gmail.com
engine: gotpl
+118
View File
@@ -0,0 +1,118 @@
# nginx-ingress
[nginx-ingress](https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx) is an Ingress controller that uses ConfigMap to store the nginx configuration.
To use, add the `kubernetes.io/ingress.class: nginx` annotation to your Ingress resources.
## TL;DR;
```console
$ helm install stable/nginx-ingress
```
## Introduction
This chart bootstraps an nginx-ingress deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
## Prerequisites
- Kubernetes 1.4+ with Beta APIs enabled
## Installing the Chart
To install the chart with the release name `my-release`:
```console
$ helm install --name my-release stable/nginx-ingress
```
The command deploys nginx-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 tables lists the configurable parameters of the aws-cluster-autoscaler chart and their default values.
Parameter | Description | Default
--- | --- | ---
`controller.name` | name of the controller component | `controller`
`controller.image.repository` | controller container image repository | `gcr.io/google_containers/nginx-ingress-controller`
`controller.image.tag` | controller container image tag | `0.8.3`
`controller.image.pullPolicy` | controller container image pull policy | `IfNotPresent`
`controller.config` | nginx ConfigMap entries | none
`controller.defaultBackendService` | default 404 backend service; required only if `defaultBackend.enabled = false` | `""`
`controller.extraArgs` | Additional controller container arguments | `{}`
`controller.kind` | install as Deployment or DaemonSet | `Deployment`
`controller.nodeSelector` | node labels for pod assignment | `{}`
`controller.podAnnotations` | annotations to be added to pods | `{}`
`controller.replicaCount` | desired number of controller pods | `1`
`controller.resources` | controller pod resource requests & limits | `{}`
`controller.service.annotations` | annotations for controller service | `{}`
`controller.service.clusterIP` | internal controller cluster service IP | `""`
`controller.service.externalIPs` | controller service external IP addresses | `[]`
`controller.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""`
`controller.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]`
`controller.service.type` | type of controller service to create | `LoadBalancer`
`controller.stats.enabled` | if true, enable "vts-status" page & Prometheus metrics | `false`
`controller.stats.service.annotations` | annotations for controller stats service | `{}`
`controller.stats.service.clusterIP` | internal controller stats cluster service IP | `""`
`controller.stats.service.externalIPs` | controller service stats external IP addresses | `[]`
`controller.stats.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""`
`controller.stats.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]`
`controller.stats.service.type` | type of controller stats service to create | `ClusterIP`
`defaultBackend.name` | name of the default backend component | `default-backend`
`defaultBackend.image.repository` | default backend container image repository | `gcr.io/google_containers/defaultbackend`
`defaultBackend.image.tag` | default backend container image tag | `1.2`
`defaultBackend.image.pullPolicy` | default backend container image pull policy | `IfNotPresent`
`defaultBackend.extraArgs` | Additional default backend container arguments | `{}`
`defaultBackend.nodeSelector` | node labels for pod assignment | `{}`
`defaultBackend.podAnnotations` | annotations to be added to pods | `{}`
`defaultBackend.replicaCount` | desired number of default backend pods | `1`
`defaultBackend.resources` | default backend pod resource requests & limits | `{}`
`defaultBackend.service.annotations` | annotations for default backend service | `{}`
`defaultBackend.service.clusterIP` | internal default backend cluster service IP | `""`
`defaultBackend.service.externalIPs` | default backend service external IP addresses | `[]`
`defaultBackend.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""`
`defaultBackend.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]`
`defaultBackend.service.type` | type of default backend service to create | `ClusterIP`
`statsExporter.name` | name of the Prometheus metrics exporter component | `stats-exporter`
`statsExporter.image.repository` | Prometheus metrics exporter container image repository | `quay.io/cy-play/vts-nginx-exporter`
`statsExporter.image.tag` | Prometheus metrics exporter image tag | `v0.0.3`
`statsExporter.image.pullPolicy` | Prometheus metrics exporter image pull policy | `IfNotPresent`
`statsExporter.endpoint` | path at which Prometheus metrics are exposed | `/metrics`
`statsExporter.extraArgs` | Additional Prometheus metrics exporter container arguments | `{}`
`statsExporter.metricsNamespace` | namespace used for metrics labeling | `nginx`
`statsExporter.statusPage` | URL of "vts-stats" page exposed by controller | `http://localhost:18080/nginx_status/format/json`
`statsExporter.resources` | Prometheus metrics exporter resource requests & limits | `{}`
`statsExporter.service.annotations` | annotations for Prometheus metrics exporter service | `{}`
`statsExporter.service.clusterIP` | cluster IP address to assign to service | `""`
`statsExporter.service.externalIPs` | Prometheus metrics exporter service external IP addresses | `[]`
`statsExporter.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""`
`statsExporter.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]`
`statsExporter.service.servicePort` | Prometheus metrics exporter service port | `9913`
`statsExporter.service.type` | type of Prometheus metrics exporter service to create | `ClusterIP`
`tcp` | TCP service key:value pairs | `{}`
`udp` | UDP service key:value pairs | `{}`
```console
$ helm install stable/nginx-ingress --name my-release \
--set controller.stats.enabled=true
```
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```console
$ helm install stable/nginx-ingress --name my-release -f values.yaml
```
> **Tip**: You can use the default [values.yaml](values.yaml)
+52
View File
@@ -0,0 +1,52 @@
The nginx-ingress controller has been installed.
{{- if contains "NodePort" .Values.controller.service.type }}
Get the application URL by running these commands:
export NODE_PORT=$(kubectl --namespace {{ .Release.Namespace }} get services -o jsonpath="{.spec.ports[0].nodePort}" {{ template "controller.fullname" . }})
export NODE_IP=$(kubectl --namespace {{ .Release.Namespace }} get nodes -o jsonpath="{.items[0].status.addresses[1].address}")
echo "Visit http://$NODE_IP:$NODE_PORT to access your application."
{{- else if contains "LoadBalancer" .Values.controller.service.type }}
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace {{ .Release.Namespace }} get services -o wide -w {{ template "controller.fullname" . }}'
{{- else if contains "ClusterIP" .Values.controller.service.type }}
Get the application URL by running these commands:
export POD_NAME=$(kubectl --namespace {{ .Release.Namespace }} get pods -o jsonpath="{.items[0].metadata.name}" -l "app={{ template "name" . }},component={{ .Values.controller.name }},release={{ .Release.Name }}")
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
echo "Visit http://127.0.0.1:8080 to access your application."
{{- end }}
An example Ingress that makes use of the controller:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
namespace: foo
spec:
rules:
- host: www.example.com
http:
paths:
- backend:
serviceName: exampleService
servicePort: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
- hosts:
- www.example.com
secretName: example-tls
If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:
apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>
type: kubernetes.io/tls
@@ -0,0 +1,34 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "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).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified controller name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "controller.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s-%s" .Release.Name $name .Values.controller.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified default backend name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "defaultBackend.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s-%s" .Release.Name $name .Values.defaultBackend.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "controller.fullname" . }}
data:
enable-vts-status: "{{ .Values.controller.stats.enabled }}"
{{- if .Values.controller.config }}
{{ toYaml .Values.controller.config | indent 2 }}
{{- end }}
@@ -0,0 +1,108 @@
{{- if eq .Values.controller.kind "DaemonSet" }}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "controller.fullname" . }}
spec:
template:
metadata:
{{- if .Values.controller.podAnnotations }}
annotations:
{{ toYaml .Values.controller.podAnnotations | indent 8}}
{{- end }}
labels:
app: {{ template "name" . }}
component: "{{ .Values.controller.name }}"
release: {{ .Release.Name }}
spec:
containers:
- name: {{ template "name" . }}-{{ .Values.controller.name }}
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
args:
- /nginx-ingress-controller
- --default-backend-service={{ if .Values.defaultBackend.enabled }}{{ .Release.Namespace }}/{{ template "defaultBackend.fullname" . }}{{ else }}{{ .Values.controller.defaultBackendService }}{{ end }}
- --nginx-configmap={{ .Release.Namespace }}/{{ template "controller.fullname" . }}
- --tcp-services-configmap={{ .Release.Namespace }}/{{ template "fullname" . }}-tcp
- --udp-services-configmap={{ .Release.Namespace }}/{{ template "fullname" . }}-udp
{{- range $key, $value := .Values.controller.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
{{- if .Values.controller.stats.enabled }}
- name: stats
containerPort: 18080
protocol: TCP
{{- end }}
{{- range $key, $value := .Values.tcp }}
- name: "{{ $key }}-tcp"
containerPort: {{ $key }}
protocol: TCP
{{- end }}
{{- range $key, $value := .Values.udp }}
- name: "{{ $key }}-udp"
containerPort: {{ $key }}
protocol: UDP
{{- end }}
readinessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
resources:
{{ toYaml .Values.controller.resources | indent 12 }}
{{- if .Values.controller.stats.enabled }}
- name: {{ template "name" . }}-{{ .Values.statsExporter.name }}
image: "{{ .Values.statsExporter.image.repository }}:{{ .Values.statsExporter.image.tag }}"
imagePullPolicy: "{{ .Values.statsExporter.image.pullPolicy }}"
env:
- name: METRICS_ADDR
value: ":9913"
- name: METRICS_ENDPOINT
value: "{{ .Values.statsExporter.endpoint }}"
- name: METRICS_NS
value: "{{ .Values.statsExporter.metricsNamespace }}"
- name: NGINX_STATUS
value: "{{ .Values.statsExporter.statusPage }}"
ports:
- name: metrics
containerPort: 9913
protocol: TCP
resources:
{{ toYaml .Values.statsExporter.resources | indent 12 }}
{{- end }}
{{- if .Values.controller.nodeSelector }}
nodeSelector:
{{ toYaml .Values.controller.nodeSelector | indent 8 }}
{{- end }}
terminationGracePeriodSeconds: 60
{{- end }}
@@ -0,0 +1,109 @@
{{- if eq .Values.controller.kind "Deployment" }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "controller.fullname" . }}
spec:
replicas: {{ .Values.controller.replicaCount }}
template:
metadata:
{{- if .Values.controller.podAnnotations }}
annotations:
{{ toYaml .Values.controller.podAnnotations | indent 8}}
{{- end }}
labels:
app: {{ template "name" . }}
component: "{{ .Values.controller.name }}"
release: {{ .Release.Name }}
spec:
containers:
- name: {{ template "name" . }}-{{ .Values.controller.name }}
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
args:
- /nginx-ingress-controller
- --default-backend-service={{ if .Values.defaultBackend.enabled }}{{ .Release.Namespace }}/{{ template "defaultBackend.fullname" . }}{{ else }}{{ .Values.controller.defaultBackendService }}{{ end }}
- --nginx-configmap={{ .Release.Namespace }}/{{ template "controller.fullname" . }}
- --tcp-services-configmap={{ .Release.Namespace }}/{{ template "fullname" . }}-tcp
- --udp-services-configmap={{ .Release.Namespace }}/{{ template "fullname" . }}-udp
{{- range $key, $value := .Values.controller.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
{{- if .Values.controller.stats.enabled }}
- name: stats
containerPort: 18080
protocol: TCP
{{- end }}
{{- range $key, $value := .Values.tcp }}
- name: "{{ $key }}-tcp"
containerPort: {{ $key }}
protocol: TCP
{{- end }}
{{- range $key, $value := .Values.udp }}
- name: "{{ $key }}-udp"
containerPort: {{ $key }}
protocol: UDP
{{- end }}
readinessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
resources:
{{ toYaml .Values.controller.resources | indent 12 }}
{{- if .Values.controller.stats.enabled }}
- name: {{ template "name" . }}-{{ .Values.statsExporter.name }}
image: "{{ .Values.statsExporter.image.repository }}:{{ .Values.statsExporter.image.tag }}"
imagePullPolicy: "{{ .Values.statsExporter.image.pullPolicy }}"
env:
- name: METRICS_ADDR
value: ":9913"
- name: METRICS_ENDPOINT
value: "{{ .Values.statsExporter.endpoint }}"
- name: METRICS_NS
value: "{{ .Values.statsExporter.metricsNamespace }}"
- name: NGINX_STATUS
value: "{{ .Values.statsExporter.statusPage }}"
ports:
- name: metrics
containerPort: 9913
protocol: TCP
resources:
{{ toYaml .Values.statsExporter.resources | indent 12 }}
{{- end }}
{{- if .Values.controller.nodeSelector }}
nodeSelector:
{{ toYaml .Values.controller.nodeSelector | indent 8 }}
{{- end }}
terminationGracePeriodSeconds: 60
{{- end }}
@@ -0,0 +1,38 @@
{{- if .Values.controller.stats.enabled }}
apiVersion: v1
kind: Service
metadata:
{{- if .Values.statsExporter.service.annotations }}
annotations:
{{ toYaml .Values.statsExporter.service.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "controller.fullname" . }}-metrics
spec:
clusterIP: "{{ .Values.statsExporter.service.clusterIP }}"
{{- if .Values.statsExporter.service.externalIPs }}
externalIPs:
{{ toYaml .Values.statsExporter.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.statsExporter.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.statsExporter.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.statsExporter.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.statsExporter.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
ports:
- name: metrics
port: {{ .Values.statsExporter.service.servicePort }}
targetPort: 9913
selector:
app: {{ template "name" . }}
component: "{{ .Values.controller.name }}"
release: {{ .Release.Name }}
type: "{{ .Values.statsExporter.service.type }}"
{{- end }}
@@ -0,0 +1,53 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.controller.service.annotations }}
annotations:
{{ toYaml .Values.controller.service.annotations | indent 4}}
{{- end }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "controller.fullname" . }}
spec:
clusterIP: "{{ .Values.controller.service.clusterIP }}"
{{- if .Values.controller.service.externalIPs }}
externalIPs:
{{ toYaml .Values.controller.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.controller.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.controller.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.controller.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.controller.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
- name: https
port: 443
protocol: TCP
targetPort: 443
{{- range $key, $value := .Values.tcp }}
- name: "{{ $key }}-tcp"
port: {{ $key }}
protocol: TCP
targetPort: {{ $key }}
{{- end }}
{{- range $key, $value := .Values.udp }}
- name: "{{ $key }}-udp"
port: {{ $key }}
protocol: UDP
targetPort: {{ $key }}
{{- end }}
selector:
app: {{ template "name" . }}
component: "{{ .Values.controller.name }}"
release: {{ .Release.Name }}
type: "{{ .Values.controller.service.type }}"
@@ -0,0 +1,38 @@
{{- if .Values.controller.stats.enabled }}
apiVersion: v1
kind: Service
metadata:
{{- if .Values.controller.stats.service.annotations }}
annotations:
{{ toYaml .Values.controller.stats.service.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "controller.fullname" . }}-stats
spec:
clusterIP: "{{ .Values.controller.stats.service.clusterIP }}"
{{- if .Values.controller.stats.service.externalIPs }}
externalIPs:
{{ toYaml .Values.controller.stats.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.controller.stats.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.controller.stats.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.controller.stats.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.controller.stats.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
ports:
- name: stats
port: {{ .Values.controller.stats.service.servicePort }}
targetPort: 18080
selector:
app: {{ template "name" . }}
component: "{{ .Values.controller.name }}"
release: {{ .Release.Name }}
type: "{{ .Values.controller.stats.service.type }}"
{{- end }}
@@ -0,0 +1,50 @@
{{- if .Values.defaultBackend.enabled }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.defaultBackend.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "defaultBackend.fullname" . }}
spec:
replicas: {{ .Values.defaultBackend.replicaCount }}
template:
metadata:
{{- if .Values.defaultBackend.podAnnotations }}
annotations:
{{ toYaml .Values.defaultBackend.podAnnotations | indent 8}}
{{- end }}
labels:
app: {{ template "name" . }}
component: "{{ .Values.defaultBackend.name }}"
release: {{ .Release.Name }}
spec:
containers:
- name: {{ template "name" . }}-{{ .Values.defaultBackend.name }}
image: "{{ .Values.defaultBackend.image.repository }}:{{ .Values.defaultBackend.image.tag }}"
imagePullPolicy: "{{ .Values.defaultBackend.image.pullPolicy }}"
args:
{{- range $key, $value := .Values.defaultBackend.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
ports:
- containerPort: 8080
protocol: TCP
resources:
{{ toYaml .Values.defaultBackend.resources | indent 12 }}
{{- if .Values.defaultBackend.nodeSelector }}
nodeSelector:
{{ toYaml .Values.defaultBackend.nodeSelector | indent 8 }}
{{- end }}
terminationGracePeriodSeconds: 60
{{- end }}
@@ -0,0 +1,37 @@
{{- if .Values.defaultBackend.enabled }}
apiVersion: v1
kind: Service
metadata:
{{- if .Values.defaultBackend.service.annotations }}
annotations:
{{ toYaml .Values.defaultBackend.service.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.defaultBackend.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "defaultBackend.fullname" . }}
spec:
clusterIP: "{{ .Values.defaultBackend.service.clusterIP }}"
{{- if .Values.defaultBackend.service.externalIPs }}
externalIPs:
{{ toYaml .Values.defaultBackend.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.defaultBackend.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.defaultBackend.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.defaultBackend.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.defaultBackend.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
ports:
- port: {{ .Values.defaultBackend.service.servicePort }}
targetPort: 8080
selector:
app: {{ template "name" . }}
component: "{{ .Values.defaultBackend.name }}"
release: {{ .Release.Name }}
type: ClusterIP
{{- end }}
@@ -0,0 +1,16 @@
{{- if .Values.tcp }}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "fullname" . }}-tcp
data:
{{- if .Values.tcp }}
{{ toYaml .Values.tcp | indent 2 }}
{{- end }}
{{- end }}
@@ -0,0 +1,16 @@
{{- if .Values.udp }}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "fullname" . }}-udp
data:
{{- if .Values.udp }}
{{ toYaml .Values.udp | indent 2 }}
{{- end }}
{{- end }}
+169
View File
@@ -0,0 +1,169 @@
## nginx configuration
## Ref: https://github.com/kubernetes/ingress/blob/master/controllers/nginx/configuration.md
##
controller:
name: controller
image:
repository: gcr.io/google_containers/nginx-ingress-controller
tag: "0.8.3"
pullPolicy: IfNotPresent
config: {}
## Required only if defaultBackend.enabled = false
## Must be <namespace>/<service_name>
##
defaultBackendService: ""
extraArgs: {}
## DaemonSet or Deployment
##
kind: Deployment
## Node labels for controller pod assignment
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}
## Annotations to be added to controller pods
##
podAnnotations: {}
replicaCount: 1
resources: {}
# limits:
# cpu: 100m
# memory: 64Mi
# requests:
# cpu: 100m
# memory: 64Mi
service:
annotations: {}
clusterIP: ""
## List of IP addresses at which the controller services are available
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
type: LoadBalancer
stats:
enabled: false
service:
annotations: {}
clusterIP: ""
## List of IP addresses at which the stats service is available
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
servicePort: 18080
type: ClusterIP
## Default 404 backend
##
defaultBackend:
## If false, controller.defaultBackendService must be provided
##
enabled: true
name: default-backend
image:
repository: gcr.io/google_containers/defaultbackend
tag: "1.2"
pullPolicy: IfNotPresent
extraArgs: {}
## Node labels for default backend pod assignment
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}
## Annotations to be added to default backend pods
##
podAnnotations: {}
replicaCount: 1
resources: {}
# limits:
# cpu: 10m
# memory: 20Mi
# requests:
# cpu: 10m
# memory: 20Mi
service:
annotations: {}
clusterIP: ""
## List of IP addresses at which the default backend service is available
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
servicePort: 80
type: ClusterIP
## If controller.stats.enabled = true, Prometheus metrics will be exported
## Ref: https://github.com/hnlq715/nginx-vts-exporter
##
statsExporter:
name: stats-exporter
image:
repository: quay.io/cy-play/vts-nginx-exporter
tag: v0.0.3
pullPolicy: IfNotPresent
endpoint: /metrics
extraArgs: {}
metricsNamespace: nginx
statusPage: http://localhost:18080/nginx_status/format/json
resources: {}
# limits:
# cpu: 10m
# memory: 20Mi
# requests:
# cpu: 10m
# memory: 20Mi
service:
annotations: {}
clusterIP: ""
## List of IP addresses at which the stats-exporter service is available
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
servicePort: 9913
type: ClusterIP
# TCP service key:value pairs
# Ref: https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples/tcp
##
tcp: {}
# 8080: "default/example-tcp-svc:9000"
# UDP service key:value pairs
# Ref: https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples/udp
##
udp: {}
# 53: "kube-system/kube-dns:53"