Skip to content

Commit

Permalink
Helm Chart for pentaho-carte (#32)
Browse files Browse the repository at this point in the history
Adds Helm Chart for pentaho-carte
  • Loading branch information
ejcsid authored Jun 24, 2024
1 parent d8fa782 commit c2660b5
Show file tree
Hide file tree
Showing 14 changed files with 589 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ values-local.yaml
!.vscode/extensions.json
!.vscode/*.code-snippets

### JetBrains IDEs ###
.idea
*.iml

# Local History for Visual Studio Code
.history/

Expand All @@ -27,4 +31,4 @@ values-local.yaml
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/helm,visualstudiocode
# End of https://www.toptal.com/developers/gitignore/api/helm,visualstudiocode
23 changes: 23 additions & 0 deletions charts/pentaho-carte/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions charts/pentaho-carte/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: pentaho-carte
description: Pentaho Data Integration installation and starts the Pentaho Carte Server
type: application
# Chart version.
version: 0.1.0
# Pentaho Dataintegration version
appVersion: "0.0.2"
maintainers:
- name: ejcsid
email: [email protected]
home: https://github.com/it-at-m/helm-charts/tree/main/charts/pentaho-carte
icon: https://opensource.muenchen.de/assets/itm-logo-256.png
sources:
- "https://github.com/it-at-m/helm-charts"
68 changes: 68 additions & 0 deletions charts/pentaho-carte/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# pentaho-carte

## Introduction

This chart bootstraps a [pentaho-carte](https://github.com/it-at-m/pentaho-carte) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Installing the Chart

Install this chart using:

```bash
helm install my-pentaho-carte-release it-at-m/pentaho-carte --values values.yaml
```

The command deploys pentaho-carte on the Kubernetes cluster with some default configuration. The [Configuration](#configuration) section lists the parameters that can or **must** be configured during installation.

## Configuration

| Key | Type | Default | Description |
|--------------------------------------------|--------|-------------------------|-----------------------------------------|
| replicaCount | int | `1` | Number of replicas |
| image.repository | string | `"itatm/pentaho-carte"` | Image to use for deploying |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.tag | string | `""` | Image tag |
| image.imagePullSecrets | list | `[]` | Image pull secrets specification |
| nameOverride | string | `""` | Override chart name |
| fullNameOverride | string | `""` | Override fullname |
| serviceAccount.create | bool | `false` | Create service account |
| serviceAccount.automount | bool | `false` | Mount Service account |
| serviceAccount.annotations | object | `{}` | Service account annotations |
| serviceAccount.name | string | `""` | Service account name |
| podAnnotations | object | `{}` | Pod annotations |
| podLabels | object | `{}` | Pod Labels |
| podSecurityContext | object | `{}` | Pod Security Context |
| securityContext | object | `{}` | Security Context |
| service.type | string | `"ClusterIP"` | Service type |
| service.port | int | `8080` | Service port |
| service.targetP ort | int | `8080` | Service target port |
| ingress.enabled | bool | `true` | Enable ingress |
| ingress.className | string | `""` | |
| ingress.annotations | object | `{}` | |
| ingress.hosts | list | `[]` | |
| ingress.tls | list | `[]` | |
| route.enabled | bool | `false` | Create OpenShift route |
| route.annotations | object | `{}` | Route annotations |
| route.host | string | `""` | Route host |
| route.path | string | `""` | Route path |
| route.wildcardPolicy | string | `"None"` | Route wildcard policy |
| route.tls.termination | string | `"Edge"` | Route tsl termination |
| route.tls.insecureEdgeTerminationPolicy | string | `"Redirect"` | Route tls insecureEdgeTerminationPolicy |
| route.tls.key | string | `""` | Route tls key |
| route.tls.certificate | string | `""` | Route tls certificate |
| route.tls.caCertificate | string | `""` | Route tls ca certificate |
| route.tls.destinationCACertificate | string | `""` | Route tls destination ca certificate |
| resources | object | `{}` | Pod resources |
| livenessProbe.httpGet.path | string | `/` | Path to use for liveness probe |
| livenessProbe.httpGet.port | string | `http` | Port to use for liveness probe |
| readinessProbe.httpGet.path | string | `/` | Path to use for readiness probe |
| readinessProbe.httpGet.port | string | `http` | Path to use for readiness probe |
| autoscaling.enabled | bool | `false` | Enable autoscaling |
| autoscaling.minReplicas | int | `1` | Minimal replicas |
| autoscaling.maxReplicas | int | `100` | Maximal replicas |
| autoscaling.targetCPUUtilizationPercentage | bool | `80` | CPU Utilization to use for autoscaling |
| volumes | list | `[]` | Additional Volumes |
| volumeMounts | list | `[]` | Additional volume mounts |
| nodeSelector | object | `{}` | Kubernetes node selector |
| tolerations | list | `[]` | Kubernetes tolerations |
| affinity | object | `{}` | Kubernetes node affinity |
22 changes: 22 additions & 0 deletions charts/pentaho-carte/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "pentaho-carte.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 its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "pentaho-carte.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "pentaho-carte.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
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.kubernetes.io/name={{ include "pentaho-carte.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions charts/pentaho-carte/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "pentaho-carte.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 "pentaho-carte.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 "pentaho-carte.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "pentaho-carte.labels" -}}
helm.sh/chart: {{ include "pentaho-carte.chart" . }}
{{ include "pentaho-carte.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "pentaho-carte.selectorLabels" -}}
app.kubernetes.io/name: {{ include "pentaho-carte.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "pentaho-carte.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "pentaho-carte.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
68 changes: 68 additions & 0 deletions charts/pentaho-carte/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "pentaho-carte.fullname" . }}
labels:
{{- include "pentaho-carte.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "pentaho-carte.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "pentaho-carte.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "pentaho-carte.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
32 changes: 32 additions & 0 deletions charts/pentaho-carte/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "pentaho-carte.fullname" . }}
labels:
{{- include "pentaho-carte.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "pentaho-carte.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
61 changes: 61 additions & 0 deletions charts/pentaho-carte/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "pentaho-carte.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "pentaho-carte.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit c2660b5

Please sign in to comment.