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 0000000..5408215 Binary files /dev/null and b/wiremock-1.0.0.tgz differ