Skip to content

Commit

Permalink
Merge pull request #27 from adhoc-dev/ta-41975-az
Browse files Browse the repository at this point in the history
[ADD] new version, hpa support and readinessProbe
  • Loading branch information
az-adhoc authored Aug 13, 2024
2 parents e623061 + 2de0be2 commit ec14d63
Show file tree
Hide file tree
Showing 9 changed files with 398 additions and 0 deletions.
24 changes: 24 additions & 0 deletions charts/adhoc-aeroo-docs/v0.1.3/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
annotations:
category: DevOps
apiVersion: v2
name: adhoc-aeroo-docs
description: A document conversion service (.odt to .pdf for reports)

type: application

version: 0.1.3

appVersion: "9.1"

home: "https://github.com/adhoc-dev/helm-charts"
sources:
- "https://github.com/adhoc-dev/"
maintainers:
- name: dbollini
email: [email protected]
- name: jjscarafia
email: [email protected]
- name: azacchino
email: [email protected]

icon: "https://github.com/adhoc-dev/helm-charts/raw/master/img/aerooIcon.png"
98 changes: 98 additions & 0 deletions charts/adhoc-aeroo-docs/v0.1.3/questions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
questions:

- variable: image.tag
label: "Image Tag"
type: "string"
required: true
default: "latest"
group: "Common"

- variable: replicaCount
group: "Deploy"
label: "Replica Count"
description: "Scale (number of replicas)"
type: "int"
required: true
default: "1"
- variable: autoscaling.enabled
group: "Deploy"
label: "Enable Autoscaling"
description: "Scale (number of replicas)"
type: "boolean"
default: false
required: false
- variable: autoscaling.minReplicas
group: "Deploy"
label: "autoscaling min"
description: "Scale (minimum number of replicas)"
type: "int"
required: false
default: "1"
- variable: autoscaling.maxReplicas
group: "Deploy"
label: "autoscaling max"
description: "Scale (maximum number of replicas)"
type: "int"
required: false
default: "3"
- variable: autoscaling.targetMemoryUtilizationPercentage
group: "Deploy"
label: "Memory Utilization Percentage"
description: "target % of requested memory"
type: "int"
required: false
default: "85"

# Pods limits and requests
- variable: resources.requestsEnabled
group: "Resources"
label: "Enable requests"
description: "Enable requests"
type: "boolean"
default: false
required: false
- variable: resources.requests.cpu
group: "Resources"
label: "Pods CPU Request"
description: "Pods CPU Request"
type: "string"
required: true
default: "50m"
- variable: resources.requests.memory
group: "Resources"
label: "Pods Memory Request"
description: "Pods Memory Request"
type: "string"
required: true
default: "512Mi"

- variable: resources.limitsEnabled
group: "Resources"
label: "Enable limits"
description: "Enable limits"
type: "boolean"
default: false
required: false
- variable: resources.limits.cpu
group: "Resources"
label: "Pods CPU Limit"
description: "Pods CPU Limit"
type: "string"
required: true
default: "1000m"
- variable: resources.limits.memory
group: "Resources"
label: "Pods Memory Limit"
description: "Pods Memory Limit"
type: "string"
required: true
default: "2Gi"

# NodeTag - Affinity
- variable: nodeTag
label: "Node tag for node affinity"
description: "Tag to schedule pods in nodes"
type: "string"
required: true
default: "Prod"
group: "Deploy"
Empty file.
62 changes: 62 additions & 0 deletions charts/adhoc-aeroo-docs/v0.1.3/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "adhoc-aeroo.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 "adhoc-aeroo.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 "adhoc-aeroo.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "adhoc-aeroo.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "adhoc-aeroo.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
77 changes: 77 additions & 0 deletions charts/adhoc-aeroo-docs/v0.1.3/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "adhoc-aeroo.fullname" . }}
labels:
{{- include "adhoc-aeroo.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "adhoc-aeroo.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "adhoc-aeroo.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "adhoc-aeroo.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: aero
containerPort: 8989
protocol: TCP
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if or .Values.resources.limitsEnabled .Values.resources.requestsEnabled }}
resources:
{{- if .Values.resources.limitsEnabled }}
limits:
{{- toYaml .Values.resources.limits | nindent 14 }}
{{- end }}
{{- if .Values.resources.requestsEnabled }}
requests:
{{- toYaml .Values.resources.requests | nindent 14 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}

affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: {{ .Values.nodeTag }}
operator: In
values:
- "true"

{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
32 changes: 32 additions & 0 deletions charts/adhoc-aeroo-docs/v0.1.3/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 "adhoc-aeroo.fullname" . }}
labels:
{{- include "adhoc-aeroo.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "adhoc-aeroo.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 }}
15 changes: 15 additions & 0 deletions charts/adhoc-aeroo-docs/v0.1.3/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "adhoc-aeroo.fullname" . }}
labels:
{{- include "adhoc-aeroo.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: aero
protocol: TCP
name: aero
selector:
{{- include "adhoc-aeroo.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions charts/adhoc-aeroo-docs/v0.1.3/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "adhoc-aeroo.serviceAccountName" . }}
labels:
{{- include "adhoc-aeroo.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit ec14d63

Please sign in to comment.