Skip to content

Commit fd24a18

Browse files
committed
done
1 parent 96a57af commit fd24a18

File tree

4 files changed

+84
-26
lines changed

4 files changed

+84
-26
lines changed

submitted/jekyll/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ helminstall:
66

77
uninstall:
88
helm delete myjekyll
9+
helm del --purge myjekyll
910

1011
debug:
1112
helm install ../jekyll \
1213
--name myjekyll \
1314
--set fullnameOverride=myjekyll \
14-
--set jekyll_host=www.zeusro.tech \
1515
--set ingress.hosts={www.zeusro.tech} \
1616
--debug \
1717
--dry-run

submitted/jekyll/README.md

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,66 @@ jekyll 是一个基于 Ruby 写的静态博客系统
66

77
## 安装使用
88

9+
按需修改 values.yaml 中的参数.
10+
11+
比如 env 中的 GIT_URL , 这个参数指的是对应的 jekyll 源码地址.
12+
13+
还有就是决定是否要使用 volume .
14+
15+
默认的方案是用 postStart 拉取 最新的 master 分支代码,这样镜像比较小,也不用特意去考虑 volume.但是因为众所周知的原因,git clone 会比较慢.这种场景建议用多副本,`maxUnavailable: 0`
16+
17+
volume 我也是有做预留的,这种方案是要自己去维护 volume ,相对来说比较麻烦.
18+
19+
其他参数 可以使用 `--set xxx=xxx`指定,例子如下:
20+
921
```shell
1022
helm install ../jekyll \
1123
--name myjekyll \
12-
--set fullnameOverride=myjekyll \
13-
--set jekyll_host=www.zeusro.tech \
24+
--set fullnameOverride=myjekyll \
1425
--set ingress.hosts={www.zeusro.tech} \
15-
--set public_git_url=https://github.com/zeusro/Zeusro.github.io.git
1626
```
1727

1828
运行后看到输出:
1929

2030
```shell
31+
NAME: myjekyll
32+
LAST DEPLOYED: Tue Jul 23 19:47:55 2019
33+
NAMESPACE: default
34+
STATUS: DEPLOYED
35+
36+
RESOURCES:
37+
==> v1beta2/Deployment
38+
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
39+
myjekyll 1 1 1 0 0s
2140

41+
==> v1beta1/Ingress
42+
NAME HOSTS ADDRESS PORTS AGE
43+
myjekyll b.zeusro.tech 80 0s
44+
45+
==> v1/Pod(related)
46+
NAME READY STATUS RESTARTS AGE
47+
myjekyll-6554fc9f8b-j7lds 0/1 ContainerCreating 0 0s
48+
49+
==> v1/Service
50+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
51+
myjekyll ClusterIP 172.30.0.192 <none> 4000/TCP 0s
52+
53+
54+
NOTES:
55+
设置 DNS 解析指向 ingress 公网IP.
56+
友情提示: 如果你的 Kubernetes 地址位于国内,记得先对域名备案哦~
57+
URL 如下:
58+
http://www.zeusro.tech/
2259
```
2360

2461
## 注意事项
2562

63+
默认用的是
64+
2665
默认的工作目录是 `/srv/jekyll`
2766
用户是 jekyll.
2867

2968
使用外部 volume 时要**注意 Linux 文件所有者的问题**.
3069

3170
[镜像的 dockerfile](https://github.com/envygeeks/jekyll-docker/blob/master/repos/jekyll/Dockerfile) 里面有一行 : `ENTRYPOINT ["/usr/jekyll/bin/entrypoint"]`
3271
如果要重写 deploy ,要注意这个问题
33-
34-
## 使用参数
35-
36-
参数名|意义
37-
--|--
38-
name|release 名称
39-
fullnameOverride|资源(service,deploy)名称
40-
jekyll_host |博客公网 URL
41-
ingress.hosts|博客公网 URL
42-
public_git_url|jekyll 源代码路径(不一定要GitHub,但需要能够支持公开拉取)

submitted/jekyll/templates/deployment.yaml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ metadata:
99
heritage: {{ .Release.Service }}
1010
spec:
1111
replicas: {{ .Values.replicaCount }}
12+
strategy:
13+
{{ toYaml .Values.deployment.updateStrategy | indent 4 }}
1214
selector:
1315
matchLabels:
1416
app: {{ include "jekyll.name" . }}
@@ -19,10 +21,18 @@ spec:
1921
app: {{ include "jekyll.name" . }}
2022
release: {{ .Release.Name }}
2123
spec:
24+
volumes:
25+
{{- with .Values.volumes }}
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
2228
containers:
2329
- name: {{ .Chart.Name }}
2430
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
2531
imagePullPolicy: {{ .Values.image.pullPolicy }}
32+
command:
33+
- 'jekyll'
34+
- 'serve'
35+
- '-w'
2636
ports:
2737
- name: http
2838
containerPort: 4000
@@ -35,13 +45,26 @@ spec:
3545
httpGet:
3646
path: /
3747
port: http
48+
volumeMounts:
49+
{{- range $pv := .Values.persistentVolume }}
50+
- name: {{ $pv.name | quote }}
51+
mountPath: {{ $pv.mountPath | quote }}
52+
{{- end }}
3853
{{if .Values.deployment.env}}
3954
env:
40-
{{ toYaml .Values.deployment.env | indent 12 }}
55+
{{- range $env := .Values.deployment.env }}
56+
- name: {{ $env.name }}
57+
value: {{ $env.value | quote }}
58+
{{- end }}
4159
{{end}}
4260
{{if .Values.deployment.lifecycle}}
4361
lifecycle:
44-
{{ toYaml .Values.deployment.lifecycle | indent 12 }}
62+
postStart:
63+
exec:
64+
command:
65+
{{- range $command := .Values.deployment.lifecycle.postStart.exec.command }}
66+
- {{ $command | quote}}
67+
{{- end }}
4568
{{end}}
4669
resources:
4770
{{ toYaml .Values.resources | indent 12 }}

submitted/jekyll/values.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5-
# variable
6-
jekyll_host: ''
7-
8-
95
replicaCount: 1
106

117
image:
@@ -17,25 +13,35 @@ nameOverride: ""
1713
fullnameOverride: ""
1814

1915
deployment:
16+
# The update strategy to apply to the Deployment
17+
updateStrategy: {}
18+
# rollingUpdate:
19+
# maxUnavailable: 0
20+
# type: RollingUpdate
2021
env:
21-
name: FULL_CHOWN
22-
value: "FULL_CHOWN"
23-
name:
24-
value:
22+
- name: FULL_CHOWN
23+
value: "FULL_CHOWN"
24+
- name: GIT_URL
25+
value: https://github.com/zeusro/Zeusro.github.io.git
26+
# 第一种方式: 这里用 postStart 拉取 GitHub 仓库
2527
lifecycle:
2628
postStart:
2729
exec:
2830
command:
2931
- /bin/sh
3032
- -c
31-
- "git init;git remote add origin $;git pull origin master;"
33+
- "git init;git remote add origin $GIT_URL;git pull origin master;"
34+
35+
# 第二种方式: 使用volume
36+
persistentVolume: {}
37+
volumes: []
3238

3339
service:
3440
type: ClusterIP
3541
port: 4000
3642

3743
ingress:
38-
enabled: false
44+
enabled: true
3945
annotations: {}
4046
# kubernetes.io/ingress.class: nginx
4147
# kubernetes.io/tls-acme: "true"

0 commit comments

Comments
 (0)