[bitnami/tomcat] Add service.port to values.yaml

Signed-off-by: Javier J. Salmeron Garcia <jsalmeron@bitnami.com>
This commit is contained in:
Javier J. Salmeron Garcia
2018-11-21 12:18:59 +01:00
parent 6ba2a3262b
commit 44f7b394d6
5 changed files with 41 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
name: tomcat name: tomcat
version: 1.1.2 version: 2.0.0
appVersion: 8.5.35 appVersion: 8.5.35
description: Chart for Apache Tomcat description: Chart for Apache Tomcat
keywords: keywords:

View File

@@ -56,7 +56,11 @@ The following tables lists the configurable parameters of the Tomcat chart and t
| `tomcatUsername` | Tomcat admin user | `user` | | `tomcatUsername` | Tomcat admin user | `user` |
| `tomcatPassword` | Tomcat admin password | _random 10 character alphanumeric string_ | | `tomcatPassword` | Tomcat admin password | _random 10 character alphanumeric string_ |
| `tomcatAllowRemoteManagement` | Enable remote access to management interface | `0` (disabled) | | `tomcatAllowRemoteManagement` | Enable remote access to management interface | `0` (disabled) |
| `serviceType` | Kubernetes Service type | `LoadBalancer` | | `service.type` | Kubernetes Service type | `LoadBalancer` |
| `service.port` | Service HTTP port | `80` |
| `service.nodePorts.http` | Kubernetes http node port | `""` |
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
| `service.loadBalancerIP` | LoadBalancer service IP address | `""` |
| `persistence.enabled` | Enable persistence using PVC | `true` | | `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.storageClass` | PVC Storage Class for Tomcat volume | `nil` (uses alpha storage class annotation) | | `persistence.storageClass` | PVC Storage Class for Tomcat volume | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | PVC Access Mode for Tomcat volume | `ReadWriteOnce` | | `persistence.accessMode` | PVC Access Mode for Tomcat volume | `ReadWriteOnce` |

View File

@@ -3,24 +3,25 @@
1. Get the Tomcat URL by running: 1. Get the Tomcat URL by running:
{{- if contains "NodePort" .Values.serviceType }} {{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT/ echo http://$NODE_IP:$NODE_PORT/
{{- else if contains "LoadBalancer" .Values.serviceType }} {{- else if contains "LoadBalancer" .Values.service.type }}
** Please ensure an external IP is associated to the {{ template "fullname" . }} service before proceeding ** ** Please ensure an external IP is associated to the {{ template "fullname" . }} service before proceeding **
** Watch the status using: kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }} ** ** Watch the status using: kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }} **
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo URL : http://$SERVICE_IP/ {{- $port:=.Values.service.port | toString }}
echo Management URL : http://$SERVICE_IP/manager echo URL : http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/
{{- else if contains "ClusterIP" .Values.serviceType }} echo Management URL : http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/manager
{{- else if contains "ClusterIP" .Values.service.type }}
echo URL : http://127.0.0.1:8080/ echo URL : http://127.0.0.1:8080/
echo Management URL : http://127.0.0.1:8080/manager echo Management URL : http://127.0.0.1:8080/manager
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "fullname" . }} 8080:8080 kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "fullname" . }} 8080:{{ .Values.service.port }}
{{- end }} {{- end }}
2. Login with the following credentials 2. Login with the following credentials

View File

@@ -8,10 +8,19 @@ metadata:
release: "{{ .Release.Name }}" release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}" heritage: "{{ .Release.Service }}"
spec: spec:
type: {{ .Values.serviceType }} type: {{ .Values.service.type }}
{{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
ports: ports:
- name: http - name: http
port: 80 port: {{ .Values.service.port }}
targetPort: http targetPort: http
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePorts.http)))}}
nodePort: {{ .Values.service.nodePorts.http }}
{{- end }}
selector: selector:
app: {{ template "fullname" . }} app: {{ template "fullname" . }}

View File

@@ -46,7 +46,21 @@ tomcatAllowRemoteManagement: 0
## Kubernetes configuration ## Kubernetes configuration
## For minikube, set this to NodePort, elsewhere use LoadBalancer ## For minikube, set this to NodePort, elsewhere use LoadBalancer
## ##
serviceType: LoadBalancer service:
type: LoadBalancer
# HTTP Port
port: 80
##
## loadBalancerIP:
## nodePorts:
## http: <to set explicitly, choose port between 30000-32767>
## https: <to set explicitly, choose port between 30000-32767>
nodePorts:
http: ""
## Enable client source IP preservation
## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
##
externalTrafficPolicy: Cluster
## Enable persistence using Persistent Volume Claims ## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/