Skip to content

Commit

Permalink
feat: Provide support for enabling ingress controller (experimental, …
Browse files Browse the repository at this point in the history
…breaking) (#245)

* Basic setup without RBAC

* RBAC support

* Add link to repo

Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com>

---------

Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com>
  • Loading branch information
tomkerkhove authored Sep 9, 2023
1 parent 2e5cf07 commit a1d6121
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ data:
{{- if .Values.gateway.auth.azureAd.authority }}
config.service.auth.azureAd.authority : {{ .Values.gateway.auth.azureAd.authority | quote }}
{{- end }}
{{- end }}
{{- if .Values.ingress.controller.enabled }}
k8s.ingress.enabled : {{ .Values.ingress.controller.enabled | quote }}
k8s.ingress.namespace : {{ .Values.ingress.controller.namespace | default ( .Release.Namespace ) | quote }}
{{- end }}
telemetry.metrics.cloud: {{ .Values.observability.azureMonitor.metrics.enabled | quote }}
telemetry.logs.std: {{ .Values.observability.logs.std.format | quote }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{- $doesSupportStableIngress := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
{{- if and (.Values.ingress.controller.enabled) ($doesSupportStableIngress) -}}
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: {{ include "azure-api-management-gateway.fullname" . }}
labels:
{{- include "azure-api-management-gateway.labels" . | nindent 4 }}
{{- with .Values.ingress.controller.ingressClass.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
controller: {{ .Values.ingress.controller.ingressClass.controller | quote }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "azure-api-management-gateway.fullname" . }}-rbac
labels:
{{- include "azure-api-management-gateway.labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- secrets
- namespaces
verbs:
- get
- watch
- get
- apiGroups:
- ""
resources:
- services
verbs:
- get
- watch
- get
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- list
- watch
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "azure-api-management-gateway.fullname" . }}
labels:
{{- include "azure-api-management-gateway.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "azure-api-management-gateway.fullname" . }}-rbac
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccountName }}
namespace: {{ .Release.Namespace }}
{{- end }}

This file was deleted.

21 changes: 8 additions & 13 deletions helm-charts/azure-api-management-gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,14 @@ service:
annotations: {}

ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
useHttpsBackend: false
paths: []

tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
# Experimental feature: See https://github.com/Azure/api-management-self-hosted-gateway-ingress
controller:
enabled: false
namespace: ""
annotations: []
ingressClass:
controller: "azure-api-management/gateway"
annotations: []

serviceAccountName: default

Expand Down

0 comments on commit a1d6121

Please sign in to comment.