Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support configure gateway.tls and adding ingress class #657

Merged
merged 7 commits into from
Nov 6, 2023
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
9 changes: 9 additions & 0 deletions charts/apisix-ingress-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ The same for container level, you need to set:
| gateway.nginx.workerConnections | string | `"10620"` | Nginx worker connections |
| gateway.nginx.workerProcesses | string | `"auto"` | Nginx worker processes |
| gateway.nginx.workerRlimitNofile | string | `"20480"` | Nginx workerRlimitNoFile |
| gateway.tls.additionalContainerPorts | list | `[]` | Support multiple https ports, See [Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L99) |
| gateway.tls.certCAFilename | string | `""` | Filename be used in the gateway.tls.existingCASecret |
| gateway.tls.containerPort | int | `9443` | |
| gateway.tls.enabled | bool | `false` | |
| gateway.tls.existingCASecret | string | `""` | Specifies the name of Secret contains trusted CA certificates in the PEM format used to verify the certificate when APISIX needs to do SSL/TLS handshaking with external services (e.g. etcd) |
| gateway.tls.fallbackSNI | string | `""` | Define SNI to fallback if none is presented by client |
| gateway.tls.http2.enabled | bool | `true` | |
| gateway.tls.servicePort | int | `443` | |
| gateway.tls.sslProtocols | string | `"TLSv1.2 TLSv1.3"` | TLS protocols allowed to use. |
| gateway.type | string | `"NodePort"` | Apache APISIX service type for user access itself |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"apache/apisix-ingress-controller"` | |
Expand Down
17 changes: 17 additions & 0 deletions charts/apisix-ingress-controller/templates/apisix-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ data:
worker_rlimit_nofile: {{ .Values.gateway.nginx.workerRlimitNofile }} # the number of files a worker process can open, should be larger than worker_connections
event:
worker_connections: {{ .Values.gateway.nginx.workerConnections }}

ssl:
enable: {{ .Values.gateway.tls.enabled }}
listen:
- port: {{ .Values.gateway.tls.containerPort }}
enable_http2: {{ .Values.gateway.tls.http2.enabled }}
{{- with .Values.gateway.tls.additionalContainerPorts }}
{{- toYaml . | nindent 10}}
{{- end }}
ssl_protocols: {{ .Values.gateway.tls.sslProtocols | quote }}
ssl_ciphers: "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA"
{{- if and .Values.gateway.tls.enabled .Values.gateway.tls.existingCASecret }}
ssl_trusted_certificate: "/usr/local/apisix/conf/ssl/{{ .Values.gateway.tls.certCAFilename }}"
{{- end }}
{{- if and .Values.gateway.tls.enabled .Values.gateway.tls.fallbackSNI }}
fallback_sni: {{ .Values.gateway.tls.fallbackSNI | quote }}
{{- end }}

plugins: # plugin list (sorted by priority)
- real-ip # priority: 23000
Expand Down
2 changes: 1 addition & 1 deletion charts/apisix-ingress-controller/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ spec:
containerPort: 9180
protocol: TCP
- name: https
containerPort: 9443
containerPort: {{ .Values.gateway.tls.containerPort }}
protocol: TCP
{{- if .Values.serviceMonitor.enabled }}
- containerPort: 9091
Expand Down
6 changes: 6 additions & 0 deletions charts/apisix-ingress-controller/templates/ingress-class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: {{ .Values.config.kubernetes.ingressClass | quote }}
spec:
controller: apisix.apache.org/apisix-ingress # fix: https://github.com/apache/apisix-ingress-controller/issues/1653
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ spec:
targetPort: 9080
- name: https
protocol: TCP
port: 443
targetPort: 9443
port: {{ .Values.gateway.tls.servicePort }}
targetPort: {{ .Values.gateway.tls.containerPort }}
selector:
{{- include "apisix-ingress-controller.selectorLabels" . | nindent 4 }}
type: {{ .Values.gateway.type }} # LoadBalancer or NodePort
Expand Down
19 changes: 19 additions & 0 deletions charts/apisix-ingress-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,22 @@ gateway:
errorLog: stderr
# -- Nginx error logs level
errorLogLevel: warn
tls:
enabled: false
servicePort: 443
containerPort: 9443
# -- Support multiple https ports, See [Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L99)
additionalContainerPorts: []
# - ip: 127.0.0.3 # Specific IP, If not set, the default value is `0.0.0.0`.
# port: 9445
# enable_http2: true
# -- Specifies the name of Secret contains trusted CA certificates in the PEM format used to verify the certificate when APISIX needs to do SSL/TLS handshaking with external services (e.g. etcd)
existingCASecret: ""
# -- Filename be used in the gateway.tls.existingCASecret
certCAFilename: ""
http2:
enabled: true
# -- TLS protocols allowed to use.
sslProtocols: "TLSv1.2 TLSv1.3"
# -- Define SNI to fallback if none is presented by client
fallbackSNI: ""
Loading