Should k8 Ingress rules be updated directly via helm

1/16/2020

My knowledge of k8 is fairly rudimentary. A service in our infrastructure exposes several endpoints. Each of these endpoints have different URL for client applications consumption and different URL within K8s. For e.g. the external URL could be https://some-vanity-url/api/v1/promotions/lotteries/state and the internal URL within K8s would be https://lottery-service-pod-name/v1/lotteries/state.

Currently, the developers expose all the endpoints within a service as a key/value pair in their properties file and when the service is deployed, these key/value pairs are extracted and ingress rules are updated. To me this sounds messy. Is there a cleaner approach to achieving the same result which is compliant with K8 deployment?

Also, i feel like there should be some construct in K8, which would allow teams to define their endpoints and ingress should simply subscribe to those events and update its rules automatically. Is that feasible?

-- Jimm
kubernetes

1 Answer

1/16/2020

You can have a script to replace values in your yaml file before sending it to kubectl. But now you have an additional, non kubernetes standard step in your deployment.

Ingress subscribe to let's say ConfigMap(stores the endpoints) change events is unlikely to happen because:

  1. every ingress controller needs to be updated to watch the referenced ConfigMap in addition to watching the Ingress.

  2. every ingress controller needs to change how they work, and mount the ConfigMap referenced as a volume.

  3. alter how Kubernetes watch service works, such that an Ingress change event is triggered when a referenced ConfigMap has a change event.

-- Arghya Sadhu
Source: StackOverflow