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

Introduce Helm Chart for WSO2 API Microgateway Deployment #21

Open
wants to merge 12 commits into
base: 3.2.0
Choose a base branch
from
4 changes: 2 additions & 2 deletions helm/microgateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

apiVersion: v1
appVersion: "3.0.1"
appVersion: "3.2.0"
description: A Helm chart for WSO2 API Micro Gateway
name: microgateway
version: 3.0.1-1
version: 3.2.0-1
217 changes: 118 additions & 99 deletions helm/microgateway/README.md

Large diffs are not rendered by default.

52 changes: 0 additions & 52 deletions helm/microgateway/confs/logstash/logstash.conf

This file was deleted.

16 changes: 0 additions & 16 deletions helm/microgateway/confs/logstash/logstash.yml

This file was deleted.

90 changes: 0 additions & 90 deletions helm/microgateway/confs/micro-gw.conf

This file was deleted.

4 changes: 0 additions & 4 deletions helm/microgateway/logging/init.sh

This file was deleted.

6 changes: 3 additions & 3 deletions helm/microgateway/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Please follow these steps to assess Microgateway.
kubectl get ing -n {{ .Release.Namespace }}

NAME HOSTS ADDRESS PORTS AGE
wso2micro-gw-ingress {{ .Release.Name }} <EXTERNAL-IP> 80, 443 3m
wso2micro-gw-ingress {{ .Values.wso2.deployment.wso2microgw.ingress.hostname }} <EXTERNAL-IP> 80, 443 3m

2. Add the above host as an entry in /etc/hosts file as follows:

<EXTERNAL-IP> {{ .Release.Name }}
<EXTERNAL-IP> {{ .Values.wso2.deployment.wso2microgw.ingress.hostname }}

Please refer the official documentation at https://docs.wso2.com/display/MG301/API+Microgateway+Documentation for additional information on WSO2 API Microgateway.
Please refer the official documentation at https://docs.wso2.com/display/MG320 for additional information on WSO2 API Microgateway.
53 changes: 50 additions & 3 deletions helm/microgateway/templates/logstash-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,55 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: logstash-conf
namespace : {{ .Release.Namespace }}
name: logstash-conf
namespace : {{ .Release.Namespace }}
{{ if .Values.wso2.centralizedLogging.logstash.config }}
data:
{{- (.Files.Glob "confs/logstash/logstash.conf").AsConfig | nindent 2 }}
{{- range $index, $content := .Values.wso2.centralizedLogging.logstash.config.logstashConf }}
{{ $index }}: |-
{{ tpl $content $ | indent 4 }}
{{- end }}

{{ else }}
data:
logstash.conf: |-
input {
file {
add_field => {
instance_name => "${NODE_ID}"
instance_IP => "${NODE_IP}"
}
type => "wso2"
path => [ '/usr/share/logstash/wso2-logs/microgw.log' ]
sincedb_path => "/usr/share/logstash/wso2-logs/sincedb"
start_position => "beginning"
mode => "tail"
codec => multiline {
pattern => "^\d{4}-\d{1,2}-\d{1,2}"
negate => true
what => "previous"
}
}
}

filter {
if [type] == "wso2" {
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:logdate}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{SPACE}\[%{GREEDYDATA:module}\]%{SPACE}-%{SPACE}%{GREEDYDATA:message}" ]
}
date {
match => [ "logdate", "YYYY-MM-dd HH:mm:ss,SSS" ]
}
}
}

output {
elasticsearch {
hosts => "${ELASTICSEARCH_HOST}"
user => "${ELASTICSEARCH_USERNAME}"
password => "${ELASTICSEARCH_PASSWORD}"
index => "${NODE_ID}-${NODE_IP}-%{+YYYY.MM.dd}"
}
}
{{ end }}
{{ end }}
19 changes: 15 additions & 4 deletions helm/microgateway/templates/logstash-yml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: logstash-yml
namespace : {{ .Release.Namespace }}
name: logstash-yml
namespace : {{ .Release.Namespace }}
{{ if .Values.wso2.centralizedLogging.logstash.config }}
data:
{{- (.Files.Glob "confs/logstash/logstash.yml").AsConfig | nindent 2 }}
{{ end }}
{{- range $index, $content := .Values.wso2.centralizedLogging.logstash.config.logstashYaml }}
{{ $index }}: |-
{{ tpl $content $ | indent 4 }}
{{- end }}

