Skip to content

Commit

Permalink
Add Helm chart for gnupg
Browse files Browse the repository at this point in the history
  • Loading branch information
drmalex07 committed Apr 8, 2024
1 parent 3342702 commit cbf7caf
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/docker-build-gnupg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI - gnupg
run-name: Build container image with GnuPG suite

on:
push:
paths:
- 'gnupg/**'
- '.github/workflows/docker-build-gnupg.yml'
branches:
- 'gnupg'
tags:
- '0.*'
- '1.*'

permissions:
actions: read
checks: read
contents: read
packages: write
repository-projects: read
statuses: read

jobs:

build_image:
runs-on: ubuntu-22.04
env:
{}
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: |
ghcr.io/eosc-lot-1/gnupg
- uses: docker/setup-buildx-action@v3
with:
driver: docker
- uses: docker/build-push-action@v5
with:
context: ./gnupg/docker/
file: ./gnupg/docker/Dockerfile
#buildArgs: |-
push: true
tags: |
ghcr.io/eosc-lot-1/gnupg:2-debian
labels: ${{ steps.meta.outputs.labels }}

24 changes: 24 additions & 0 deletions gnupg/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: gnupg
description: A Helm chart for GnuPG command

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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.0.1

# 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: "2"
3 changes: 3 additions & 0 deletions gnupg/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM debian:12.5-slim

RUN apt-get update && apt-get install -y gnupg
Empty file added gnupg/templates/NOTES.txt
Empty file.
62 changes: 62 additions & 0 deletions gnupg/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "gnupg.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 "gnupg.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 "gnupg.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "gnupg.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "gnupg.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
49 changes: 49 additions & 0 deletions gnupg/templates/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# vim: set syntax=helm:

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "gnupg.fullname" . }}
labels:
{{- include "gnupg.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "gnupg.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "gnupg.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "gnupg.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: 8
volumes:
- name: temp
emptyDir: {}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command: ['sh']
stdin: true
volumeMounts:
- name: temp
mountPath: /tmp
12 changes: 12 additions & 0 deletions gnupg/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 "gnupg.serviceAccountName" . }}
labels:
{{- include "gnupg.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
36 changes: 36 additions & 0 deletions gnupg/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
image:
repository: gnupg
pullPolicy: IfNotPresent
tag: "0.0.1"

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

serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

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

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit cbf7caf

Please sign in to comment.