Skip to content

Commit

Permalink
Tomcat improvements (helm#7868)
Browse files Browse the repository at this point in the history
* [stable/tomcat] Allow specifying image.pullSecrets

Signed-off-by: Martin Mauch <[email protected]>

* [stable/tomcat] Automatically copy WARs from sidecar

Signed-off-by: Martin Mauch <[email protected]>

* [stable/tomcat] Make sidecar an initContainer

as per the updated README from the official Kubernetes examples.

Signed-off-by: Martin Mauch <[email protected]>

* [stable/tomcat] Use httpGet as readiness & liveness probe

This is more correct and also works on newer Tomcat versions
where the example index.html is located in a different directory.

Signed-off-by: Martin Mauch <[email protected]>

* [tomcat/stable] Bump to 0.2.0

Signed-off-by: Martin Mauch <[email protected]>
  • Loading branch information
nightscape authored and k8s-ci-robot committed Jan 2, 2019
1 parent 7dbf0a9 commit f3d207b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion stable/tomcat/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
name: tomcat
description: Deploy a basic tomcat application server with sidecar as web archive container
icon: http://tomcat.apache.org/res/images/tomcat.png
version: 0.1.0
version: 0.2.0
appVersion: 7.0
home: https://github.com/yahavb
maintainers:
Expand Down
3 changes: 3 additions & 0 deletions stable/tomcat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ Parameter | Description | Defaul
`image.tomcat.repository` | Tomact image source repository name | `tomcat`
`image.tomcat.tag` | `tomcat` release tag. | `7.0`
`image.pullPolicy` | Image pull policy | `IfNotPresent`
`image.pullSecrets` | Image pull secrets | `[]`
`deploy.directory` | Webarchive deployment directory | `/usr/local/tomcat/webapps`
`service.name` | Tomcat service name | `http`
`service.externalPort` | Kubernetes service port | `80`
`service.internalPort` | Tomcat front port | `8080`
`service.type` | Kubernetes service type | `LoadBalancer`
`readinessProbe.path` | HTTP path to check for readiness | `/sample`
`livenessProbe.path` | HTTP path to check for readiness | `/sample`
`resources` | CPU/Memory resource requests/limits | `{}`
`nodeSelector` | Node affinity | `{}`
`tolerations` | Node tolerations | `{}`
Expand Down
29 changes: 22 additions & 7 deletions stable/tomcat/templates/appsrv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ spec:
volumes:
- name: app-volume
emptyDir: {}
containers:
initContainers:
- name: war
image: {{ .Values.image.webarchive.repository }}:{{ .Values.image.webarchive.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "sh"
- "-c"
- "cp /*.war /app"
volumeMounts:
- name: app-volume
mountPath: /app
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.image.tomcat.repository }}:{{ .Values.image.tomcat.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand All @@ -39,14 +44,24 @@ spec:
- containerPort: {{ .Values.service.internalPort }}
hostPort: 8009
livenessProbe:
exec:
command:
- cat
- /usr/local/tomcat/webapps/sample/index.html
initialDelaySeconds: 15
periodSeconds: 20
httpGet:
path: {{ .Values.livenessProbe.path }}
port: {{ .Values.service.internalPort }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
readinessProbe:
httpGet:
path: {{ .Values.readinessProbe.path }}
port: {{ .Values.service.internalPort }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 8 }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
Expand Down
11 changes: 11 additions & 0 deletions stable/tomcat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ image:
repository: tomcat
tag: "7.0"
pullPolicy: IfNotPresent
pullSecrets: []

deploy:
directory: /usr/local/tomcat/webapps
Expand All @@ -34,6 +35,16 @@ ingress:
# hosts:
# - chart-example.local

readinessProbe:
path: "/sample"
initialDelaySeconds: 60
periodSeconds: 30
failureThreshold: 6
livenessProbe:
path: "/sample"
initialDelaySeconds: 60
periodSeconds: 30

resources: {}
# limits:
# cpu: 100m
Expand Down

0 comments on commit f3d207b

Please sign in to comment.