Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hangyan committed Dec 5, 2019
0 parents commit 7f3b7fc
Show file tree
Hide file tree
Showing 70 changed files with 2,888 additions and 0 deletions.
Binary file added basic-nginx-ingress-1.26.2.tgz
Binary file not shown.
18 changes: 18 additions & 0 deletions basic-nginx-ingress/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
appVersion: 0.26.1
description: An nginx Ingress controller that uses ConfigMap to store the nginx configuration.
engine: gotpl
home: https://github.com/kubernetes/ingress-nginx
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Nginx_logo.svg/500px-Nginx_logo.svg.png
keywords:
- ingress
- nginx
kubeVersion: '>=1.10.0-0'
maintainers:
- name: ChiefAlexander
- email: Trevor.G.Wood@gmail.com
name: taharah
name: basic-nginx-ingress
sources:
- https://github.com/kubernetes/ingress-nginx
version: 1.26.2
6 changes: 6 additions & 0 deletions basic-nginx-ingress/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
approvers:
- ChiefAlexander
- taharah
reviewers:
- ChiefAlexander
- taharah
322 changes: 322 additions & 0 deletions basic-nginx-ingress/README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions basic-nginx-ingress/ci/daemonset-customconfig-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
controller:
kind: DaemonSet
config:
use-proxy-protocol: "true"
15 changes: 15 additions & 0 deletions basic-nginx-ingress/ci/daemonset-customnodeport-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
controller:
kind: DaemonSet
service:
type: NodePort
nodePorts:
tcp:
9000: 30090
udp:
9001: 30091

tcp:
9000: "default/test:8080"

udp:
9001: "default/test:8080"
6 changes: 6 additions & 0 deletions basic-nginx-ingress/ci/daemonset-headers-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
controller:
kind: DaemonSet
addHeaders:
X-Frame-Options: deny
proxySetHeaders:
X-Forwarded-Proto: https
4 changes: 4 additions & 0 deletions basic-nginx-ingress/ci/daemonset-nodeport-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
controller:
kind: DaemonSet
service:
type: NodePort
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
controller:
kind: DaemonSet
service:
type: ClusterIP
tcp:
configMapNamespace: default
udp:
configMapNamespace: default

tcp:
9000: "default/test:8080"

udp:
9001: "default/test:8080"
10 changes: 10 additions & 0 deletions basic-nginx-ingress/ci/daemonset-tcp-udp-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
controller:
kind: DaemonSet
service:
type: ClusterIP

tcp:
9000: "default/test:8080"

udp:
9001: "default/test:8080"
6 changes: 6 additions & 0 deletions basic-nginx-ingress/ci/daemonset-tcp-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
controller:
kind: DaemonSet

tcp:
9000: "default/test:8080"
9001: "default/test:8080"
2 changes: 2 additions & 0 deletions basic-nginx-ingress/ci/deamonset-default-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
controller:
kind: DaemonSet
4 changes: 4 additions & 0 deletions basic-nginx-ingress/ci/deamonset-metrics-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
controller:
kind: DaemonSet
metrics:
enabled: true
5 changes: 5 additions & 0 deletions basic-nginx-ingress/ci/deamonset-psp-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
controller:
kind: DaemonSet

podSecurityPolicy:
enabled: true
7 changes: 7 additions & 0 deletions basic-nginx-ingress/ci/deamonset-webhook-and-psp-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
controller:
kind: DaemonSet
admissionWebhooks:
enabled: true

podSecurityPolicy:
enabled: true
4 changes: 4 additions & 0 deletions basic-nginx-ingress/ci/deamonset-webhook-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
controller:
kind: DaemonSet
admissionWebhooks:
enabled: true
3 changes: 3 additions & 0 deletions basic-nginx-ingress/ci/deployment-autoscaling-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
controller:
autoscaling:
enabled: true
3 changes: 3 additions & 0 deletions basic-nginx-ingress/ci/deployment-customconfig-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
controller:
config:
use-proxy-protocol: "true"
14 changes: 14 additions & 0 deletions basic-nginx-ingress/ci/deployment-customnodeport-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
controller:
service:
type: NodePort
nodePorts:
tcp:
9000: 30090
udp:
9001: 30091

tcp:
9000: "default/test:8080"

udp:
9001: "default/test:8080"
1 change: 1 addition & 0 deletions basic-nginx-ingress/ci/deployment-default-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Left blank to test default values
5 changes: 5 additions & 0 deletions basic-nginx-ingress/ci/deployment-headers-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
controller:
addHeaders:
X-Frame-Options: deny
proxySetHeaders:
X-Forwarded-Proto: https
3 changes: 3 additions & 0 deletions basic-nginx-ingress/ci/deployment-metrics-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
controller:
metrics:
enabled: true
3 changes: 3 additions & 0 deletions basic-nginx-ingress/ci/deployment-nodeport-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
controller:
service:
type: NodePort
2 changes: 2 additions & 0 deletions basic-nginx-ingress/ci/deployment-psp-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
podSecurityPolicy:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
controller:
service:
type: ClusterIP
tcp:
configMapNamespace: default
udp:
configMapNamespace: default

