Skip to content

Commit

Permalink
Merge pull request #1764 from Tharsanan1/template-vhosts
Browse files Browse the repository at this point in the history
Template vhosts
  • Loading branch information
Tharsanan1 authored Sep 26, 2023
2 parents 699299a + 730d17c commit f686e87
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions helm-charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ A Helm chart for APK components
| wso2.apk.dp.configdeployer.deployment.configs.tls.secretName | string | `""` | TLS secret name for runtime public certificate. |
| wso2.apk.dp.configdeployer.deployment.configs.tls.certKeyFilename | string | `""` | TLS certificate file name. |
| wso2.apk.dp.configdeployer.deployment.configs.tls.certFilename | string | `""` | TLS certificate file name. |
| wso2.apk.dp.configdeployer.vhosts | list | `[{"hosts":["gw.wso2.com"],"name":"default","type":"production"},{"hosts":["sandbox.gw.wso2.com"],"name":"default","type":"sandbox"}]` | List of vhost |
| wso2.apk.dp.adapter.deployment.resources.requests.memory | string | `"128Mi"` | CPU request for the container |
| wso2.apk.dp.adapter.deployment.resources.requests.cpu | string | `"100m"` | Memory request for the container |
| wso2.apk.dp.adapter.deployment.resources.limits.memory | string | `"1028Mi"` | CPU limit for the container |
Expand Down
20 changes: 19 additions & 1 deletion helm-charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,22 @@ env:
{{- $list = append $list (printf "\"%s\"" .) }}
{{- end }}
{{- join ", " $list }}
{{- end }}
{{- end }}

{{- define "generateVhosts" -}}
{{- if . -}}
{{- $vhosts := . -}}
{{- range $vhost := $vhosts }}
{{- printf "[[vhosts]]\n" -}}
{{- printf " name = \"%s\"\n" $vhost.name -}}
{{- print " hosts = [" -}}
{{- $len := len $vhost.hosts -}}
{{- range $i, $host := $vhost.hosts }}
{{- printf "\"%s\"" $host -}}
{{- if lt $i (sub $len 1) }},{{ end }}
{{- end }}
{{- print "]\n" -}}
{{- printf " type = \"%s\"\n" $vhost.type -}}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ data:
[wso2.config_deployer_service.gatewayConfiguration]
name = "default"
listenerName = "httpslistener"
{{ include "generateVhosts" .Values.wso2.apk.dp.configdeployer.vhosts | indent 4 }}
{{if and .Values.wso2.apk.dp.partitionServer .Values.wso2.apk.dp.partitionServer.enabled}}
[wso2.config_deployer_service.partitionServiceConfiguration]
enabled = true
Expand Down
8 changes: 8 additions & 0 deletions helm-charts/values.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ wso2:
certKeyFilename: ""
# -- TLS certificate file name.
certFilename: ""
# -- List of vhost
vhosts:
- name: "default"
hosts: ["gw.wso2.com"]
type: "production"
- name: "default"
hosts: ["sandbox.gw.wso2.com"]
type: "sandbox"
adapter:
deployment:
resources:
Expand Down

0 comments on commit f686e87

Please sign in to comment.