I have a GKE cluster on which I'm testing Google Cloud Run, which also hosts services that are not managed by Cloud Run. To access these, I've set up a simple Gateway and Virtual Service as described here. This Gateway has successfully worked in a GKE cluster in which the Istio add-on was enabled and Cloud Run was not enabled.
It appears that in a cluster with Cloud Run enabled, my custom gateway is ignored, and that all traffic goes through a default gateway called istio-autogenerated-k8s-ingress. I suspect it might be because the default is defined for Hosts: *
.
How can I ensure my gateway for services not managed by Cloud Run takes precedence for the hosts for which it is responsible? Is it safe to edit the autogenerated gateway? Will modifying it break Cloud Run? Will Cloud Run overwrite or modify this file in its normal operation?
Is it safe to edit the autogenerated gateway?
Yes, but if you used the Cloud Run addon for your GKE cluster then it will be rewritten after a bit to then one from the addon.
Will modifying it break Cloud Run?
If you write it incorrectly or make a mistake Cloud Run might not work.
Will Cloud Run overwrite or modify this file in its normal operation?
As explained above, if you used addon to deploy Cloud Run to your cluster then the config might be modified automatically after some time because everything is pre-configured.
Have you used this guide Setting up Cloud Run on GKE? If so please read serving/pkg/reconciler/route/README.md as it might be helfull.
istio-autogenerated-k8s-ingress is provided by Istio addon. CloudRun does not use it. So it is safe to delete it. It won't break CloudRun.
CloudRun on GKE use the Gateway knative-ingress-gateway under namespace knative-serving by default. I am curious about your use case. Do you also want to use your own Gateway to serve the traffic to CloudRun related services? If you want that, you can and add an entry "gateway.{your-own-gateway}: "istio-ingressgateway.istio-system.svc.cluster.local" into the config-istio ConfigMap (https://github.com/knative/serving/blob/master/config/config-istio.yaml).