Skip to content

Commit

Permalink
Add ingress for websocket APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
PasanT9 committed Mar 16, 2023
1 parent fe887cf commit 9902ac5
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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 -}}
7 changes: 7 additions & 0 deletions advanced/am-pattern-1/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions advanced/am-pattern-2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 41 additions & 0 deletions simple/am-single/templates/am/wso2am-websocket-ingress.yaml
Original file line number Diff line number Diff line change
@@ -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 -}}
9 changes: 8 additions & 1 deletion simple/am-single/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9902ac5

Please sign in to comment.