Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.

Commit 5e97119

Browse files
authored
Merge pull request #1 from fullstack-devops/add-ghr-chart
add ghr chart + new workflow
2 parents 826c929 + 510e4f4 commit 5e97119

12 files changed

Lines changed: 409 additions & 2 deletions

File tree

.github/workflows/release-charts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ jobs:
2222
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2323
2424
- name: Run chart-releaser
25-
uses: helm/chart-releaser-action@v1.2.1
25+
uses: helm/chart-releaser-action@v1.4.0
2626
env:
2727
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name:
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
chart:
7+
description: "name fo chart"
8+
required: true
9+
version:
10+
description: "new appVersion"
11+
required: true
12+
repository_dispatch:
13+
types: [update_chart_version]
14+
15+
jobs:
16+
check_vars:
17+
runs-on: [ubuntu-latest]
18+
steps:
19+
- name: Get Instance(s)
20+
id: variables
21+
envs:
22+
DIR: charts/${{ github.event.inputs.chart }}
23+
valid: '0-9a-zA-Z\-\_'
24+
run: |
25+
if [ ! -d "$DIR" ]; then
26+
echo "Chart ${{ github.event.inputs.chart }} does not exist. Canceling update..."
27+
exit 1
28+
else
29+
if [[ ! "${{ github.event.inputs.version }}" =~ [^$valid] ]]; then
30+
echo "appVersion does not match regex ${{ github.event.inputs.version }}, canceling update..."
31+
exit 1
32+
else
33+
echo "Chart ${{ github.event.inputs.chart }} found. Update appVersion to ${{ github.event.inputs.version }}"
34+
fi
35+
fi
36+
37+
update_appVersion:
38+
runs-on: [ubuntu-latest]
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v2
42+
- name: Set appVersion and push
43+
run: |
44+
sed -i "s/appVersion: .*/appVersion: ${{ github.event.inputs.version }}/g" charts/${{ github.event.inputs.chart }}/Chart.yaml
45+
46+
git config user.name "$GITHUB_ACTOR"
47+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
48+
49+
git status
50+
git commit -a -m "update chart ${{ github.event.inputs.chart }} to appVersion ${{ github.event.inputs.version }}"
51+
git push

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
# helm-charts
1+
# FullStack Devop's collection of helm charts
2+
3+
## Usage
4+
5+
[Helm](https://helm.sh) must be installed to use the charts. Please refer to
6+
Helm's [documentation](https://helm.sh/docs) to get started.
7+
8+
Once Helm has been set up correctly, add the repo as follows:
9+
10+
helm repo add fsops http://fullstack-devops.github.io/helm-charts/
11+
12+
If you had already added this repo earlier, run `helm repo update` to retrieve
13+
the latest versions of the packages. You can then run `helm search repo
14+
fsops` to see the charts.
15+
16+
To install the <chart-name> chart:
17+
18+
helm install my-<chart-name> fsops/<chart-name>
19+
20+
To uninstall the chart:
21+
22+
helm delete my-<chart-name>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: github-actions-runner
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "0.4.3"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "github-actions-runner.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "github-actions-runner.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "github-actions-runner.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "github-actions-runner.labels" -}}
37+
helm.sh/chart: {{ include "github-actions-runner.chart" . }}
38+
{{ include "github-actions-runner.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "github-actions-runner.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "github-actions-runner.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "github-actions-runner.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "github-actions-runner.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ .Release.Name }}-configmap
5+
labels:
6+
{{- include "github-actions-runner.labels" . | nindent 4 }}
7+
data:
8+
KANIKO_ENABLED: {{ .Values.runner.kaniko.enabled | squote }}
9+
GH_ORG: {{ .Values.runner.github.organisation | squote }}
10+
{{- if .Values.runner.github.repository }}
11+
GH_REPO: {{ .Values.runner.github.repository | squote }}
12+
{{- end }}
13+
{{- if .Values.runner.labels }}
14+
GH_RUNNER_LABELS: {{ .Values.runner.labels | squote }}
15+
{{- end }}
16+
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "github-actions-runner.fullname" . }}
5+
labels:
6+
{{- include "github-actions-runner.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
selector:
12+
matchLabels:
13+
{{- include "github-actions-runner.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "github-actions-runner.selectorLabels" . | nindent 8 }}
22+
spec:
23+
volumes:
24+
{{- if .Values.runner.kaniko.mountedSecret }}
25+
- name: pull-secret
26+
secret:
27+
secretName: "{{ .Values.runner.kaniko.mountedSecret }}"
28+
items:
29+
- key: .dockerconfigjson
30+
path: config.json
31+
defaultMode: 420
32+
{{- end }}
33+
{{- if .Values.runner.kaniko.enabled }}
34+
- name: workspace-volume
35+
emptyDir: {}
36+
{{- end }}
37+
{{- with .Values.imagePullSecrets }}
38+
imagePullSecrets:
39+
{{- toYaml . | nindent 8 }}
40+
{{- end }}
41+
serviceAccountName: {{ include "github-actions-runner.serviceAccountName" . }}
42+
securityContext:
43+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
44+
containers:
45+
{{- if .Values.runner.kaniko.enabled }}
46+
- name: {{ .Chart.Name }}-kaniko
47+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}-kaniko-sidecar"
48+
resources:
49+
{{- toYaml .Values.resources | nindent 12 }}
50+
volumeMounts:
51+
- name: workspace-volume
52+
mountPath: /kaniko/workspace/
53+
imagePullPolicy: IfNotPresent
54+
{{- end }}
55+
- name: {{ .Chart.Name }}
56+
securityContext:
57+
{{- toYaml .Values.securityContext | nindent 12 }}
58+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}-{{ .Values.runner.flavour }}"
59+
imagePullPolicy: {{ .Values.image.pullPolicy }}
60+
volumeMounts:
61+
{{- if .Values.runner.kaniko.enabled }}
62+
- name: workspace-volume
63+
mountPath: /kaniko/workspace/
64+
{{- end }}
65+
{{- if .Values.runner.kaniko.mountedSecret }}
66+
- name: pull-secret
67+
readOnly: true
68+
mountPath: /kaniko/.docker
69+
{{- end }}
70+
resources:
71+
{{- toYaml .Values.resources | nindent 12 }}
72+
envFrom:
73+
- secretRef:
74+
name: {{ .Release.Name }}-secret
75+
- configMapRef:
76+
name: {{ .Release.Name }}-configmap
77+
{{- with .Values.nodeSelector }}
78+
nodeSelector:
79+
{{- toYaml . | nindent 8 }}
80+
{{- end }}
81+
{{- with .Values.affinity }}
82+
affinity:
83+
{{- toYaml . | nindent 8 }}
84+
{{- end }}
85+
{{- with .Values.tolerations }}
86+
tolerations:
87+
{{- toYaml . | nindent 8 }}
88+
{{- end }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2beta1
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "github-actions-runner.fullname" . }}
6+
labels:
7+
{{- include "github-actions-runner.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "github-actions-runner.fullname" . }}
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
21+
{{- end }}
22+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
23+
- type: Resource
24+
resource:
25+
name: memory
26+
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
27+
{{- end }}
28+
{{- end }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ .Release.Name }}-secret
5+
labels:
6+
{{- include "github-actions-runner.labels" . | nindent 4 }}
7+
type: Opaque
8+
data:
9+
GH_ACCESS_TOKEN: {{ .Values.runner.github.accessToken | b64enc | squote }}

0 commit comments

Comments
 (0)