mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/nginx-ingress] Add RBAC support (#1235)
* nginx-ingress: fix spacing for events * Add RBAC support * Add RBAC support for nginx-ingress based on: https://github.com/kubernetes/charts/pull/1235 * Pull in new RBAC changes from https://github.com/kubernetes/ingress/commit/4618fd2f64a904b1949f1d0a9a76ebe6ab8cb719 * Move resourceNames to a value * templates: use a range loop to render the resourceNames * this produces the correctly formatted output we are looking for, specifically with regard to the extra carriage return which didn't want to be chomped away by the usual `-` method. * Tweak RBAC * Bump chart versions * Fix README * Restrict namespace RBAC if scoped
This commit is contained in:
committed by
Michael Goodness
parent
3c92abb4a7
commit
c1ede62861
@@ -1,6 +1,6 @@
|
||||
name: nginx-ingress
|
||||
version: 0.7.2
|
||||
appVersion: 0.9.0-beta.7
|
||||
version: 0.8.0
|
||||
appVersion: 0.9.0-beta.11
|
||||
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:
|
||||
|
||||
@@ -52,9 +52,10 @@ Parameter | Description | Default
|
||||
`controller.config` | nginx ConfigMap entries | none
|
||||
`controller.hostNetwork` | If the nginx deployment / daemonset should run on the host's network namespace | false
|
||||
`controller.defaultBackendService` | default 404 backend service; required only if `defaultBackend.enabled = false` | `""`
|
||||
`controller.electionID` | election ID to use for the status update | `ingress-controller-leader`
|
||||
`controller.ingressClass` | name of the ingress class to route through this controller | `nginx`
|
||||
`controller.scope.enabled` | limit the scope of the ingress controller | `false` (watch all namespaces)
|
||||
`controller.scope.namespace` | namespace to watch for ingress | `""` (use the release namespace)
|
||||
`controller.serviceAccountName` | Service account to run under | `default`
|
||||
`controller.extraArgs` | Additional controller container arguments | `{}`
|
||||
`controller.kind` | install as Deployment or DaemonSet | `Deployment`
|
||||
`controller.nodeSelector` | node labels for pod assignment | `{}`
|
||||
@@ -95,6 +96,8 @@ Parameter | Description | Default
|
||||
`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`
|
||||
`rbac.create` | If true, create & use RBAC resources | `false`
|
||||
`rbac.serviceAccountName` | ServiceAccount to be used (ignored if rbac.create=true) | `default`
|
||||
`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`
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
{{- if .Values.rbac.create -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "fullname" . }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
- endpoints
|
||||
- nodes
|
||||
- pods
|
||||
- secrets
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
{{- if and .Values.controller.scope.enabled .Values.controller.scope.namespace }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- namespaces
|
||||
resourceNames:
|
||||
- "{{ .Values.controller.scope.namespace }}"
|
||||
verbs:
|
||||
- get
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- extensions
|
||||
resources:
|
||||
- ingresses
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- apiGroups:
|
||||
- extensions
|
||||
resources:
|
||||
- ingresses/status
|
||||
verbs:
|
||||
- update
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if .Values.rbac.create -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "fullname" . }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end -}}
|
||||
@@ -12,19 +12,16 @@ metadata:
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
{{- if .Values.controller.podAnnotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.controller.podAnnotations | indent 8 }}
|
||||
checksum/config: {{ include (print $.Template.BasePath "/controller-configmap.yaml") . | sha256sum }}
|
||||
{{- if .Values.controller.podAnnotations }}
|
||||
{{ toYaml .Values.controller.podAnnotations | indent 8}}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: {{ template "name" . }}
|
||||
component: "{{ .Values.controller.name }}"
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
hostNetwork: {{ .Values.controller.hostNetwork }}
|
||||
{{- if .Values.controller.serviceAccountName }}
|
||||
serviceAccountName: {{ .Values.controller.serviceAccountName }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "name" . }}-{{ .Values.controller.name }}
|
||||
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
|
||||
@@ -35,6 +32,12 @@ spec:
|
||||
{{- if and (contains "0.9" .Values.controller.image.tag) .Values.controller.publishService.enabled }}
|
||||
- --publish-service={{ template "controller.publishServicePath" . }}
|
||||
{{- end }}
|
||||
{{- if (contains "0.9" .Values.controller.image.tag) }}
|
||||
- --election-id={{ .Values.controller.electionID }}
|
||||
{{- end }}
|
||||
{{- if (contains "0.9" .Values.controller.image.tag) }}
|
||||
- --ingress-class={{ .Values.controller.ingressClass }}
|
||||
{{- end }}
|
||||
{{- if (contains "0.9" .Values.controller.image.tag) }}
|
||||
- --configmap={{ .Release.Namespace }}/{{ template "controller.fullname" . }}
|
||||
{{- else }}
|
||||
@@ -97,7 +100,6 @@ spec:
|
||||
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 }}"
|
||||
@@ -118,9 +120,11 @@ spec:
|
||||
resources:
|
||||
{{ toYaml .Values.statsExporter.resources | indent 12 }}
|
||||
{{- end }}
|
||||
hostNetwork: {{ .Values.controller.hostNetwork }}
|
||||
{{- if .Values.controller.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.controller.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ if .Values.rbac.create }}{{ template "fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
|
||||
terminationGracePeriodSeconds: 60
|
||||
{{- end }}
|
||||
|
||||
@@ -13,19 +13,16 @@ spec:
|
||||
replicas: {{ .Values.controller.replicaCount }}
|
||||
template:
|
||||
metadata:
|
||||
{{- if .Values.controller.podAnnotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.controller.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
checksum/config: {{ include (print $.Template.BasePath "/controller-configmap.yaml") . | sha256sum }}
|
||||
{{- if .Values.controller.podAnnotations }}
|
||||
{{ toYaml .Values.controller.podAnnotations | indent 8}}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: {{ template "name" . }}
|
||||
component: "{{ .Values.controller.name }}"
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
hostNetwork: {{ .Values.controller.hostNetwork }}
|
||||
{{- if .Values.controller.serviceAccountName }}
|
||||
serviceAccountName: {{ .Values.controller.serviceAccountName }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "name" . }}-{{ .Values.controller.name }}
|
||||
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
|
||||
@@ -36,6 +33,12 @@ spec:
|
||||
{{- if and (contains "0.9" .Values.controller.image.tag) .Values.controller.publishService.enabled }}
|
||||
- --publish-service={{ template "controller.publishServicePath" . }}
|
||||
{{- end }}
|
||||
{{- if (contains "0.9" .Values.controller.image.tag) }}
|
||||
- --election-id={{ .Values.controller.electionID }}
|
||||
{{- end }}
|
||||
{{- if (contains "0.9" .Values.controller.image.tag) }}
|
||||
- --ingress-class={{ .Values.controller.ingressClass }}
|
||||
{{- end }}
|
||||
{{- if (contains "0.9" .Values.controller.image.tag) }}
|
||||
- --configmap={{ .Release.Namespace }}/{{ template "controller.fullname" . }}
|
||||
{{- else }}
|
||||
@@ -98,7 +101,6 @@ spec:
|
||||
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 }}"
|
||||
@@ -119,9 +121,11 @@ spec:
|
||||
resources:
|
||||
{{ toYaml .Values.statsExporter.resources | indent 12 }}
|
||||
{{- end }}
|
||||
hostNetwork: {{ .Values.controller.hostNetwork }}
|
||||
{{- if .Values.controller.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.controller.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ if .Values.rbac.create }}{{ template "fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
|
||||
terminationGracePeriodSeconds: 60
|
||||
{{- end }}
|
||||
|
||||
@@ -33,5 +33,5 @@ spec:
|
||||
app: {{ template "name" . }}
|
||||
component: "{{ .Values.defaultBackend.name }}"
|
||||
release: {{ .Release.Name }}
|
||||
type: ClusterIP
|
||||
type: "{{ .Values.defaultBackend.service.type }}"
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{{- if .Values.rbac.create -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: Role
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "fullname" . }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
- namespaces
|
||||
- pods
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
resourceNames:
|
||||
- {{ .Values.controller.electionID }}-{{ .Values.controller.ingressClass }}
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- endpoints
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if .Values.rbac.create -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "fullname" . }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if .Values.rbac.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "fullname" . }}
|
||||
{{- end -}}
|
||||
@@ -20,6 +20,19 @@ controller:
|
||||
##
|
||||
defaultBackendService: ""
|
||||
|
||||
## Optionally specify the secret name for default SSL certificate
|
||||
## Must be <namespace>/<secret_name>
|
||||
##
|
||||
defaultSSLCertificate: ""
|
||||
|
||||
## Election ID to use for status update
|
||||
##
|
||||
electionID: ingress-controller-leader
|
||||
|
||||
## Name of the ingress class to route through this controller
|
||||
##
|
||||
ingressClass: nginx
|
||||
|
||||
## Allows customization of the external service
|
||||
## the ingress will be bound to via DNS
|
||||
publishService:
|
||||
@@ -46,11 +59,6 @@ controller:
|
||||
##
|
||||
nodeSelector: {}
|
||||
|
||||
## Run the controller via this service account
|
||||
## Ref: https://github.com/kubernetes/ingress/tree/master/examples/rbac/nginx
|
||||
##
|
||||
serviceAccountName: ""
|
||||
|
||||
## Annotations to be added to controller pods
|
||||
##
|
||||
podAnnotations: {}
|
||||
@@ -162,6 +170,11 @@ defaultBackend:
|
||||
servicePort: 80
|
||||
type: ClusterIP
|
||||
|
||||
## Enable RBAC as per https://github.com/kubernetes/ingress/tree/master/examples/rbac/nginx and https://github.com/kubernetes/ingress/issues/266
|
||||
rbac:
|
||||
create: false
|
||||
serviceAccountName: default
|
||||
|
||||
## If controller.stats.enabled = true, Prometheus metrics will be exported
|
||||
## Ref: https://github.com/hnlq715/nginx-vts-exporter
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user