Skip to content

Commit

Permalink
feat: Add tekton cache chart (#83)
Browse files Browse the repository at this point in the history
Change-Id: I8090191347bf4a3259ba22247af1c15f0af5e7b0
  • Loading branch information
Mykola Serdiuk committed Dec 1, 2023
1 parent fedc974 commit 244e6b3
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charts/tekton-cache/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Helm dependencies
charts/
23 changes: 23 additions & 0 deletions charts/tekton-cache/.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/
24 changes: 24 additions & 0 deletions charts/tekton-cache/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: tekton-cache
home: https://epam.github.io/edp-install/
description: A Helm chart for EDP Tekton Cache
type: application
version: 0.1.0
appVersion: "0.1.0"
icon: https://epam.github.io/edp-install/assets/logo.png
maintainers:
- name: epmd-edp
email: [email protected]
url: https://solutionshub.epam.com/solution/epam-delivery-platform
- name: sergk
url: https://github.com/SergK
sources:
- https://github.com/epam/edp-tekton
annotations:
artifacthub.io/license: Apache-2.0
artifacthub.io/operatorCapabilities: Basic Install
artifacthub.io/links: |
- name: EDP Documentation
url: https://epam.github.io/edp-install/
- name: EPAM SolutionHub
url: https://solutionshub.epam.com/solution/epam-delivery-platform
62 changes: 62 additions & 0 deletions charts/tekton-cache/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "tekton-cache.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 "tekton-cache.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 "tekton-cache.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "tekton-cache.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "tekton-cache.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
82 changes: 82 additions & 0 deletions charts/tekton-cache/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "tekton-cache.fullname" . }}
labels:
{{- include "tekton-cache.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "tekton-cache.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "tekton-cache.selectorLabels" . | nindent 8 }}
spec:
volumes:
- name: cache
persistentVolumeClaim:
claimName: cache
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: fix-permissions
image: {{ .Values.initContainers.repository }}:{{ .Values.initContainers.tag }}
command:
- chmod
- '-R'
- '0775'
- /uploads
resources: {}
volumeMounts:
- name: cache
mountPath: /uploads
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
securityContext:
privileged: true
runAsUser: 0
containers:
- name: {{ .Chart.Name }}
volumeMounts:
- mountPath: "/uploads"
name: cache
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: UPLOADER_HOST
value: "0.0.0.0"
- name: UPLOADER_PORT
value: "{{ .Values.service.port }}"
- name: UPLOADER_DIRECTORY
value: "/uploads"
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/tekton-cache/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cache
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.cacheSize }}
15 changes: 15 additions & 0 deletions charts/tekton-cache/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "tekton-cache.fullname" . }}
labels:
{{- include "tekton-cache.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
protocol: TCP
name: http
selector:
{{- include "tekton-cache.selectorLabels" . | nindent 4 }}
58 changes: 58 additions & 0 deletions charts/tekton-cache/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Default values for tekton-cache.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: ghcr.io/chmouel/go-simple-uploader
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "master"

initContainers:
repository: busybox
tag: latest


imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

cacheSize: "5Gi"


service:
type: ClusterIP
port: 8080

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit 244e6b3

Please sign in to comment.