From 867354362eeb91e9c74a359e7f028ef1d9d3c601 Mon Sep 17 00:00:00 2001 From: Sergio Rua Date: Wed, 29 Sep 2021 15:23:29 +0100 Subject: [PATCH 1/4] Add resources and insecure wget --- Chart.yaml | 2 +- templates/deployment.yaml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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/templates/deployment.yaml b/templates/deployment.yaml index 3e42a03..9195653 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -34,7 +34,7 @@ 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 }} + 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 ) }} {{ end }} env: {{- with .Values.deployment.extraEnv }} {{- toYaml . | nindent 10 }} @@ -48,6 +48,8 @@ spec: - name: http containerPort: 8080 protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.swaggerui.jsonPath }} volumes: - name: swagger-config From dc12b22d9597412f014490e485644c987bee2030 Mon Sep 17 00:00:00 2001 From: Sergio Rua Date: Wed, 29 Sep 2021 15:46:55 +0100 Subject: [PATCH 2/4] Add hpa --- templates/hpa.yaml | 31 +++++++++++++++++++++++++++++++ values.yaml | 7 +++++++ 2 files changed, 38 insertions(+) create mode 100644 templates/hpa.yaml 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..57cc428 100644 --- a/values.yaml +++ b/values.yaml @@ -79,6 +79,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/ ## From 37e4b83b73605bb57394810d59e4cc7ef2caa23c Mon Sep 17 00:00:00 2001 From: Sebastien Dupont Date: Wed, 20 Oct 2021 10:23:10 +0200 Subject: [PATCH 3/4] doc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f58793..ae93770 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ The following items can be set via `--set` flag during installation or configure ### Install the chart -Install the swagger-ui helm chart with a release name `my-release`: +Install the swagger-ui helm chart with a release name (`my-release`): ```bash helm install --name my-release cetic/swaggerui From d205a59aa81ee73bd8878e0bdfec9a05d185f339 Mon Sep 17 00:00:00 2001 From: Sergio Rua Date: Wed, 20 Oct 2021 13:19:15 +0100 Subject: [PATCH 4/4] Merge changes from feature/sslcheckskip --- README.md | 5 +++-- templates/deployment.yaml | 9 +++++++-- values.yaml | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ae93770..1e916e1 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ The following items can be set via `--set` flag during installation or configure ### Install the chart -Install the swagger-ui helm chart with a release name (`my-release`): +Install the swagger-ui helm chart with a release name `my-release`: ```bash helm install --name my-release cetic/swaggerui @@ -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 9195653..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 --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 ) }} {{ 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 }} @@ -58,4 +63,4 @@ spec: items: - key: conf.json path: openapi.json - {{ end }} + {{ end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index 57cc428..ee429e1 100644 --- a/values.yaml +++ b/values.yaml @@ -22,6 +22,7 @@ swaggerui : ## deployment: replicas: 1 + jsonNoCheckCertificate: false extraEnv: # - name: BASE_URL # value: /swagger