mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
Adding tomcat 7.0 chart (#5234)
* Adding tomcat 7.0 chart * Fixing trailing spaces and wrong indentation * Add icon in Chart.yaml * App Version in Chart.yaml * add table to explain the configurable components and fix labels * add liveness and readiness probes * modify app lables and fix probe ports * fix github user, remove MIT license, fix prereq version, align table, update _helpers.tpl, fix resource names, selectors, remove default tolerations, fix service ports * fix config table * fix maintainers names * fix wrong indentation in values.yaml * adjusting to helm v2.9.0 template * indentation style fix, add hard coded ports, add doc to webarchive in docker hub, use of tomcat official image, remove version from deploy directory, fix versions, fix tomcat icon, fix tag in README, remove /smaple app name from probes * fixing indentation * Fix indentation * Fix service * Fix deployment * Comment out defaults for resources * Update appsrv.yaml * Fix error converting YAML to JSON: yaml: line 50: mapping values are not allowed in this context * fix indent - readinessProbe.httpGet.port * fix liveness probe to ensure app deployment
This commit is contained in:
committed by
k8s-ci-robot
parent
54b8b1c181
commit
ea4c96ac55
@@ -0,0 +1,10 @@
|
||||
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
|
||||
appVersion: 7.0
|
||||
home: https://github.com/yahavb
|
||||
maintainers:
|
||||
- name: yahavb
|
||||
email: ybiran@ananware.systems
|
||||
@@ -0,0 +1,86 @@
|
||||
# Tomcat
|
||||
|
||||
[Tomcat](http://tomcat.apache.org) is is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies.
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart creates a [tomcat application server](http://tomcat.apache.org) Deployment, plus http Services for the server.
|
||||
The chart offers an optimization for application updates running in a servlet container-type engines like tomcat and [Jboss](http://jbossas.jboss.org). The chart uses the WAR, EAR, and other deployable components outside of the Servlet engine as sidecar container so application upgrades requires the sidecar container image only to be updated and not the Servlet engine as if both would run at the same image.
|
||||
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.8+
|
||||
|
||||
## Provider-specific Prerequisites
|
||||
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release stable/tomcat
|
||||
```
|
||||
|
||||
This command deploys a tomcat dedicated server with sane defaults.
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```bash
|
||||
$ helm delete my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the tomcat chart and their default values.
|
||||
|
||||
Parameter | Description | Default
|
||||
------------------------------- | ------------------------------------- | ----------------------------------------------------------
|
||||
`image.webarchive.repository` | Sidecar image source repository name | `ananwaresystems/webarchive`
|
||||
`image.webarchive.tag` | `webarchive` release tag. | `1.0`
|
||||
`image.tomcat.repository` | Tomact image source repository name | `tomcat`
|
||||
`image.tomcat.tag` | `tomcat` release tag. | `7.0`
|
||||
`image.pullPolicy` | Image pull policy | `IfNotPresent`
|
||||
`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`
|
||||
`resources` | CPU/Memory resource requests/limits | `{}`
|
||||
`nodeSelector` | Node affinity | `{}`
|
||||
`tolerations` | Node tolerations | `{}`
|
||||
|
||||
Refer to [values.yaml](values.yaml) for the full run-down on defaults. These are a mixture of Kubernetes and tomcat-related directives that map to environment variables.
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release \
|
||||
--set Values.someval=My Server,ImageTag=1.0 \
|
||||
stable/tomcat
|
||||
```
|
||||
|
||||
The above command deploys Tomcat dedicated with a server name of `My Server` and docker-tomcat image version `1.0`.
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release -f values.yaml stable/stable
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
## Persistence
|
||||
|
||||
> *"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."*
|
||||
|
||||
## Credits
|
||||
|
||||
[Java Web Application with Tomcat and Sidecar Container](https://github.com/kubernetes/examples/tree/master/staging/javaweb-tomcat-sidecar)
|
||||
@@ -0,0 +1,19 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "tomcat.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "tomcat.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "tomcat.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "tomcat.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "tomcat.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "tomcat.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "tomcat.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "tomcat.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "tomcat.name" . }}
|
||||
chart: {{ template "tomcat.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.externalPort }}
|
||||
targetPort: {{ .Values.service.internalPort }}
|
||||
protocol: TCP
|
||||
name: {{ .Values.service.name }}
|
||||
selector:
|
||||
app: {{ template "tomcat.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
@@ -0,0 +1,57 @@
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "tomcat.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "tomcat.name" . }}
|
||||
chart: {{ template "tomcat.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "tomcat.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "tomcat.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
volumes:
|
||||
- name: app-volume
|
||||
emptyDir: {}
|
||||
containers:
|
||||
- name: war
|
||||
image: {{ .Values.image.webarchive.repository }}:{{ .Values.image.webarchive.tag }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
volumeMounts:
|
||||
- name: app-volume
|
||||
mountPath: /app
|
||||
- name: {{ .Chart.Name }}
|
||||
image: {{ .Values.image.tomcat.repository }}:{{ .Values.image.tomcat.tag }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
volumeMounts:
|
||||
- name: app-volume
|
||||
mountPath: {{ .Values.deploy.directory }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.service.internalPort }}
|
||||
hostPort: 8009
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- cat
|
||||
- /usr/local/tomcat/webapps/sample/index.html
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml .Values.tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,49 @@
|
||||
# Default values for the chart.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
webarchive:
|
||||
repository: ananwaresystems/webarchive
|
||||
tag: "1.0"
|
||||
tomcat:
|
||||
repository: tomcat
|
||||
tag: "7.0"
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
deploy:
|
||||
directory: /usr/local/tomcat/webapps
|
||||
|
||||
service:
|
||||
name: http
|
||||
type: LoadBalancer
|
||||
externalPort: 80
|
||||
internalPort: 8080
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
path: /
|
||||
hosts:
|
||||
- chart-example.local
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
resources: {}
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 256Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 256Mi
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
Reference in New Issue
Block a user