{{ else }}
data:
logstash.yml: |-
http.host: "0.0.0.0"
path.config: /usr/share/logstash/pipeline
{{- end }}
{{- end }}
82 changes: 74 additions & 8 deletions helm/microgateway/templates/microgateway-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,80 @@ kind: ConfigMap
metadata:
name: microgateway-conf
namespace : {{ .Release.Namespace }}
{{ if .Values.wso2.deployment.wso2microgw.config }}
data:
{{- $file := .Files }}
{{- range $path, $byte := .Files.Glob "confs/*" }}
{{- $list := $path | splitList "/"}}
{{- $length := len $list }}
{{- $last := add $length -1 }}
{{ index $list $last }}: |-
{{- range $file.Lines $path }}
{{ . }}
{{- range $index, $content := .Values.wso2.deployment.wso2microgw.config }}
{{ $index }}: |-
{{ tpl $content $ | indent 4 }}
{{- end }}

{{ else }}
data:
micro-gw.conf: |-
[listenerConfig]
httpPort = 9090
httpsPort = 9095
keyStorePath = "${mgw-runtime.home}/runtime/bre/security/ballerinaKeystore.p12"
keyStorePassword = "ballerina"
trustStorePath = "${mgw-runtime.home}/runtime/bre/security/ballerinaTruststore.p12"
trustStorePassword = "ballerina"
tokenListenerPort = 9096

[keyManager]
serverUrl = "https://localhost:9443"
tokenContext = "oauth2"
[keymanager.security.basic]
enabled = true
username = "admin"
password = "admin"

[[jwtTokenConfig]]
issuer = "https://localhost:9443/oauth2/token"
certificateAlias = "wso2apim310"
validateSubscription = false
consumerKeyClaim = "aud"

[analytics]
[analytics.fileUpload]
enable = false

[b7a.users]
[b7a.users.admin]
password = "d033e22ae348aeb5660fc2140aec35850c4da997"

[httpClients]
verifyHostname = true

[apikey.issuer]
[apikey.issuer.tokenConfig]
enabled = true
issuer = "https://localhost:9095/apikey"
certificateAlias = "ballerina"
validityTime = -1

# Throttling configurations
[throttlingConfig]
enabledGlobalTMEventPublishing = false
jmsConnectionProviderUrl = "amqp://admin:admin@carbon/carbon?brokerlist='tcp://localhost:5672'"
# Throttling configurations related to event publishing using a binary connection
[throttlingConfig.binary]
enabled = true
[[throttlingConfig.binary.URLGroup]]
receiverURL = "tcp://localhost:9611"
authURL = "ssl://localhost:9711"

[apim.eventHub]
enable = false
serviceUrl = "https://localhost:9443"
internalDataContext="/internal/data/v1/"
username="admin"
password="admin"
eventListeningEndpoints = "amqp://admin:admin@carbon/carbon?brokerlist='tcp://localhost:5672'"

[security]
validateSubscriptions = false

# Enable http2 for the microgateway listeners.
[http2]
enable = true
{{- end }}
2 changes: 2 additions & 0 deletions helm/microgateway/templates/microgateway-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ spec:
deployment: wso2micro-gw
template:
metadata:
annotations:
checksum.wso2microgw.conf: {{ include (print $.Template.BasePath "/microgateway-conf.yaml") . | sha256sum }}
labels:
deployment: wso2micro-gw
spec:
Expand Down
12 changes: 5 additions & 7 deletions helm/microgateway/templates/microgateway-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ kind: Ingress
metadata:
name: wso2micro-gw-ingress
namespace : {{ .Release.Namespace }}
{{- if .Values.wso2.deployment.wso2microgw.ingress.annotations }}
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "route"
nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"
{{ toYaml .Values.wso2.deployment.wso2microgw.ingress.annotations | indent 4 }}
{{- end }}
spec:
tls:
- hosts:
- {{ .Release.Name }}
- {{ .Values.wso2.deployment.wso2microgw.ingress.hostname }}
rules:
- host: {{ .Release.Name }}
- host: {{ .Values.wso2.deployment.wso2microgw.ingress.hostname }}
http:
paths:
- path: /
Expand Down
Loading