Skip to content

Commit f2eb80f

Browse files
committed
init project
1 parent 1f67bc7 commit f2eb80f

15 files changed

+560
-1
lines changed

.github/workflows/release.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- develop
9+
10+
jobs:
11+
release:
12+
permissions:
13+
contents: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Configure Git
22+
run: |
23+
git config user.name "$GITHUB_ACTOR"
24+
git config user.email "[email protected]"
25+
26+
- name: Run chart-releaser
27+
uses: helm/[email protected]
28+
env:
29+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.gitignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# General files for the project
2+
pkg/*
3+
*.pyc
4+
bin/*
5+
.project
6+
/.bin
7+
/_test/secrets/*.json
8+
9+
# OSX leaves these everywhere on SMB shares
10+
._*
11+
12+
# OSX trash
13+
.DS_Store
14+
15+
# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA
16+
.idea/
17+
*.iml
18+
19+
# Vscode files
20+
.vscode
21+
22+
# Emacs save files
23+
*~
24+
\#*\#
25+
.\#*
26+
27+
# Vim-related files
28+
[._]*.s[a-w][a-z]
29+
[._]s[a-w][a-z]
30+
*.un~
31+
Session.vim
32+
.netrwhist
33+
34+
# Chart dependencies
35+
**/charts/*.tgz
36+
37+
.history
38+
README.md.gotmpl
39+
dev

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lint:
2+
@helm lint charts/webhookx

README.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
# helm-charts
1+
# webhookx
2+
3+
开源项目webhoox的helm chart安装。
4+
5+
## 依赖
6+
7+
| Repository | Name | Version |
8+
|------------------------------------|------------|---------|
9+
| https://charts.bitnami.com/bitnami | postgresql | 6 |
10+
| https://charts.bitnami.com/bitnami | redis | 17 |
11+
12+
## 安装依赖
13+
14+
1. helm repo add bitnami https://charts.bitnami.com/bitnami
15+
2. helm repo update
16+
3. helm install postgresql --namespace webhookx --create-namespace bitnami/postgresql
17+
4. helm install redis --namespace webhookx --create-namespace bitnami/redis
18+
19+
## 安装webhook
20+
21+
1. helm repo add webhookx https://webhookx.github.io/helm-charts
22+
2. helm repo update
23+
3. helm install webhookx webhookx/webhookx --namespace webhookx --create-namespace

charts/webhookx/.helmignore

+23
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/webhookx/Chart.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: webhookx
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.2
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: "1.16.0"

charts/webhookx/templates/NOTES.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "webhookx.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "webhookx.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "webhookx.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "webhookx.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "webhookx.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 "webhookx.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 "webhookx.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "webhookx.labels" -}}
37+
helm.sh/chart: {{ include "webhookx.chart" . }}
38+
{{ include "webhookx.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 "webhookx.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "webhookx.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 "webhookx.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "webhookx.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if .Values.config.enabled }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "webhookx.fullname" . }}-config
6+
labels:
7+
app.kubernetes.io/name: {{ include "webhookx.name" . }}
8+
app.kubernetes.io/instance: {{ .Release.Name }}
9+
app.kubernetes.io/component: config
10+
data:
11+
{{- range .Values.config.data }}
12+
{{ .name }}: "{{ .value }}"
13+
{{- end }}
14+
{{- end }}
+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "webhookx.fullname" . }}
5+
labels:
6+
{{- include "webhookx.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "webhookx.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
{{- with .Values.podAnnotations }}
15+
annotations:
16+
{{- toYaml . | nindent 8 }}
17+
{{- end }}
18+
labels:
19+
{{- include "webhookx.labels" . | nindent 8 }}
20+
{{- with .Values.podLabels }}
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
spec:
24+
{{- with .Values.imagePullSecrets }}
25+
imagePullSecrets:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
serviceAccountName: {{ include "webhookx.serviceAccountName" . }}
29+
{{- with .Values.podSecurityContext }}
30+
securityContext:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
containers:
34+
- name: {{ .Chart.Name }}
35+
{{- with .Values.securityContext }}
36+
securityContext:
37+
{{- toYaml . | nindent 12 }}
38+
{{- end }}
39+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
40+
imagePullPolicy: {{ .Values.image.pullPolicy }}
41+
{{- if .Values.config.enabled }}
42+
envFrom:
43+
- configMapRef:
44+
name: {{ include "webhookx.fullname" . }}-config
45+
{{ end }}
46+
ports:
47+
- name: proxy
48+
containerPort: {{ .Values.service.proxyPort }}
49+
protocol: TCP
50+
- name: admin
51+
containerPort: {{ .Values.service.adminPort }}
52+
protocol: TCP
53+
{{- with .Values.livenessProbe }}
54+
livenessProbe:
55+
{{- toYaml . | nindent 12 }}
56+
{{- end }}
57+
{{- with .Values.readinessProbe }}
58+
readinessProbe:
59+
{{- toYaml . | nindent 12 }}
60+
{{- end }}
61+
{{- with .Values.resources }}
62+
resources:
63+
{{- toYaml . | nindent 12 }}
64+
{{- end }}
65+
{{- with .Values.volumeMounts }}
66+
volumeMounts:
67+
{{- toYaml . | nindent 12 }}
68+
{{- end }}
69+
{{- with .Values.volumes }}
70+
volumes:
71+
{{- toYaml . | nindent 8 }}
72+
{{- end }}
73+
{{- with .Values.nodeSelector }}
74+
nodeSelector:
75+
{{- toYaml . | nindent 8 }}
76+
{{- end }}
77+
{{- with .Values.affinity }}
78+
affinity:
79+
{{- toYaml . | nindent 8 }}
80+
{{- end }}
81+
{{- with .Values.tolerations }}
82+
tolerations:
83+
{{- toYaml . | nindent 8 }}
84+
{{- end }}
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{{- if .Values.ingress.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ include "webhookx.fullname" . }}
6+
labels:
7+
{{- include "webhookx.labels" . | nindent 4 }}
8+
{{- with .Values.ingress.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
{{- with .Values.ingress.className }}
14+
ingressClassName: {{ . }}
15+
{{- end }}
16+
{{- if .Values.ingress.tls }}
17+
tls:
18+
{{- range .Values.ingress.tls }}
19+
- hosts:
20+
{{- range .hosts }}
21+
- {{ . | quote }}
22+
{{- end }}
23+
secretName: {{ .secretName }}
24+
{{- end }}
25+
{{- end }}
26+
rules:
27+
{{- range .Values.ingress.hosts }}
28+
- host: {{ .host | quote }}
29+
http:
30+
paths:
31+
{{- range .paths }}
32+
- path: {{ .path }}
33+
{{- with .pathType }}
34+
pathType: {{ . }}
35+
{{- end }}
36+
backend:
37+
service:
38+
name: {{ include "webhookx.fullname" $ }}
39+
port:
40+
number: {{ .port }}
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}

0 commit comments

Comments
 (0)