Skip to content

Commit 8284ffe

Browse files
committed
MOD:add gohttpserver chart
1 parent 906e27f commit 8284ffe

File tree

9 files changed

+363
-0
lines changed

9 files changed

+363
-0
lines changed

submitted/gohttpserver/.helmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

submitted/gohttpserver/Chart.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: v1
2+
name: gohttpserver
3+
description: 一个用户友好的HTTP文件服务器
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+
version: 0.0.1
18+
19+
# This is the version number of the application being deployed. This version number should be
20+
# incremented each time you make changes to the application.
21+
appVersion: 0.0.1
22+
23+
keywords:
24+
- golang
25+
- httpserver
26+
- Fileserver
27+
28+
icon: https://raw.githubusercontent.com/codeskyblue/gohttpserver/master/assets/favicon.png
29+
30+
sources:
31+
- https://github.com/codeskyblue/gohttpserver
32+
- https://hub.docker.com/r/codeskyblue/gohttpserver

submitted/gohttpserver/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# gohttpserver
2+
3+
## 功能介绍:
4+
5+
目标: 做最好的HTTP文件服务器
6+
7+
功能: 人性化的UI体验,文件的上传支持,安卓和苹果安装包的二维码直接生成。
8+
9+
项目作者源码: [https://github.com/codeskyblue/gohttpserver](https://github.com/codeskyblue/gohttpserver)
10+
11+
基于原作者的docker镜像做了helm包封装.可以做到开箱即用.
12+
13+
14+
## 安装方式:
15+
```shell
16+
helm install gohttpserver ../gohttpserver
17+
```
18+
19+
运行后将看到输出并创建以下k8s api对象:
20+
```shell
21+
➜ gohttpserver git:(gohttpserver) ✗ helm install gohttpserver ../gohttpserver
22+
NAME: gohttpserver
23+
LAST DEPLOYED: 2019-08-08 15:17:21.380347 +0800 CST m=+0.144642186
24+
NAMESPACE: default
25+
STATUS: deployed
26+
27+
NOTES:
28+
1. Get the application URL by running these commands:
29+
http://gohttpserver.calmkart.com/
30+
31+
➜ gohttpserver git:(gohttpserver) ✗ kubectl get pods
32+
NAME READY STATUS RESTARTS AGE
33+
gohttpserver-55fc8964d8-6nsm2 1/1 Running 0 69s
34+
➜ gohttpserver git:(gohttpserver) ✗ kubectl get deployment
35+
NAME READY UP-TO-DATE AVAILABLE AGE
36+
gohttpserver 1/1 1 1 75s
37+
➜ gohttpserver git:(gohttpserver) ✗ kubectl get service
38+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
39+
gohttpserver ClusterIP 10.96.80.28 <none> 8000/TCP 79s
40+
➜ gohttpserver git:(gohttpserver) ✗ kubectl get ingress
41+
NAME HOSTS ADDRESS PORTS AGE
42+
gohttpserver gohttpserver.calmkart.com 80 85s
43+
```
44+
45+
我们可以通过port-forward或者ingress访问服务
46+
47+
>`kubectl port-forward svc/gohttpserver 8000:8000`
48+
- 访问地址 `http://0.0.0.0:8000/`
49+
50+
>将gohttpserver.calmkart.com的域名解析切换到ingress地址即可访问(修改hosts或dns皆可)
51+
- 访问地址: `http://gohttpserver.calmkart.com/`
52+
53+
### 3. 其他备注
54+
55+
#### 可用参数
56+
| Parameter | Description | Default |
57+
| ----- | ----------- | ------ |
58+
| `pullPolicy` | docker镜像拉取策略(因为tag使用的是latest,所以推荐使用默认的Always,调试或特殊情况可修改) |`Always`|
59+
| `nameSpace` | gohttpserver创建的api对象的命名空间 |`"default"`|
60+
| `startArgs.auth_type` | 认证方式,参考项目源官方文档,推荐为空不设置,或设置为http | `''` |
61+
| `startArgs.auth_http` | http认证的账号密码,以:分隔(如calmkart:calmkart),细节参考官方文档 | `''` |
62+
| `startArgs.upload` | 是否开启上传功能,默认为true | `true` |
63+
| `startArgs.delete` | 是否开启删除功能,默认为true | `true` |
64+
| `ingress.hosts` | ingress域名 | `['gohttpserver.calmkart.com']` |
65+
66+
#### 系统源码
67+
68+
[https://github.com/codeskyblue/gohttpserver](https://github.com/codeskyblue/gohttpserver)
69+
70+
#### docker镜像
71+
72+
[https://hub.docker.com/r/codeskyblue/gohttpserver](https://hub.docker.com/r/codeskyblue/gohttpserver)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range .Values.ingress.hosts }}
4+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
5+
{{- end }}
6+
{{- else if contains "NodePort" .Values.service.type }}
7+
export NODE_PORT=$(kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "gohttpserver.fullname" . }})
8+
export NODE_IP=$(kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}")
9+
echo http://$NODE_IP:$NODE_PORT
10+
{{- else if contains "LoadBalancer" .Values.service.type }}
11+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
12+
You can watch the status of by running 'kubectl get svc -w {{ template "gohttpserver.fullname" . }}'
13+
export SERVICE_IP=$(kubectl get svc {{ template "gohttpserver.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
14+
echo http://$SERVICE_IP:{{ .Values.service.port }}
15+
{{- else if contains "ClusterIP" .Values.service.type }}
16+
export POD_NAME=$(kubectl get pods -l "app={{ template "gohttpserver.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
17+
echo "Visit http://127.0.0.1:8080 to use your application"
18+
kubectl port-forward $POD_NAME 8080:80
19+
{{- end }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "gohttpserver.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "gohttpserver.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "gohttpserver.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Common labels
36+
*/}}
37+
{{- define "gohttpserver.labels" -}}
38+
app.kubernetes.io/name: {{ include "gohttpserver.name" . }}
39+
helm.sh/chart: {{ include "gohttpserver.chart" . }}
40+
app.kubernetes.io/instance: {{ .Release.Name }}
41+
{{- if .Chart.AppVersion }}
42+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
43+
{{- end }}
44+
app.kubernetes.io/managed-by: {{ .Release.Service }}
45+
{{- end -}}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
apiVersion: apps/v1beta2
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "gohttpserver.fullname" . }}
5+
namespace: {{ .Values.nameSpace }}
6+
labels:
7+
{{ include "gohttpserver.labels" . | indent 4 }}
8+
spec:
9+
replicas: {{ .Values.replicaCount }}
10+
selector:
11+
matchLabels:
12+
app.kubernetes.io/name: {{ include "gohttpserver.name" . }}
13+
app.kubernetes.io/instance: {{ .Release.Name }}
14+
template:
15+
metadata:
16+
labels:
17+
app.kubernetes.io/name: {{ include "gohttpserver.name" . }}
18+
app.kubernetes.io/instance: {{ .Release.Name }}
19+
spec:
20+
containers:
21+
- name: {{ .Chart.Name }}
22+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
23+
imagePullPolicy: {{ .Values.image.pullPolicy }}
24+
command: ["{{ .Values.startCommand }}"]
25+
args:
26+
- "--root={{ .Values.startArgs.root }}"
27+
{{if .Values.startArgs.auth_type -}}
28+
- "--auth-type={{ .Values.startArgs.auth_type }}"
29+
{{- end }}
30+
{{if .Values.startArgs.auth_http }}
31+
- "--auth-http={{ .Values.startArgs.auth_http }}"
32+
{{- end }}
33+
{{if .Values.startArgs.upload -}}
34+
- "--upload"
35+
{{- end }}
36+
{{if .Values.startArgs.delete -}}
37+
- "--delete"
38+
{{- end }}
39+
ports:
40+
- name: http
41+
containerPort: 8000
42+
protocol: TCP
43+
livenessProbe:
44+
httpGet:
45+
path: /
46+
port: http
47+
readinessProbe:
48+
httpGet:
49+
path: /
50+
port: http
51+
resources:
52+
{{ toYaml .Values.resources | indent 12 }}
53+
{{- with .Values.nodeSelector }}
54+
nodeSelector:
55+
{{ toYaml . | indent 8 }}
56+
{{- end }}
57+
{{- with .Values.affinity }}
58+
affinity:
59+
{{ toYaml . | indent 8 }}
60+
{{- end }}
61+
{{- with .Values.tolerations }}
62+
tolerations:
63+
{{ toYaml . | indent 8 }}
64+
{{- end }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "gohttpserver.fullname" . -}}
3+
{{- $ingressPath := .Values.ingress.path -}}
4+
apiVersion: extensions/v1beta1
5+
kind: Ingress
6+
metadata:
7+
name: {{ $fullName }}
8+
labels:
9+
{{ include "gohttpserver.labels" . | indent 4 }}
10+
{{- with .Values.ingress.annotations }}
11+
annotations:
12+
{{ toYaml . | indent 4 }}
13+
{{- end }}
14+
spec:
15+
{{- if .Values.ingress.tls }}
16+
tls:
17+
{{- range .Values.ingress.tls }}
18+
- hosts:
19+
{{- range .hosts }}
20+
- {{ . }}
21+
{{- end }}
22+
secretName: {{ .secretName }}
23+
{{- end }}
24+
{{- end }}
25+
rules:
26+
{{- range .Values.ingress.hosts }}
27+
- host: {{ . }}
28+
http:
29+
paths:
30+
- path: {{ $ingressPath }}
31+
backend:
32+
serviceName: {{ $fullName }}
33+
servicePort: http
34+
{{- end }}
35+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ template "gohttpserver.fullname" . }}
5+
namepace: {{ .Values.nameSpace }}
6+
labels:
7+
{{ include "gohttpserver.labels" . | indent 4 }}
8+
spec:
9+
type: {{ .Values.service.type }}
10+
ports:
11+
- port: {{ .Values.service.port }}
12+
targetPort: http
13+
protocol: TCP
14+
name: http
15+
selector:
16+
app.kubernetes.io/name: {{ include "gohttpserver.name" . }}
17+
app.kubernetes.io/instance: {{ .Release.Name }}

