File tree Expand file tree Collapse file tree 10 files changed +327
-0
lines changed Expand file tree Collapse file tree 10 files changed +327
-0
lines changed Original file line number Diff line number Diff line change
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
22
+ .vscode/
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ appVersion : " 1.0"
3
+ description : A Helm chart for Kubernetes
4
+ name : swagger-ui
5
+ version : 0.1.0
Original file line number Diff line number Diff line change
1
+ # swagger-ui
2
+
3
+ ##功能介绍
4
+
5
+ swagger-ui 是一个 API 文档管理工具,可以让我们把定义的接口以配置文件的方式编写,最后在 Web 端生成一个可视化的接口文档,可以支持管理一个或多个项目的接口。
6
+
7
+
8
+ ## 安装使用
9
+
10
+ ```
11
+ $ helm install swagger-ui
12
+
13
+ or
14
+
15
+ // helm v3
16
+ $ helm install swagger-ui --generate-name
17
+ ```
18
+
19
+ 运行后看到输出:
20
+
21
+ ```
22
+ NAME: orange-panther
23
+ LAST DEPLOYED: Wed Aug 14 20:00:56 2019
24
+ NAMESPACE: pks-installer
25
+ STATUS: DEPLOYED
26
+
27
+ RESOURCES:
28
+ ==> v1/Deployment
29
+ NAME READY UP-TO-DATE AVAILABLE AGE
30
+ orange-panther-swagger-ui 0/2 0 0 1s
31
+
32
+ ==> v1/Pod(related)
33
+ NAME READY STATUS RESTARTS AGE
34
+ orange-panther-swagger-ui-75b6fdd7c-hbpb5 0/1 Pending 0 0s
35
+ orange-panther-swagger-ui-75b6fdd7c-wmd92 0/1 Pending 0 0s
36
+
37
+ ==> v1/Service
38
+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
39
+ orange-panther-swagger-ui ClusterIP 10.100.227.231 <none> 80/TCP 1s
40
+
41
+
42
+ NOTES:
43
+ 1. Get the application URL by running these commands:
44
+ export POD_NAME=$(kubectl get pods --namespace pks-installer -l "app.kubernetes.io/name=swagger-ui,app.kubernetes.io/instance=orange-panther" -o jsonpath="{.items[0].metadata.name}")
45
+ echo "Visit http://127.0.0.1:8080 to use your application"
46
+ kubectl port-forward $POD_NAME 8080:80
47
+ ```
48
+
49
+ Web 界面如下所示:
50
+
51
+ ![ ] ( http://cdn.tianfeiyu.com/image-20190815091012095.png )
52
+
53
+
54
+ ## 其他说明
55
+
56
+ 如需自定义 API 配置,请参考:[ https://github.com/gosoon/app-charts/ ] ( https://github.com/gosoon/app-charts/ )
57
+
Original file line number Diff line number Diff line change
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 }}{{ . }}
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 "swagger-ui.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 the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "swagger-ui.fullname" . }}'
15
+ export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "swagger-ui.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
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 "swagger-ui.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19
+ echo "Visit http://127.0.0.1:8080 to use your application"
20
+ kubectl port-forward $POD_NAME 8080:80
21
+ {{- end }}
Original file line number Diff line number Diff line change
1
+ { {/* vim: set filetype= mustache: */} }
2
+ { {/*
3
+ Expand the name of the chart.
4
+ */} }
5
+ { {- define " swagger-ui.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 " swagger-ui.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 " swagger-ui.chart" -} }
31
+ { {- printf " %s-%s" .Chart.Name .Chart.Version | replace " +" " _" | trunc 63 | trimSuffix " -" -} }
32
+ { {- end -} }
33
+
34
+ { {/*
35
+ Common labels
36
+ */} }
37
+ { {- define " swagger-ui.labels" -} }
38
+ app.kubernetes.io/name: { { include " swagger-ui.name" . } }
39
+ helm.sh/chart: { { include " swagger-ui.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 -} }
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ name : {{ include "swagger-ui.fullname" . }}
5
+ labels :
6
+ {{ include "swagger-ui.labels" . | indent 4 }}
7
+ spec :
8
+ replicas : {{ .Values.replicaCount }}
9
+ selector :
10
+ matchLabels :
11
+ app.kubernetes.io/name : {{ include "swagger-ui.name" . }}
12
+ app.kubernetes.io/instance : {{ .Release.Name }}
13
+ template :
14
+ metadata :
15
+ labels :
16
+ app.kubernetes.io/name : {{ include "swagger-ui.name" . }}
17
+ app.kubernetes.io/instance : {{ .Release.Name }}
18
+ spec :
19
+ {{- with .Values.imagePullSecrets }}
20
+ imagePullSecrets :
21
+ {{- toYaml . | nindent 8 }}
22
+ {{- end }}
23
+ containers :
24
+ - name : {{ .Chart.Name }}
25
+ image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
26
+ imagePullPolicy : {{ .Values.image.pullPolicy }}
27
+ ports :
28
+ - name : http
29
+ containerPort : 8080
30
+ protocol : TCP
31
+ env :
32
+ - name : BASE_URL
33
+ value : /swagger-ui
34
+ - name : API_URLS
35
+ value : >-
36
+ [
37
+ {url:'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml',name:'Pet Store Example'},
38
+ {url:'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/uspto.yaml',name:'USPTO'},
39
+ ]
40
+ livenessProbe :
41
+ httpGet :
42
+ path : /
43
+ port : http
44
+ readinessProbe :
45
+ httpGet :
46
+ path : /
47
+ port : http
48
+ resources :
49
+ {{- toYaml .Values.resources | nindent 12 }}
50
+ {{- with .Values.nodeSelector }}
51
+ nodeSelector :
52
+ {{- toYaml . | nindent 8 }}
53
+ {{- end }}
54
+ {{- with .Values.affinity }}
55
+ affinity :
56
+ {{- toYaml . | nindent 8 }}
57
+ {{- end }}
58
+ {{- with .Values.tolerations }}
59
+ tolerations :
60
+ {{- toYaml . | nindent 8 }}
61
+ {{- end }}
Original file line number Diff line number Diff line change
1
+ {{- if .Values.ingress.enabled -}}
2
+ {{- $fullName := include "swagger-ui.fullname" . -}}
3
+ apiVersion : extensions/v1beta1
4
+ kind : Ingress
5
+ metadata :
6
+ name : {{ $fullName }}
7
+ labels :
8
+ {{ include "swagger-ui.labels" . | indent 4 }}
9
+ {{- with .Values.ingress.annotations }}
10
+ annotations :
11
+ {{- toYaml . | nindent 4 }}
12
+ {{- end }}
13
+ spec :
14
+ {{- if .Values.ingress.tls }}
15
+ tls :
16
+ {{- range .Values.ingress.tls }}
17
+ - hosts :
18
+ {{- range .hosts }}
19
+ - {{ . | quote }}
20
+ {{- end }}
21
+ secretName : {{ .secretName }}
22
+ {{- end }}
23
+ {{- end }}
24
+ rules :
25
+ {{- range .Values.ingress.hosts }}
26
+ - host : {{ .host | quote }}
27
+ http :
28
+ paths :
29
+ {{- range .paths }}
30
+ - path : {{ . }}
31
+ backend :
32
+ serviceName : {{ $fullName }}
33
+ servicePort : http
34
+ {{- end }}
35
+ {{- end }}
36
+ {{- end }}
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ kind : Service
3
+ metadata :
4
+ name : {{ include "swagger-ui.fullname" . }}
5
+ labels :
6
+ {{ include "swagger-ui.labels" . | indent 4 }}
7
+ spec :
8
+ type : {{ .Values.service.type }}
9
+ ports :
10
+ - port : {{ .Values.service.port }}
11
+ targetPort : 8080
12
+ protocol : TCP
13
+ selector :
14
+ app.kubernetes.io/name : {{ include "swagger-ui.name" . }}
15
+ app.kubernetes.io/instance : {{ .Release.Name }}
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ kind : Pod
3
+ metadata :
4
+ name : " {{ include " swagger-ui.fullname" . }}-test-connection"
5
+ labels :
6
+ {{ include "swagger-ui.labels" . | indent 4 }}
7
+ annotations :
8
+ " helm.sh/hook " : test-success
9
+ spec :
10
+ containers :
11
+ - name : wget
12
+ image : busybox
13
+ command : ['wget']
14
+ args : ['{{ include "swagger-ui.fullname" . }}:{{ .Values.service.port }}']
15
+ restartPolicy : Never
Original file line number Diff line number Diff line change
1
+ # Default values for swagger-ui.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+
5
+ replicaCount : 2
6
+
7
+ image :
8
+ repository : swaggerapi/swagger-ui
9
+ tag : v3.14.1
10
+ pullPolicy : IfNotPresent
11
+
12
+ imagePullSecrets : []
13
+ nameOverride : " "
14
+ fullnameOverride : " "
15
+
16
+ service :
17
+ type : ClusterIP
18
+ port : 80
19
+
20
+ ingress :
21
+ enabled : false
22
+ annotations : {}
23
+ # kubernetes.io/ingress.class: nginx
24
+ # kubernetes.io/tls-acme: "true"
25
+ hosts :
26
+ - host : chart-example.local
27
+ paths : []
28
+
29
+ tls : []
30
+ # - secretName: chart-example-tls
31
+ # hosts:
32
+ # - chart-example.local
33
+
34
+ resources : {}
35
+ # We usually recommend not to specify default resources and to leave this as a conscious
36
+ # choice for the user. This also increases chances charts run on environments with little
37
+ # resources, such as Minikube. If you do want to specify resources, uncomment the following
38
+ # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
39
+ # limits:
40
+ # cpu: 100m
41
+ # memory: 128Mi
42
+ # requests:
43
+ # cpu: 100m
44
+ # memory: 128Mi
45
+
46
+ nodeSelector : {}
47
+
48
+ tolerations : []
49
+
50
+ affinity : {}
You can’t perform that action at this time.
0 commit comments