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
I'm trying to make this ingress more dynamic in scripting by using kubectl's patch to add more rules, every time I want to setup a new subdomain and point to a new backend service that gets created. In theory this should be easy, just write an RFC6902 patch and apply it... easy, right?
Not so much...
Every time I run: kubectl patch ingresses.networking.k8s.io test-ingress --type='json' -p='[{"op":"add","path":"/spec/rules/","value":{"host":"boingonetworks.test.com","http":{"paths":[{"backend":{"serviceName":"server-boingonetworks","servicePort":3003}}]}}}]'
from the cli I always get: ingress.networking.k8s.io/test-ingress patched (no change)
Then I verify with the yml within GKE's dashboard and sure enough... no new rule under the ingress...
For the time being I will resort to reading in the ingress as JSON from kubectl -> adding to the array -> running kubectl apply on the output but I know deep down that this is vulnerable to a race condition if this gets run in multiple instances, where it could become inaccurate if it's reading in the config at the same time another entity is applying it...
The text was updated successfully, but these errors were encountered:
Kubectl is a little bit verbose in the way it accepts patches
I thought if I did it at position 0 it would overwrite the existing element, but instead it has the desired behavior, so the functional version of the command above is: kubectl patch ingresses.networking.k8s.io test-ingress --type='json' -p='[{"op":"add","path":"/spec/rules/0","value":{"host":"boingonetworks.test.com","http":{"paths":[{"backend":{"serviceName":"server-boingonetworks","servicePort":3003}}]}}}]'
I'm trying to make this ingress more dynamic in scripting by using kubectl's patch to add more rules, every time I want to setup a new subdomain and point to a new backend service that gets created. In theory this should be easy, just write an RFC6902 patch and apply it... easy, right?
Not so much...
Every time I run:
kubectl patch ingresses.networking.k8s.io test-ingress --type='json' -p='[{"op":"add","path":"/spec/rules/","value":{"host":"boingonetworks.test.com","http":{"paths":[{"backend":{"serviceName":"server-boingonetworks","servicePort":3003}}]}}}]'
from the cli I always get:
ingress.networking.k8s.io/test-ingress patched (no change)
Then I verify with the yml within GKE's dashboard and sure enough... no new rule under the ingress...
For the time being I will resort to reading in the ingress as JSON from kubectl -> adding to the array -> running kubectl apply on the output but I know deep down that this is vulnerable to a race condition if this gets run in multiple instances, where it could become inaccurate if it's reading in the config at the same time another entity is applying it...
The text was updated successfully, but these errors were encountered: