From 63c0fe6dd32643f90cba53f556e108a4c211e479 Mon Sep 17 00:00:00 2001 From: Fabio Date: Mon, 5 Sep 2022 09:55:20 -0300 Subject: [PATCH] Frist version of ClamAV Chart --- charts/clamav/v0.1.0/.helmignore | 23 ++++++ charts/clamav/v0.1.0/Chart.yaml | 16 +++++ charts/clamav/v0.1.0/templates/NOTES.txt | 2 + charts/clamav/v0.1.0/templates/_helpers.tpl | 72 +++++++++++++++++++ charts/clamav/v0.1.0/templates/app.yaml | 80 +++++++++++++++++++++ charts/clamav/v0.1.0/templates/hpa.yaml | 28 ++++++++ charts/clamav/v0.1.0/templates/service.yaml | 15 ++++ charts/clamav/v0.1.0/values.yaml | 56 +++++++++++++++ 8 files changed, 292 insertions(+) create mode 100644 charts/clamav/v0.1.0/.helmignore create mode 100644 charts/clamav/v0.1.0/Chart.yaml create mode 100644 charts/clamav/v0.1.0/templates/NOTES.txt create mode 100644 charts/clamav/v0.1.0/templates/_helpers.tpl create mode 100644 charts/clamav/v0.1.0/templates/app.yaml create mode 100644 charts/clamav/v0.1.0/templates/hpa.yaml create mode 100644 charts/clamav/v0.1.0/templates/service.yaml create mode 100644 charts/clamav/v0.1.0/values.yaml diff --git a/charts/clamav/v0.1.0/.helmignore b/charts/clamav/v0.1.0/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/clamav/v0.1.0/.helmignore @@ -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/ diff --git a/charts/clamav/v0.1.0/Chart.yaml b/charts/clamav/v0.1.0/Chart.yaml new file mode 100644 index 0000000..e0c95d7 --- /dev/null +++ b/charts/clamav/v0.1.0/Chart.yaml @@ -0,0 +1,16 @@ +apiVersion: v2 +name: clamav +description: ClamAV Antivirus Software + +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.9.35" \ No newline at end of file diff --git a/charts/clamav/v0.1.0/templates/NOTES.txt b/charts/clamav/v0.1.0/templates/NOTES.txt new file mode 100644 index 0000000..1426e64 --- /dev/null +++ b/charts/clamav/v0.1.0/templates/NOTES.txt @@ -0,0 +1,2 @@ +Your clamav service is installed! + diff --git a/charts/clamav/v0.1.0/templates/_helpers.tpl b/charts/clamav/v0.1.0/templates/_helpers.tpl new file mode 100644 index 0000000..37324b6 --- /dev/null +++ b/charts/clamav/v0.1.0/templates/_helpers.tpl @@ -0,0 +1,72 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "clamav.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 "clamav.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 "clamav.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "clamav.labels" -}} +helm.sh/chart: {{ include "clamav.chart" . }} +{{ include "clamav.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "clamav.selectorLabels" -}} +app.kubernetes.io/name: {{ include "clamav.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "clamav.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "clamav.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Return true if a configmap object should be created for clamav +*/}} +{{- define "clamav.createConfigmap" -}} +{{- if .Values.clamav.configuration }} + {{- true -}} +{{- else -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/charts/clamav/v0.1.0/templates/app.yaml b/charts/clamav/v0.1.0/templates/app.yaml new file mode 100644 index 0000000..4d2e110 --- /dev/null +++ b/charts/clamav/v0.1.0/templates/app.yaml @@ -0,0 +1,80 @@ +apiVersion: apps/v1 +kind: {{ .Values.clamav.kind }} +metadata: + name: {{ include "clamav.fullname" . }} + labels: + {{- include "clamav.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + {{- if (eq .Values.clamav.kind "StatefulSet") }} + serviceName: {{ include "clamav.fullname" . }} + {{- end }} + selector: + matchLabels: + {{- include "clamav.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "clamav.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + 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: clamav + containerPort: 3310 + protocol: TCP + {{- if .Values.clamav.hostPort }} + hostPort: {{ .Values.clamav.hostPort }} + {{- end }} + livenessProbe: + tcpSocket: + port: 3310 + initialDelaySeconds: 10 + periodSeconds: 15 + readinessProbe: + tcpSocket: + port: 3310 + initialDelaySeconds: 10 + periodSeconds: 15 + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - {{ include "clamav.name" . }} + - key: app.kubernetes.io/instance + operator: In + values: + - {{ .Release.Name }} + topologyKey: "kubernetes.io/hostname" + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/charts/clamav/v0.1.0/templates/hpa.yaml b/charts/clamav/v0.1.0/templates/hpa.yaml new file mode 100644 index 0000000..3791976 --- /dev/null +++ b/charts/clamav/v0.1.0/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "clamav.fullname" . }} + labels: + {{- include "clamav.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "clamav.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/clamav/v0.1.0/templates/service.yaml b/charts/clamav/v0.1.0/templates/service.yaml new file mode 100644 index 0000000..ad6e075 --- /dev/null +++ b/charts/clamav/v0.1.0/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "clamav.fullname" . }} + labels: + {{- include "clamav.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: 3310 + protocol: TCP + name: clamav + selector: + {{- include "clamav.selectorLabels" . | nindent 4 }} diff --git a/charts/clamav/v0.1.0/values.yaml b/charts/clamav/v0.1.0/values.yaml new file mode 100644 index 0000000..6a62aa0 --- /dev/null +++ b/charts/clamav/v0.1.0/values.yaml @@ -0,0 +1,56 @@ +# Default values for clamav. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 2 + +image: + repository: mailu/clamav + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 3310 + +resources: + limits: + cpu: 1000m + memory: 3Gi + requests: + cpu: 300m + memory: 1536Mi + +clamav: + kind: Deployment + +autoscaling: + enabled: false + minReplicas: 2 + maxReplicas: 6 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}