You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://10.96.0.1/apis/networking.k8s.io/v1beta1/namespaces/shinyproxy/ingresses. Message: admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: host "shinyproxy-demo.local" and path "/" is already defined in ingress shinyproxy/nginx-to-skipper-ingress. Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: host "shinyproxy-demo.local" and path "/" is already defined in ingress shinyproxy/nginx-to-skipper-ingress, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).
239
+
The first patch adds some additional annotations to the ShinyProx resource. For
240
+
example, in order to set up a redirect from HTTP to HTTPS. The second patch
241
+
changes the ingressClassName to `nginx`. Any patch is accepted, but make sure
242
+
that the resulting Ingress resource still works for the ShinyProxy Deployment.
243
+
The ShinyProxy Operator logs the manifest before and after applying the patch,
244
+
this can be useful while creating the patches.
245
+
246
+
**Note:** the previous section only applies to version 2 of the operator.
247
+
Version 1 behaves differently since it used Skipper as (intermediate) ingress
248
+
controller.
249
+
250
+
## Modify the ShinyProxy Pod
251
+
252
+
The Operator automatically creates a ReplicaSet for each ShinyProxy resource you
253
+
create. This ReplicaSet contains a `PodTemplate`, which contains all necessary
254
+
settings for creating a proper ShinyProxy pod. In a lot of cases, it can be
255
+
useful to adapt this `PodTemplate`forthe specific contextin which ShinyProxy
256
+
is running. For example, it's a good idea to specify the resource requests and
257
+
limits, or sometimes it's required to add a toleration to the pod. These
258
+
modification can be achieved using the `kubernetesPodTemplateSpecPatches` field.
259
+
This field should contain a string which contains a list
260
+
of [JSON Patches](https://jsonpatch.com/) to apply to the `PodTemplate`. The
261
+
above examples already include the following patch:
262
+
263
+
```yaml
264
+
apiVersion: openanalytics.eu/v1
265
+
kind: ShinyProxy
266
+
metadata:
267
+
name: shinyproxy
268
+
namespace: shinyproxy
269
+
spec:
270
+
proxy:
271
+
# ...
272
+
kubernetesPodTemplateSpecPatches: |
273
+
- op: add
274
+
path: /spec/containers/0/env/-
275
+
value:
276
+
name: REDIS_PASSWORD
277
+
valueFrom:
278
+
secretKeyRef:
279
+
name: redis
280
+
key: redis-password
281
+
- op: add
282
+
path: /spec/containers/0/resources
283
+
value:
284
+
limits:
285
+
cpu: 1
286
+
memory: 1Gi
287
+
requests:
288
+
cpu: 0.5
289
+
memory: 1Gi
290
+
- op: add
291
+
path: /spec/serviceAccountName
292
+
value: shinyproxy-sa
293
+
image: openanalytics/shinyproxy:3.0.0
294
+
imagePullPolicy: Always
295
+
fqdn: shinyproxy-demo.local
202
296
```
203
297
204
-
This exception is caused by a
205
-
[bug](https://github.com/kubernetes/ingress-nginx/issues/7546) in the latest
206
-
(v1.0.0) version of the ingress-nginx controller. There are two workarounds for this bug:
298
+
The above configuration contains three patches. The first patch adds an
299
+
environment variable with the password used for connecting to the Redis server.
300
+
The second patch configures the resource limits and requests of the ShinyProxy
301
+
pod. Finally, the last patch configures the `ServiceAccount` of the pod.
302
+
303
+
**Note:** it is important when using this feature to not break any existing
304
+
configuration of the pod. For example, when you want to mount additional
305
+
configmaps, use the following configuration:
306
+
307
+
```yaml
308
+
apiVersion: openanalytics.eu/v1
309
+
kind: ShinyProxy
310
+
metadata:
311
+
name: shinyproxy
312
+
namespace: shinyproxy
313
+
spec:
314
+
kubernetesPodTemplateSpecPatches: |
315
+
- op: add
316
+
path: /spec/volumes/-
317
+
value:
318
+
name: myconfig
319
+
configMap:
320
+
name: some-configmnap
321
+
- op: add
322
+
path: /spec/containers/0/volumeMounts/-
323
+
value:
324
+
mountPath: /mnt/configmap
325
+
name: myconfig
326
+
readOnly: true
327
+
```
207
328
208
-
- use a version of the ingress controller older than v1.0.0 (e.g. v0.49.2)
209
-
- remove the validating webhook using, this is **not recommended** since it
210
-
removes an important part of how the ingress controller works. However, it is
211
-
an easy solution when you are following the above tutorial in minikube:
329
+
In this example, the `path` property of the patch always ends with a `-`, this
330
+
indicates that the patch adds a new entry to the end of the array
331
+
( e.g. `spec/volumes/`).
332
+
333
+
The following patch breaks the behavior of the ShinyProxy pod and should
334
+
therefore not be used:
335
+
336
+
```yaml
337
+
# NOTE: this is a demo of a WRONG configuration - do not use
338
+
apiVersion: openanalytics.eu/v1
339
+
kind: ShinyProxy
340
+
metadata:
341
+
name: shinyproxy
342
+
namespace: shinyproxy
343
+
spec:
344
+
kubernetesPodTemplateSpecPatches: |
345
+
- op: add
346
+
path: /spec/volumes
347
+
value:
348
+
- name: myconfig
349
+
configMap:
350
+
name: some-configmnap
351
+
- op: add
352
+
path: /spec/containers/0/volumeMounts
353
+
value:
354
+
- mountPath: /mnt/configmap
355
+
name: myconfig
356
+
readOnly: true
357
+
```
212
358
213
-
```bash
214
-
kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
215
-
```
359
+
This patch replaces the existing `/spec/volumes`
360
+
and `/spec/containers/0/volumeMounts` arrays of the pod. The ShinyProxy Operator
361
+
automatically creates a mount for a configmap which contains the ShinyProxy
362
+
configuration. By overriding these mounts, this configmap is not be mounted and
363
+
the default (demo) configuration of ShinyProxy is loaded.
0 commit comments