Skip to content

Commit 686f445

Browse files
authored
chore: add helm charts (#606)
* add helm charts * update README
1 parent f6a17c0 commit 686f445

File tree

7 files changed

+215
-0
lines changed

7 files changed

+215
-0
lines changed
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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v2
2+
name: linux-command
3+
description: A Helm chart for Kubernetes
4+
# A chart can be either an 'application' or a 'library' chart.
5+
#
6+
# Application charts are a collection of templates that can be packaged into versioned archives
7+
# to be deployed.
8+
#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
# This is the chart version. This version number should be incremented each time you make changes
14+
# to the chart and its templates, including the app version.
15+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16+
version: 0.1.0
17+
# This is the version number of the application being deployed. This version number should be
18+
# incremented each time you make changes to the application. Versions are not expected to
19+
# follow Semantic Versioning. They should reflect the version the application is using.
20+
# It is recommended to use it with quotes.
21+
appVersion: "0.1.0"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# linux-command
2+
3+
linux-command 的 Helm 图表。该图表使用 Helm 软件包管理器在 Kubernetes 集群上引导部署 linux-command。
4+
5+
## 安装 Chart
6+
7+
```
8+
$ helm install linux-command ./linux-command --namespace linux-command --create-namespace
9+
```
10+
11+
## 卸载 Chart
12+
13+
```
14+
$ helm -n linux-command uninstall linux-command
15+
```
16+
17+
这会删除与图表相关的所有 Kubernetes 组件,并删除发布。
18+
19+
## 配置参数
20+
21+
下表列出了 linux-command 图表的可配置参数及其默认值。
22+
23+
| Key | Type | Default | Description |
24+
| ------------------------------------------------------------ | ------ | ------------------------- | ----------- |
25+
| linuxCommand.linuxCommandContainer.image.repository | string | `"wcjiang/linux-command"` | |
26+
| linuxCommand.linuxCommandContainer.image.tag | string | `"latest"` | |
27+
| linuxCommand.linuxCommandContainer.imagePullPolicy | string | `"IfNotPresent"` | |
28+
| linuxCommand.linuxCommandContainer.resources.limits.cpu | string | `"100m"` | |
29+
| linuxCommand.linuxCommandContainer.resources.limits.memory | string | `"50Mi"` | |
30+
| linuxCommand.linuxCommandContainer.resources.requests.cpu | string | `"100m"` | |
31+
| linuxCommand.linuxCommandContainer.resources.requests.memory | string | `"50Mi"` | |
32+
| linuxCommand.replicas | int | `1` | |
33+
| service.ports[0].port | int | `9665` | |
34+
| service.ports[0].protocol | string | `"TCP"` | |
35+
| service.ports[0].targetPort | int | `3000` | |
36+
| service.type | string | `"NodePort"` | |
37+
38+
使用`-set key=value[,key=value]`参数为`helm install`指定每个参数。
39+
40+
或者,也可以在安装图表时提供指定参数值的 YAML 文件。例如
41+
42+
```
43+
helm install <release-name> -f values.yaml ./linux-command
44+
```
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 "linux-command.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 "linux-command.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 "linux-command.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "linux-command.labels" -}}
37+
helm.sh/chart: {{ include "linux-command.chart" . }}
38+
{{ include "linux-command.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 "linux-command.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "linux-command.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 "linux-command.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "linux-command.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "linux-command.fullname" . }}-linux-command
5+
labels:
6+
app: linux-command
7+
{{- include "linux-command.labels" . | nindent 4 }}
8+
spec:
9+
replicas: {{ .Values.linuxCommand.replicas }}
10+
selector:
11+
matchLabels:
12+
app: linux-command
13+
{{- include "linux-command.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
labels:
17+
app: linux-command
18+
{{- include "linux-command.selectorLabels" . | nindent 8 }}
19+
spec:
20+
containers:
21+
- env:
22+
- name: KUBERNETES_CLUSTER_DOMAIN
23+
value: {{ quote .Values.kubernetesClusterDomain }}
24+
image: {{ .Values.linuxCommand.linuxCommandContainer.image.repository }}:{{ .Values.linuxCommand.linuxCommandContainer.image.tag
25+
| default .Chart.AppVersion }}
26+
imagePullPolicy: {{ .Values.linuxCommand.linuxCommandContainer.imagePullPolicy
27+
}}
28+
name: linux-command-container
29+
ports:
30+
- containerPort: 3000
31+
resources: {{- toYaml .Values.linuxCommand.linuxCommandContainer.resources | nindent
32+
10 }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "linux-command.fullname" . }}-service
5+
labels:
6+
{{- include "linux-command.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
selector:
10+
app: linux-command
11+
{{- include "linux-command.selectorLabels" . | nindent 4 }}
12+
ports:
13+
{{- .Values.service.ports | toYaml | nindent 2 }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
linuxCommand:
2+
linuxCommandContainer:
3+
image:
4+
repository: wcjiang/linux-command
5+
tag: latest
6+
imagePullPolicy: IfNotPresent
7+
resources:
8+
limits:
9+
cpu: 100m
10+
memory: 50Mi
11+
requests:
12+
cpu: 100m
13+
memory: 50Mi
14+
replicas: 1
15+
service:
16+
ports:
17+
- port: 9665
18+
protocol: TCP
19+
targetPort: 3000
20+
type: NodePort

0 commit comments

Comments
 (0)