Open datho7561 opened 1 year ago
I have a POC of the Route
portion of this working
I ran into some issues while trying to get similar functionality for Ingresses to work:
minikube
and kind
, require additional configuration in order to set up an IngressController.crc
I messed up, we don't actually need this to get the Wild West demo application working.
I've changed my mind again: I think we should support Routes but not Ingress:
@vrubezhny You mentioned wanting more issues to work on. What do you think of this issue?
We only need to make it work for OpenShift clusters, so we can use Routes
It would be nice to expose a running service to the internet using a
Route
(in the case of OpenShift) orIngress
(in the case of other Kubernetes distributions).Here's how to create a
Route
in OpenShift, given that$NAME_OF_DEPLOYMENT
is a deployment that's in the current name:oc expose deployment $NAME_OF_DEPLOYMENT
Here's an example of an
Ingress
yaml
in Kubernetes:The values we will have to change depending on the deployment are:
metadata.name
to the name of the deployment but with the suffix-ingress
to help distinguish itspec.defaultBackend.service.name
to the name of the deploymentspec.defaultBackend.service.port.number
to the port that the deployment exposes its service onIn order to create the ingress, you will need to run
oc apply -f ingress-definition.yaml
.A few final thoughts:
It might also be possible to include the route or ingress in the devfile by embedding the YAML using the additional Kubernetes resources feature. For instance, this is how odo creates
ServiceBinding
s:The benefit of this approach is that, if I understand correctly,
odo
will manage the lifecycle of this Kubernetes object by creating it when dev is started and deleting it when dev is stoppedA final aspect of this change is that we should alert the user that this will expose the service to the public if the cluster is capable of exposing services to the public, and require an additional confirmation in order to do this. We shouldn't try to detect if the cluster is capable of exposing public endpoints, since that is really difficult. Instead we should always show this warning.
Not all Kubernetes clusters are capable of creating an ingress. They require an ingress controller. On
minikube
the ingress controller that is automatically set up is thenginx
one. Maybe we should hide the UI option if the cluster is not OpenShift and doesn't have an ingress controller set up?