diff --git a/Chart.yaml b/Chart.yaml index c394b6b..5dd8d66 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -1,7 +1,7 @@ --- apiVersion: v2 name: swaggerui -version: 0.3.2 +version: 0.3.3 appVersion: 3.24.3 description: Swagger is an open-source software framework backed by a large ecosystem of tools that helps developers design, build, document, and consume RESTful Web services. keywords: diff --git a/README.md b/README.md index 9f58793..1e916e1 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ The following table lists the configurable parameters of the swagger-ui chart an | **Deployment** | | `deployment.replicas` | Number of replicas | `1` | | `deployment.extraEnv` | Additional environment variable | `` | +| `deployment.jsonNoCheckCertificate` | Enable/Disable certificate check | `false` | | **Service** | | `service.type` | Type of service for swagger-ui frontend | `NodePort` | | `service.port` | Port to expose service | `8080` | @@ -100,4 +101,4 @@ Please read the official [Contribution Guide](https://github.com/helm/charts/blo ## License -[Apache License 2.0](/LICENSE.md) +[Apache License 2.0](/LICENSE.md) \ No newline at end of file diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 3e42a03..5def3eb 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -34,7 +34,12 @@ spec: name: swagger-config {{ else }} command: ["/bin/sh","-c"] - args : {{ (printf "[\"mkdir /api-doc && wget %s -O /api-doc/openapi.json && apk update && apk add jq && jq '.servers += [{\\\"url\\\":\\\"%s\\\",\\\"description\\\":\\\"%s\\\"}]' /api-doc/openapi.json > json.tmp && mv json.tmp /api-doc/openapi.json && /usr/share/nginx/run.sh\"]" .Values.swaggerui.jsonUrl .Values.swaggerui.server.url .Values.swaggerui.server.description ) }} {{ end }} + {{- if .Values.deployment.jsonNoCheckCertificate }} + args : {{ (printf "[\"mkdir /api-doc && wget --no-check-certificate %s -O /api-doc/openapi.json && apk update && apk add jq && jq '.servers += [{\\\"url\\\":\\\"%s\\\",\\\"description\\\":\\\"%s\\\"}]' /api-doc/openapi.json > json.tmp && mv json.tmp /api-doc/openapi.json && /usr/share/nginx/run.sh\"]" .Values.swaggerui.jsonUrl .Values.swaggerui.server.url .Values.swaggerui.server.description ) }} + {{- else }} + args : {{ (printf "[\"mkdir /api-doc && wget %s -O /api-doc/openapi.json && apk update && apk add jq && jq '.servers += [{\\\"url\\\":\\\"%s\\\",\\\"description\\\":\\\"%s\\\"}]' /api-doc/openapi.json > json.tmp && mv json.tmp /api-doc/openapi.json && /usr/share/nginx/run.sh\"]" .Values.swaggerui.jsonUrl .Values.swaggerui.server.url .Values.swaggerui.server.description ) }} + {{- end }} + {{- end }} env: {{- with .Values.deployment.extraEnv }} {{- toYaml . | nindent 10 }} @@ -48,6 +53,8 @@ spec: - name: http containerPort: 8080 protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.swaggerui.jsonPath }} volumes: - name: swagger-config @@ -56,4 +63,4 @@ spec: items: - key: conf.json path: openapi.json - {{ end }} + {{ end }} \ No newline at end of file diff --git a/templates/hpa.yaml b/templates/hpa.yaml new file mode 100644 index 0000000..6c8f5af --- /dev/null +++ b/templates/hpa.yaml @@ -0,0 +1,31 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "swagger-ui.fullname" . }} + labels: + app: {{ template "swagger-ui.name" . }} + chart: {{ template "swagger-ui.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "swagger-ui.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/values.yaml b/values.yaml index 96d12ca..ee429e1 100644 --- a/values.yaml +++ b/values.yaml @@ -22,6 +22,7 @@ swaggerui : ## deployment: replicas: 1 + jsonNoCheckCertificate: false extraEnv: # - name: BASE_URL # value: /swagger @@ -79,6 +80,13 @@ livenessProbe: periodSeconds: 30 timeoutSeconds: 10 +autoscaling: + enabled: true + minReplicas: 1 + maxReplicas: 10 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + ## Configure resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ##