Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions charts/apisix-ingress-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,8 @@ The same for container level, you need to set:
| serviceMonitor.labels | object | `{}` | @param serviceMonitor.labels ServiceMonitor extra labels |
| serviceMonitor.metricRelabelings | object | `{}` | @param serviceMonitor.metricRelabelings MetricRelabelConfigs to apply to samples before ingestion. ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs |
| serviceMonitor.namespace | string | `"monitoring"` | @param serviceMonitor.namespace Namespace in which to create the ServiceMonitor |
| webhook.certificate.provided | bool | `false` | Set to true if you want to provide your own certificate |
| webhook.enabled | bool | `true` | Enable or disable admission webhook |
| webhook.failurePolicy | string | `"Fail"` | Failure policy for the webhook (Fail or Ignore) |
| webhook.port | int | `9443` | The port for the webhook server to listen on |
| webhook.timeoutSeconds | int | `10` | Timeout in seconds for the webhook |
20 changes: 20 additions & 0 deletions charts/apisix-ingress-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,23 @@ app.kubernetes.io/name: {{ include "apisix-ingress-controller-manager.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}

{{/*
Webhook service name - ensure it stays within 63 character limit
*/}}
{{- define "apisix-ingress-controller-manager.webhook.serviceName" -}}
{{- $suffix := "-webhook-svc" -}}
{{- $maxLen := sub 63 (len $suffix) | int -}}
{{- $baseName := include "apisix-ingress-controller-manager.name.fullname" . | trunc $maxLen | trimSuffix "-" -}}
{{- printf "%s%s" $baseName $suffix -}}
{{- end }}

{{/*
Webhook secret name - ensure it stays within 63 character limit
*/}}
{{- define "apisix-ingress-controller-manager.webhook.secretName" -}}
{{- $suffix := "-webhook-cert" -}}
{{- $maxLen := sub 63 (len $suffix) | int -}}
{{- $baseName := include "apisix-ingress-controller-manager.name.fullname" . | trunc $maxLen | trimSuffix "-" -}}
{{- printf "%s%s" $baseName $suffix -}}
{{- end }}
31 changes: 16 additions & 15 deletions charts/apisix-ingress-controller/templates/cluster_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ rules:
- gateway.networking.k8s.io
resources:
- gatewayclasses
Comment thread
ronething marked this conversation as resolved.
- gateways
verbs:
- get
- list
Expand All @@ -105,51 +104,53 @@ rules:
resources:
- gatewayclasses/status
- gateways/status
- grpcroutes/status
- httproutes/status
- tcproutes/status
- udproutes/status
- tlsroutes/status
- referencegrants/status
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- gateways
- grpcroutes
- httproutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- tcproutes
- udproutes
- tlsroutes
- referencegrants
verbs:
- get
- list
- update
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingressclasses
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
- ingresses/status
verbs:
- get
- list
- update
- watch
- apiGroups:
- networking.k8s.io
- ""
resources:
- ingresses/status
- endpoints
verbs:
- get
- update
- list
- watch

---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
8 changes: 8 additions & 0 deletions charts/apisix-ingress-controller/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ data:
type: {{ .Values.config.provider.type | default "apisix" }}
sync_period: {{ .Values.config.provider.syncPeriod | default "1s" }}
init_sync_delay: {{ .Values.config.provider.initSyncDelay | default "20m" }}
{{- if .Values.webhook.enabled }}
webhook:
enable: true
port: {{ .Values.webhook.port }}
tls_cert_file: "tls.crt"
tls_key_file: "tls.key"
Comment thread
ronething marked this conversation as resolved.
tls_cert_dir: "/certs"
{{- end }}
15 changes: 15 additions & 0 deletions charts/apisix-ingress-controller/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,20 @@ spec:
- containerPort: {{ splitList ":" .Values.config.metricsAddr | last | int }}
name: metrics
protocol: TCP
{{- if .Values.webhook.enabled }}
- containerPort: {{ .Values.webhook.port }}
name: webhook
protocol: TCP
{{- end }}
volumeMounts:
- name: {{ .Release.Name }}-ingress-config
mountPath: /app/conf/config.yaml
subPath: config.yaml
{{- if .Values.webhook.enabled }}
- name: webhook-certs
mountPath: /certs
readOnly: true
{{- end }}
livenessProbe:
httpGet:
path: /healthz
Expand Down Expand Up @@ -136,6 +146,11 @@ spec:
- name: {{ .Release.Name }}-ingress-config
configMap:
name: {{ .Release.Name }}-ingress-config
{{- if .Values.webhook.enabled }}
- name: webhook-certs
secret:
secretName: {{ include "apisix-ingress-controller-manager.webhook.secretName" . }}
{{- end }}
securityContext:
runAsNonRoot: false
serviceAccountName: {{ .Release.Name }}
Expand Down
Loading