From 9902ac522d53856fd1974a624299700ec7eda2b3 Mon Sep 17 00:00:00 2001 From: pasant9 Date: Thu, 16 Mar 2023 09:19:13 +0530 Subject: [PATCH] Add ingress for websocket APIs --- .../am/wso2am-pattern-1-am-service.yaml | 6 +++ ...wso2am-pattern-1-am-websocket-ingress.yaml | 41 +++++++++++++++++++ advanced/am-pattern-1/values.yaml | 7 ++++ advanced/am-pattern-2/values.yaml | 7 ++++ .../am/wso2am-websocket-ingress.yaml | 41 +++++++++++++++++++ simple/am-single/values.yaml | 9 +++- 6 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 advanced/am-pattern-1/templates/am/wso2am-pattern-1-am-websocket-ingress.yaml create mode 100644 simple/am-single/templates/am/wso2am-websocket-ingress.yaml diff --git a/advanced/am-pattern-1/templates/am/wso2am-pattern-1-am-service.yaml b/advanced/am-pattern-1/templates/am/wso2am-pattern-1-am-service.yaml index 3e083ae1..82520c2c 100644 --- a/advanced/am-pattern-1/templates/am/wso2am-pattern-1-am-service.yaml +++ b/advanced/am-pattern-1/templates/am/wso2am-pattern-1-am-service.yaml @@ -41,3 +41,9 @@ spec: - name: websub-https protocol: TCP port: 8021 + - name: websocket-http + protocol: TCP + port: 9099 + - name: websub-https + protocol: TCP + port: 8099 diff --git a/advanced/am-pattern-1/templates/am/wso2am-pattern-1-am-websocket-ingress.yaml b/advanced/am-pattern-1/templates/am/wso2am-pattern-1-am-websocket-ingress.yaml new file mode 100644 index 00000000..cbb1dd2e --- /dev/null +++ b/advanced/am-pattern-1/templates/am/wso2am-pattern-1-am-websocket-ingress.yaml @@ -0,0 +1,41 @@ +# Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- if .Values.wso2.deployment.am.ingress.websocket.enabled }} + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ template "am-pattern-1.resource.prefix" . }}-am-websocket-ingress + namespace : {{ .Release.Namespace }} +{{- if .Values.wso2.deployment.am.ingress.websocket.annotations }} + annotations: +{{ toYaml .Values.wso2.deployment.am.ingress.websocket.annotations | indent 4 }} +{{- end }} +spec: + tls: + - hosts: + - {{ .Values.wso2.deployment.am.ingress.websocket.hostname }} + rules: + - host: {{ .Values.wso2.deployment.am.ingress.websocket.hostname }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ template "am-pattern-1.resource.prefix" . }}-am-service + port: + number: 8099 +{{- end -}} diff --git a/advanced/am-pattern-1/values.yaml b/advanced/am-pattern-1/values.yaml index eb296f77..f78d7d39 100644 --- a/advanced/am-pattern-1/values.yaml +++ b/advanced/am-pattern-1/values.yaml @@ -131,6 +131,13 @@ wso2: annotations: kubernetes.io/ingress.class: "nginx" nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" + websocket: + enabled: true + hostname: "websocket.am.wso2.com" + # Annotations for the API Manager WebSocket service Ingress + annotations: + kubernetes.io/ingress.class: "nginx" + nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" db: hostname: wso2am-mysql-db-service port: 3306 diff --git a/advanced/am-pattern-2/values.yaml b/advanced/am-pattern-2/values.yaml index 34a93857..c73ef1ea 100644 --- a/advanced/am-pattern-2/values.yaml +++ b/advanced/am-pattern-2/values.yaml @@ -200,6 +200,13 @@ am-pattern-1: annotations: kubernetes.io/ingress.class: "nginx" nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" + websocket: + enabled: true + hostname: "websocket.am.wso2.com" + # Annotations for the API Manager WebSocket service Ingress + annotations: + kubernetes.io/ingress.class: "nginx" + nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" db: hostname: wso2am-mysql-db-service port: 3306 diff --git a/simple/am-single/templates/am/wso2am-websocket-ingress.yaml b/simple/am-single/templates/am/wso2am-websocket-ingress.yaml new file mode 100644 index 00000000..ebcabfb2 --- /dev/null +++ b/simple/am-single/templates/am/wso2am-websocket-ingress.yaml @@ -0,0 +1,41 @@ +# Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- if .Values.wso2.deployment.am.ingress.websocket.enabled }} + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ template "am-single-node.resource.prefix" . }}-am-websocket-ingress + namespace : {{ .Release.Namespace }} +{{- if .Values.wso2.deployment.am.ingress.websocket.annotations }} + annotations: +{{ toYaml .Values.wso2.deployment.am.ingress.websocket.annotations | indent 4 }} +{{- end }} +spec: + tls: + - hosts: + - {{ .Values.wso2.deployment.am.ingress.websocket.hostname }} + rules: + - host: {{ .Values.wso2.deployment.am.ingress.websocket.hostname }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ template "am-single-node.resource.prefix" . }}-am-service + port: + number: 8099 +{{- end -}} diff --git a/simple/am-single/values.yaml b/simple/am-single/values.yaml index eedf9a87..054320c8 100644 --- a/simple/am-single/values.yaml +++ b/simple/am-single/values.yaml @@ -127,7 +127,14 @@ wso2: websub: enabled: true hostname: "websub.am.wso2.com" - # Annotations for the API Manager Gateway service Ingress + # Annotations for the API Manager WebSub service Ingress + annotations: + kubernetes.io/ingress.class: "nginx" + nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" + websocket: + enabled: true + hostname: "websocket.am.wso2.com" + # Annotations for the API Manager WebSocket service Ingress annotations: kubernetes.io/ingress.class: "nginx" nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"