我正在尝试使用官方图片中所述的扩展来设置我的wiremock服务器。但是当我通过 helm 部署应用程序时,我不断收到错误:
--extensions com.opentable.extension.BodyTransformer is not a recognized option
我的设置:
部署.yaml:
apiVersion: apps/v1
kind: Deployment
spec:
revisionHistoryLimit: 0
progressDeadlineSeconds: {{ default 300 .Values.deployment.progress_deadline_seconds }}
minReadySeconds: {{ default 10 .Values.deployment.min_ready_seconds }}
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: {{ default 0 .Values.deployment.max_unavailable }}
maxSurge: {{ default "50%" .Values.deployment.max_surge }}
selector:
matchLabels:
app: {{ .Values.app | quote }}
country: {{ .Values.country | quote }}
template:
metadata:
{{- include "labels" . | indent 6 }}
spec:
{{- include "node_affinity" . | indent 6 }}
{{- include "node_tolerations" . | indent 6 }}
initContainers:
- name: download-extensions
image: alpine:latest
command: ["/bin/sh", "-c", "wget -O /var/wiremock/extensions/wiremock-body-transformer-1.1.3.jar https://repo1.maven.org/maven2/com/opentable/wiremock-body-transformer/1.1.3/wiremock-body-transformer-1.1.3.jar"]
volumeMounts:
- mountPath: "/var/wiremock/extensions"
name: extensions-volume
containers:
- env:
{{ include "dynamic" . | indent 10 }}
image: "wiremock/wiremock:2.35.0"
args:
- "--jetty-acceptor-threads=50"
- "--jetty-accept-queue-size=50"
- "--container-threads=100"
- "--extensions com.opentable.extension.BodyTransformer"
imagePullPolicy: IfNotPresent
name: {{ .Values.app }}-{{ .Values.country}}-{{ .Values.environment }}
ports:
- containerPort: {{ .Values.deployment.container_port }}
protocol: TCP
resources:
requests:
cpu: {{ default "128m" .Values.deployment.resources.requests.cpu }}
memory: {{ default "128M" .Values.deployment.resources.requests.memory }}
limits:
cpu: {{ default "256m" .Values.deployment.resources.limits.cpu }}
memory: {{ default "256M" .Values.deployment.resources.limits.memory }}
readinessProbe:
tcpSocket:
port: {{ default 3000 .Values.deployment.container_port }}
initialDelaySeconds: 60
periodSeconds: 60
successThreshold: 1
failureThreshold: 10
timeoutSeconds: 10
livenessProbe:
tcpSocket:
port: {{ default 3000 .Values.deployment.container_port }}
initialDelaySeconds: 60
periodSeconds: 60
successThreshold: 1
failureThreshold: 10
timeoutSeconds: 10
volumeMounts:
- mountPath: /home/wiremock/mappings
name: {{ .Values.app }}-{{ .Values.country }}-mappings
- name: "extensions-volume"
mountPath: /var/wiremock/extensions
volumes:
- name: {{ .Values.app }}-{{ .Values.country }}-mappings
configMap:
name: {{ .Values.app }}-{{ .Values.country }}-mappings
- name: extensions-volume
emptyDir: {}
其他信息:在我的用例中,我想访问请求正文以根据某些参数发送自定义响应,因此需要wiremock扩展才能工作
提前致谢
我怀疑带有空格的 CLI 参数在传递给可执行文件时被错误地转义。尝试“--extensions=com.opentable.extension.BodyTransformer”