submitted/gohttpserver/values.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Default values for django-sso-server.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
image:
8+
repository: codeskyblue/gohttpserver
9+
tag: latest
10+
pullPolicy: Always
11+
12+
nameOverride: ""
13+
fullnameOverride: ""
14+
nameSpace: "default"
15+
16+
startCommand:
17+
'/app/gohttpserver'
18+
startArgs:
19+
root: '/app/public'
20+
auth_type: ''
21+
auth_http: ''
22+
upload: true
23+
delete: true
24+
25+
26+
27+
service:
28+
type: ClusterIP
29+
port: 8000
30+
31+
ingress:
32+
enabled: true
33+
annotations: {}
34+
path: /
35+
hosts:
36+
- 'gohttpserver.calmkart.com'
37+
tls: []
38+
# - secretName: chart-example-tls
39+
# hosts:
40+
# - chart-example.local
41+
42+
resources: {}
43+
# We usually recommend not to specify default resources and to leave this as a conscious
44+
# choice for the user. This also increases chances charts run on environments with little
45+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
46+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
47+
# limits:
48+
# cpu: 100m
49+
# memory: 128Mi
50+
# requests:
51+
# cpu: 100m
52+
# memory: 128Mi
53+
54+
nodeSelector: {}
55+
56+
tolerations: []
57+
58+
affinity: {}

0 commit comments

Comments
 (0)