mittwald/kube-httpcache

Support for ExternalName services

DavidZisky opened this issue · 7 comments

Is your feature request related to a problem? Please describe.
I am trying to setup Varnish for caching calls in between a pod in k8s and an external service which is called via ExternalName service so it doesn't have an Endpoint. Your solutions requires specifying service name and is looking for Endpoints for that Service so I guess it won't work with ExternalName.

Describe the solution you'd like
The best would be to make native support for ExternalName services. So it should detect is Service is type of ExternalName and if it is then don't try to find it's Endpoint but use External-IP

Describe alternatives you've considered
I would be happy to hardcode backend for now. Please explain if I can just put it somewhere in vcl template or so?

Additional context

As a workaround: yes, you can hardcode your backend in the VCL template.

Currently, we recommend a backend definition like follows:

{{ range .Backends }}
backend be-{{ .Name }} {
    .host = "{{ .Host }}";
    .port = "{{ .Port }}";
}
{{- end }}

But this is neither enforced nor required. You can simply hardcode your backend to any external (or internal, if you like) address:

backend be-external {
    .host = "external-address.example";
    .port = "80";
}

Great! Thanks for quick response. I'll try that.

For permanent solutions - is it something you can look into? any idea if that would be easy or too complex request?

Support for ExternalName services certainly would be nice feature. However, given that feasible workarounds do exist, this would most probably not be a high-priority feature for us. Pull requests are welcome, though. 😉

Oh, and just an addendum: When starting the cache, you'll probably need to add the --backend-watch=false flag to the controller. Otherwise, the controller will try to watch the non-existent endpoints of an equally non-existent service.

There has not been any activity to this issue in the last 14 days. It will automatically be closed after 7 more days. Remove the stale label to prevent this.

Apologies on behalf of @mittwald-machine. Issues with the help wanted label should have been excluded from being marked as stale.

There has not been any activity to this issue in the last 14 days. It will automatically be closed after 7 more days. Remove the stale label to prevent this.