From 53202e15f54c7d0baff2cde360ceb95dcf13d98d Mon Sep 17 00:00:00 2001 From: DanielFran Date: Wed, 3 Jul 2024 23:47:51 +0100 Subject: [PATCH] Changelog: - Update image version and index - Update readme with instructions to use helm repository - Update notes and readme with port-forward instructions - Switch to Helm v2 - Substitute WIREMOCK_OPTION by args - Cleanup _helpers.tpl - Support additional pod annotations - Update configmaps - Update service - Fix ingress - Add imagePullSecrets support - Add service account support - Add pod and container security context support - Add horizontal pod autoscaler support - Update CI and CD pipelines Fix https://github.com/wiremock/helm-charts/issues/21 Fix https://github.com/wiremock/helm-charts/issues/22 Fix https://github.com/wiremock/helm-charts/issues/25 Fix https://github.com/wiremock/helm-charts/issues/27 Fix https://github.com/wiremock/helm-charts/issues/28 Fix https://github.com/wiremock/helm-charts/issues/34 Fix https://github.com/wiremock/helm-charts/issues/40 Close https://github.com/wiremock/helm-charts/pull/29 Close https://github.com/wiremock/helm-charts/pull/31 Close https://github.com/wiremock/helm-charts/pull/33 Close https://github.com/wiremock/helm-charts/pull/39 --- .github/workflows/cd.yaml | 10 +- .github/workflows/ci.yaml | 23 ++-- README.md | 10 ++ charts/wiremock/.helmignore | 2 + charts/wiremock/Chart.yaml | 28 ++++- charts/wiremock/README.md | 6 +- charts/wiremock/templates/NOTES.txt | 15 ++- charts/wiremock/templates/_helpers.tpl | 74 ++++++++++--- .../templates/configmap-mappings.yaml | 6 +- .../templates/configmap-responses.yaml | 6 +- charts/wiremock/templates/deployment.yaml | 104 ++++++++++-------- charts/wiremock/templates/hpa.yaml | 28 +++++ charts/wiremock/templates/ingress.yaml | 65 +++++++---- charts/wiremock/templates/service.yaml | 10 +- charts/wiremock/templates/serviceaccount.yaml | 12 ++ charts/wiremock/values.yaml | 67 +++++++++-- index.yaml | 28 +++++ wiremock-1.0.0.tgz | Bin 0 -> 5351 bytes 18 files changed, 354 insertions(+), 140 deletions(-) create mode 100644 charts/wiremock/templates/hpa.yaml create mode 100644 charts/wiremock/templates/serviceaccount.yaml create mode 100644 wiremock-1.0.0.tgz diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 671d507..a0ce331 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -20,11 +20,11 @@ jobs: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Install Helm - uses: azure/setup-helm@v1 - with: - version: v3.8.1 + uses: azure/setup-helm@v4 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.4.0 + uses: helm/chart-releaser-action@v1.6.0 env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f448c5b..7157e55 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,36 +19,39 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v3 with: - version: v3.8.1 + version: v3.14.0 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: '3.12' + check-latest: true - name: Set up chart-testing - uses: helm/chart-testing-action@v2.2.1 + uses: helm/chart-testing-action@v2.6.1 - name: Run chart-testing (list-changed) id: list-changed run: | changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) if [[ -n "$changed" ]]; then - echo "::set-output name=changed::true" + echo "changed=true" >> "$GITHUB_OUTPUT" fi - name: Run chart-testing (lint) - run: ct lint + if: steps.list-changed.outputs.changed == 'true' + run: ct lint --target-branch ${{ github.event.repository.default_branch }} - name: Create kind cluster - uses: helm/kind-action@v1.2.0 if: steps.list-changed.outputs.changed == 'true' + uses: helm/kind-action@v1.8.0 - name: Run chart-testing (install) - run: ct install \ No newline at end of file + if: steps.list-changed.outputs.changed == 'true' + run: ct install --target-branch ${{ github.event.repository.default_branch }} \ No newline at end of file diff --git a/README.md b/README.md index 5acd880..5dc5511 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,16 @@ and the chart remains partially compatible with it. ## Install WireMock +Once Helm is installed, you can either add this repository with `helm repo add`: + +```bash +helm repo add wiremock https://wiremock.github.io/helm-charts +``` + +You can then run `helm upgrade --install wiremock/wiremock` to install it through the repository. + +Alternatively, you can clone the helm repo and then install it with a local reference: + ```bash helm upgrade --install ./charts/ ``` diff --git a/charts/wiremock/.helmignore b/charts/wiremock/.helmignore index f0c1319..0e8a0eb 100644 --- a/charts/wiremock/.helmignore +++ b/charts/wiremock/.helmignore @@ -14,8 +14,10 @@ *.swp *.bak *.tmp +*.orig *~ # Various IDEs .project .idea/ *.tmproj +.vscode/ diff --git a/charts/wiremock/Chart.yaml b/charts/wiremock/Chart.yaml index eff7585..f955808 100644 --- a/charts/wiremock/Chart.yaml +++ b/charts/wiremock/Chart.yaml @@ -1,8 +1,28 @@ -apiVersion: v1 -appVersion: "3.0.0.1" -description: A Helm chart for WireMock deployment on Kubernetes +apiVersion: v2 name: wiremock -version: 0.2.0 +description: A Helm chart for WireMock deployment on Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 1.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "3.8.0" + maintainers: - name: "gitkent" url: "https://github.com/gitkent" diff --git a/charts/wiremock/README.md b/charts/wiremock/README.md index c2bd208..c5b1de6 100644 --- a/charts/wiremock/README.md +++ b/charts/wiremock/README.md @@ -25,12 +25,14 @@ Setup port forwarding ```bash $ export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "wiremock.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") -$ kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort}} +$ export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + +$ kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT ``` ## Verify Wiremock deployment -To verify erifying a response using Wiremock, run +To verify a response using Wiremock, run ```bash $ curl -X POST http://127.0.0.1:8080/v1/hello diff --git a/charts/wiremock/templates/NOTES.txt b/charts/wiremock/templates/NOTES.txt index 0b79830..d67eb39 100644 --- a/charts/wiremock/templates/NOTES.txt +++ b/charts/wiremock/templates/NOTES.txt @@ -1,7 +1,9 @@ 1. Get the application URL by running these commands: {{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "wiremock.fullname" . }}) @@ -9,12 +11,13 @@ echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get svc -w {{ include "wiremock.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "wiremock.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "wiremock.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "wiremock.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "wiremock.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort}} + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT echo "Visit http://127.0.0.1:8080/__admin/mappings to use your application" run "curl -X POST http://127.0.0.1:8080/v1/hello" -{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/wiremock/templates/_helpers.tpl b/charts/wiremock/templates/_helpers.tpl index 867b754..4af380a 100644 --- a/charts/wiremock/templates/_helpers.tpl +++ b/charts/wiremock/templates/_helpers.tpl @@ -1,10 +1,9 @@ -{{/* vim: set filetype=mustache: */}} {{/* Expand the name of the chart. */}} {{- define "wiremock.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} {{/* Create a default fully qualified app name. @@ -12,21 +11,64 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this If release name contains chart name it will be used as a full name. */}} {{- define "wiremock.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} {{/* Create chart name and version as used by the chart label. */}} {{- define "wiremock.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "wiremock.labels" -}} +helm.sh/chart: {{ include "wiremock.chart" . }} +{{ include "wiremock.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "wiremock.selectorLabels" -}} +app.kubernetes.io/name: {{ include "wiremock.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "wiremock.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "wiremock.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Pod annotations +*/}} +{{- define "wiremock.podAnnotations" -}} +checksum/configMappings: {{ include (print $.Template.BasePath "/configmap-mappings.yaml") . | sha256sum }} +checksum/configResponses: {{ include (print $.Template.BasePath "/configmap-responses.yaml") . | sha256sum }} +{{- if .Values.podAnnotations }} +{{ .Values.podAnnotations }} +{{- end }} +{{- end }} + diff --git a/charts/wiremock/templates/configmap-mappings.yaml b/charts/wiremock/templates/configmap-mappings.yaml index e362267..036b39e 100644 --- a/charts/wiremock/templates/configmap-mappings.yaml +++ b/charts/wiremock/templates/configmap-mappings.yaml @@ -2,12 +2,8 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "wiremock.fullname" . }}-mappings-configs - namespace: {{ .Release.Namespace | quote }} labels: - app.kubernetes.io/name: {{ include "wiremock.name" . }} - helm.sh/chart: {{ include "wiremock.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "wiremock.labels" . | nindent 4 }} data: {{- $files := .Files }} {{- range $key, $value := .Files }} diff --git a/charts/wiremock/templates/configmap-responses.yaml b/charts/wiremock/templates/configmap-responses.yaml index d5b4017..61badf2 100644 --- a/charts/wiremock/templates/configmap-responses.yaml +++ b/charts/wiremock/templates/configmap-responses.yaml @@ -2,12 +2,8 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "wiremock.fullname" . }}-responses-configs - namespace: {{ .Release.Namespace | quote }} labels: - app.kubernetes.io/name: {{ include "wiremock.name" . }} - helm.sh/chart: {{ include "wiremock.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "wiremock.labels" . | nindent 4 }} data: {{- $files := .Files }} {{- range $key, $value := .Files }} diff --git a/charts/wiremock/templates/deployment.yaml b/charts/wiremock/templates/deployment.yaml index 793d71c..c35df0d 100644 --- a/charts/wiremock/templates/deployment.yaml +++ b/charts/wiremock/templates/deployment.yaml @@ -3,35 +3,43 @@ kind: Deployment metadata: name: {{ include "wiremock.fullname" . }} labels: - app.kubernetes.io/name: {{ include "wiremock.name" . }} - helm.sh/chart: {{ include "wiremock.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "wiremock.labels" . | nindent 4 }} spec: + {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} + {{- end }} selector: matchLabels: - app.kubernetes.io/name: {{ include "wiremock.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "wiremock.selectorLabels" . | nindent 6 }} template: metadata: annotations: - checksum/configMappings: {{ include (print $.Template.BasePath "/configmap-mappings.yaml") . | sha256sum }} - checksum/configResponses: {{ include (print $.Template.BasePath "/configmap-responses.yaml") . | sha256sum }} + {{- include "wiremock.podAnnotations" . | nindent 8 }} labels: - app.kubernetes.io/name: {{ include "wiremock.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "wiremock.selectorLabels" . | nindent 8 }} spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "wiremock.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- if .Values.env }} + {{- with .Values.env }} env: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: + {{- range .Values.args }} + - {{ . | quote }} {{- end }} - {{- range $key, $value := .Values.env }} - - name: {{ $key }} - value: {{ tpl $value $ | quote }} {{- end }} ports: - containerPort: {{ .Values.service.internalPort }} @@ -47,43 +55,45 @@ spec: port: {{ .Values.service.internalPort }} scheme: {{ .Values.scheme }} resources: -{{ toYaml .Values.resources | indent 12 }} + {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - - mountPath: /home/wiremock/storage/mappings - name: mappings-data - - mountPath: /home/wiremock/storage/__files - name: responses-data + - mountPath: /home/wiremock/storage/mappings + name: mappings-data + - mountPath: /home/wiremock/storage/__files + name: responses-data initContainers: - - name: copy-mappings - image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}" - imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }} - command: ["bash", "-c", "cp -rf /data/mappings /home/wiremock/storage/mappings"] - volumeMounts: - - mountPath: /data/mappings - name: mappings-volume - - mountPath: /home/wiremock/storage/mappings - name: mappings-data - - name: copy-responses - image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}" - imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }} - command: ["bash", "-c", "cp -rf /data/responses /home/wiremock/storage/__files"] - volumeMounts: - - mountPath: /data/responses - name: responses-volume - - mountPath: /home/wiremock/storage/__files - name: responses-data - {{- with .Values.nodeSelector }} + - name: copy-mappings + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}" + imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }} + command: ["bash", "-c", "cp -rf /data/mappings /home/wiremock/storage/mappings"] + volumeMounts: + - mountPath: /data/mappings + name: mappings-volume + - mountPath: /home/wiremock/storage/mappings + name: mappings-data + - name: copy-responses + image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}" + imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }} + command: ["bash", "-c", "cp -rf /data/responses /home/wiremock/storage/__files"] + volumeMounts: + - mountPath: /data/responses + name: responses-volume + - mountPath: /home/wiremock/storage/__files + name: responses-data + {{- with .Values.nodeSelector }} nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} tolerations: -{{ toYaml . | indent 8 }} - {{- end }} + {{- toYaml . | nindent 8 }} + {{- end }} volumes: - name: mappings-data emptyDir: {} diff --git a/charts/wiremock/templates/hpa.yaml b/charts/wiremock/templates/hpa.yaml new file mode 100644 index 0000000..48ebec6 --- /dev/null +++ b/charts/wiremock/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "wiremock.fullname" . }} + labels: + {{- include "wiremock.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "wiremock.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/charts/wiremock/templates/ingress.yaml b/charts/wiremock/templates/ingress.yaml index d99ea9f..0abf006 100644 --- a/charts/wiremock/templates/ingress.yaml +++ b/charts/wiremock/templates/ingress.yaml @@ -1,42 +1,61 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := .Values.service.name -}} -{{- $servicePort := .Values.service.externalPort -}} -{{- $ingressPath := .Values.ingress.path -}} +{{- $fullName := include "wiremock.fullname" . -}} +{{- $svcPort := .Values.service.externalPort -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} kind: Ingress metadata: name: {{ $fullName }} labels: - app.kubernetes.io/name: {{ include "wiremock.name" . }} - helm.sh/chart: {{ include "wiremock.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- with .Values.ingress.annotations }} + {{- include "wiremock.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: -{{- if .Values.ingress.tls }} + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} tls: - {{- range .Values.ingress.tls }} + {{- range .Values.ingress.tls }} - hosts: - {{- range .hosts }} + {{- range .hosts }} - {{ . | quote }} - {{- end }} + {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: - {{- range .Values.ingress.hosts }} - - host: {{ . | quote }} + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} http: paths: - - path: {{ $ingressPath }} - pathType: Prefix + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ $fullName }} - port: - number: {{ $servicePort }} - {{- end }} + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} {{- end }} diff --git a/charts/wiremock/templates/service.yaml b/charts/wiremock/templates/service.yaml index 6944b6a..834c6bd 100644 --- a/charts/wiremock/templates/service.yaml +++ b/charts/wiremock/templates/service.yaml @@ -3,17 +3,13 @@ kind: Service metadata: name: {{ include "wiremock.fullname" . }} labels: - app.kubernetes.io/name: {{ include "wiremock.name" . }} - helm.sh/chart: {{ include "wiremock.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "wiremock.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.externalPort }} targetPort: {{ .Values.service.internalPort }} protocol: TCP - name: {{ .Values.service.name }} + name: {{ include "wiremock.fullname" . }} selector: - app.kubernetes.io/name: {{ include "wiremock.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "wiremock.selectorLabels" . | nindent 4 }} diff --git a/charts/wiremock/templates/serviceaccount.yaml b/charts/wiremock/templates/serviceaccount.yaml new file mode 100644 index 0000000..3c157b3 --- /dev/null +++ b/charts/wiremock/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "wiremock.serviceAccountName" . }} + labels: + {{- include "wiremock.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/wiremock/values.yaml b/charts/wiremock/values.yaml index ca5d085..efa0b5e 100644 --- a/charts/wiremock/values.yaml +++ b/charts/wiremock/values.yaml @@ -6,7 +6,8 @@ replicaCount: 1 image: repository: wiremock/wiremock - tag: 3.2.0-3 + # Overrides the image tag whose default is the chart appVersion. + tag: 3.8.0 pullPolicy: IfNotPresent initContainer: @@ -15,29 +16,68 @@ initContainer: tag: 5 pullPolicy: Always +imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroupChangePolicy: Always + # sysctls: [] + # supplementalGroups: [] + # fsGroup: 2000 + +securityContext: {} + # seLinuxOptions: {} + # runAsUser: 1000 + # runAsGroup: 2000 + # runAsNonRoot: true + # privileged: false + # readOnlyRootFilesystem: true + # allowPrivilegeEscalation: false + # capabilities: + # drop: ["ALL"] + # seccompProfile: + # type: "RuntimeDefault" + service: - name: wiremock type: ClusterIP externalPort: 9021 internalPort: 9021 ingress: enabled: false + className: "" annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - path: / hosts: - - chart-example.local + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific tls: [] # - secretName: chart-example-tls # hosts: # - chart-example.local -env: - WIREMOCK_OPTIONS: "--port=9021 --max-request-journal=1000 --local-response-templating --root-dir=/home/wiremock/storage" + +env: {} + +args: + - "--port=9021" + - "--max-request-journal=1000" + - "--local-response-templating" + - "--root-dir=/home/wiremock/storage" resources: {} # We usually recommend not to specify default resources and to leave this as a conscious @@ -45,11 +85,18 @@ resources: {} # resources, such as Minikube. If you do want to specify resources, uncomment the following # lines, adjust them as necessary, and remove the curly braces after 'resources:'. # limits: - # cpu: 100m - # memory: 128Mi + # cpu: 100m + # memory: 128Mi # requests: - # cpu: 100m - # memory: 128Mi + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 nodeSelector: {} diff --git a/index.yaml b/index.yaml index 8092c6f..95dc3e5 100644 --- a/index.yaml +++ b/index.yaml @@ -1,6 +1,34 @@ apiVersion: v1 entries: wiremock: + - apiVersion: v2 + appVersion: 3.8.0 + created: "2024-07-03T23:46:21.8947434+01:00" + description: A Helm chart for WireMock deployment on Kubernetes + digest: c9f4ca83d3f1f159b83fd93fa3f2ae76075507409d5b90515487ee5f68d9c68d + home: https://wiremock.org + icon: https://wiremock.org/images/logos/wiremock/logo_square.svg + keywords: + - wiremock + - api + - openapi + - api-testing + - rest-api + - api-mocking + maintainers: + - name: gitkent + url: https://github.com/gitkent + - name: oleg-nenashev + url: https://github.com/oleg-nenashev + name: wiremock + sources: + - https://github.com/wiremock/helm-charts + - https://github.com/wiremock/wiremock-docker + - https://github.com/wiremock/wiremock + type: application + urls: + - https://wiremock.github.io/helm-charts/wiremock-1.0.0.tgz + version: 1.0.0 - apiVersion: v1 appVersion: 3.0.0.1 created: "2023-08-30T15:32:11.9806537+02:00" diff --git a/wiremock-1.0.0.tgz b/wiremock-1.0.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..54082150567aaadadff37cc7a7b566a617ec3709 GIT binary patch literal 5351 zcmVDc zVQyr3R8em|NM&qo0PKBja~n63a6Yq&|Dm6;wqobe3`xCuS>>zK%HFJQZJ8%2$!)n( zHaOEH5n+G{fT7G)bie%yz`S!vO0uG4vqDuY5^OXYjqXOH(Lk=K#8`xvz2g~?I#`gH zef7|#-|zPi_V(=Ge!t)RJLn%Cd^OlR*cXVzafhuG_nE{A>juq@tp`S zA;N@-MT}g7;PCf!jFO{9)tQMHhcMGRQNvy@7q>vjX@`aeXWLIb8j~ri9urfcieK#4 zkLu@?NDS0`+PTEVm5`Adc6`WzIzEtuc6<;Ca`%ZO)Yqsq<2tzTRKLmsu)+TC9UL4s?Z5f+Wd9$bJcHLbAt}?~1fXWsgKp;;T+FBfs(`>hj^4fX zCql+VYm8t*8CrjPLM}?XSQsV)@C@G1QA!$_?q&$KDQGf&;Q8p~NTNcnEn%GMW05TomcWwKIp_qJPJe0L&ui$1VcKZ zsNiabdWI4RWPm^%B&eB4S!CuYlt?s2rm6cl1T9l^sE#-n+8Ta4r6h{XAH&WDLIX}p z;2~V!I1Cpvv##f;FAe(p+TVr!lR5HJApFAZ6FR4RWL=4(vS_QqI_yG z=R7Ke%;0qEs$*6nqN65>w)PyuR8qY#^NXK#N&G~8D@B?d&j_DlbM_2?TBuO7Y}#x^ znj{R37ettCT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