tcp:
9000: "default/test:8080"

udp:
9001: "default/test:8080"
9 changes: 9 additions & 0 deletions basic-nginx-ingress/ci/deployment-tcp-udp-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
controller:
service:
type: ClusterIP

tcp:
9000: "default/test:8080"

udp:
9001: "default/test:8080"
3 changes: 3 additions & 0 deletions basic-nginx-ingress/ci/deployment-tcp-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tcp:
9000: "default/test:8080"
9001: "default/test:8080"
6 changes: 6 additions & 0 deletions basic-nginx-ingress/ci/deployment-webhook-and-psp-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
controller:
admissionWebhooks:
enabled: true

podSecurityPolicy:
enabled: true
3 changes: 3 additions & 0 deletions basic-nginx-ingress/ci/deployment-webhook-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
controller:
admissionWebhooks:
enabled: true
71 changes: 71 additions & 0 deletions basic-nginx-ingress/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
The nginx-ingress controller has been installed.

{{- if contains "NodePort" .Values.controller.service.type }}
Get the application URL by running these commands:

{{- if (not (empty .Values.controller.service.nodePorts.http)) }}
export HTTP_NODE_PORT={{ .Values.controller.service.nodePorts.http }}
{{- else }}
export HTTP_NODE_PORT=$(kubectl --namespace {{ .Release.Namespace }} get services -o jsonpath="{.spec.ports[0].nodePort}" {{ template "nginx-ingress.controller.fullname" . }})
{{- end }}
{{- if (not (empty .Values.controller.service.nodePorts.https)) }}
export HTTPS_NODE_PORT={{ .Values.controller.service.nodePorts.https }}
{{- else }}
export HTTPS_NODE_PORT=$(kubectl --namespace {{ .Release.Namespace }} get services -o jsonpath="{.spec.ports[1].nodePort}" {{ template "nginx-ingress.controller.fullname" . }})
{{- end }}
export NODE_IP=$(kubectl --namespace {{ .Release.Namespace }} get nodes -o jsonpath="{.items[0].status.addresses[1].address}")

echo "Visit http://$NODE_IP:$HTTP_NODE_PORT to access your application via HTTP."
echo "Visit https://$NODE_IP:$HTTPS_NODE_PORT to access your application via HTTPS."
{{- 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 "nginx-ingress.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 "nginx-ingress.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: {{ .Values.controller.ingressClass }}
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

{{- if .Values.controller.headers }}
#################################################################################
###### WARNING: `controller.headers` has been deprecated! #####
###### It has been renamed to `controller.proxySetHeaders`. #####
#################################################################################
{{- end }}
117 changes: 117 additions & 0 deletions basic-nginx-ingress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "nginx-ingress.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "nginx-ingress.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | 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 "nginx-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 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 "nginx-ingress.controller.fullname" -}}
{{- printf "%s-%s" (include "nginx-ingress.fullname" .) .Values.controller.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Construct the path for the publish-service.
By convention this will simply use the <namespace>/<controller-name> to match the name of the
service generated.
Users can provide an override for an explicit service they want bound via `.Values.controller.publishService.pathOverride`
*/}}
{{- define "nginx-ingress.controller.publishServicePath" -}}
{{- $defServiceName := printf "%s/%s" .Release.Namespace (include "nginx-ingress.controller.fullname" .) -}}
{{- $servicePath := default $defServiceName .Values.controller.publishService.pathOverride }}
{{- print $servicePath | 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 "nginx-ingress.defaultBackend.fullname" -}}
{{- printf "%s-%s" (include "nginx-ingress.fullname" .) .Values.defaultBackend.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the controller service account to use
*/}}
{{- define "nginx-ingress.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "nginx-ingress.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create the name of the backend service account to use - only used when podsecuritypolicy is also enabled
*/}}
{{- define "nginx-ingress.defaultBackend.serviceAccountName" -}}
{{- if .Values.defaultBackend.serviceAccount.create -}}
{{ default (printf "%s-backend" (include "nginx-ingress.fullname" .)) .Values.defaultBackend.serviceAccount.name }}
{{- else -}}
{{ default "default-backend" .Values.defaultBackend.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for deployment.
*/}}
{{- define "deployment.apiVersion" -}}
{{- if semverCompare ">=1.9-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "apps/v1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiGroup for PodSecurityPolicy.
*/}}
{{- define "podSecurityPolicy.apiGroup" -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "policy" -}}
{{- else -}}
{{- print "extensions" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for podSecurityPolicy.
*/}}
{{- define "podSecurityPolicy.apiVersion" -}}
{{- if semverCompare ">=1.10-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "policy/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
Loading

0 comments on commit 7f3b7fc

Please sign in to comment.