Skip to content

Commit 9c27517

Browse files
committed
Added chart and chart release workflow
1 parent 501699f commit 9c27517

8 files changed

Lines changed: 146 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Chart Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- charts/app/Chart.yaml
9+
workflow_dispatch:
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "$GITHUB_ACTOR"
22+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
23+
24+
- name: Run chart-releaser
25+
uses: helm/chart-releaser-action@v1.7.0
26+
with:
27+
charts_dir: charts
28+
env:
29+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

charts/app/.helmignore

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/

charts/app/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: my-app
3+
description: A Helm chart for My App
4+
type: application
5+
version: 0.1.0
6+
appVersion: "1.0.0"

charts/app/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# KubeScope Dashboard
2+
3+
A lightweight Kubernetes monitoring dashboard that runs in-cluster and queries metrics directly from the Kubernetes API Server.
4+
5+
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)
6+
7+
## Install Chart
8+
9+
```console
10+
cd charts
11+
12+
helm install kubescope ./kubescope -n kubescope-dashboard --create-namespace
13+
```

charts/app/templates/_helpers.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{- define "my-app.name" -}}
2+
{{ .Chart.Name }}
3+
{{- end }}
4+
5+
{{- define "my-app.fullname" -}}
6+
{{ .Release.Name }}-{{ .Chart.Name }}
7+
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "my-app.fullname" . }}
5+
spec:
6+
replicas: {{ .Values.replicaCount }}
7+
selector:
8+
matchLabels:
9+
app: {{ include "my-app.name" . }}
10+
template:
11+
metadata:
12+
labels:
13+
app: {{ include "my-app.name" . }}
14+
spec:
15+
containers:
16+
- name: {{ include "my-app.name" . }}
17+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
18+
imagePullPolicy: {{ .Values.image.pullPolicy }}
19+
ports:
20+
- containerPort: 80
21+
env:
22+
{{- range $key, $value := .Values.env }}
23+
- name: {{ $key }}
24+
value: "{{ $value }}"
25+
{{- end }}
26+
resources:
27+
{{- toYaml .Values.resources | nindent 12 }}

charts/app/templates/service.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "my-app.fullname" . }}
5+
spec:
6+
type: {{ .Values.service.type }}
7+
selector:
8+
app: {{ include "my-app.name" . }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: 80

charts/app/values.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
replicaCount: 2
2+
3+
image:
4+
repository: mydockerhub/my-app
5+
tag: latest
6+
pullPolicy: IfNotPresent
7+
8+
service:
9+
type: ClusterIP
10+
port: 80
11+
12+
ingress:
13+
enabled: true
14+
className: nginx
15+
hosts:
16+
- host: my-app.local
17+
paths:
18+
- path: /
19+
pathType: Prefix
20+
21+
resources:
22+
limits:
23+
cpu: "500m"
24+
memory: "512Mi"
25+
requests:
26+
cpu: "250m"
27+
memory: "256Mi"
28+
29+
env:
30+
APP_ENV: production

0 commit comments

Comments
 (0)