{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2901","repository_url":"https://api.github.com/repos/kubernetes/ingress-nginx","labels_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2901/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2901/comments","events_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2901/events","html_url":"https://github.com/kubernetes/ingress-nginx/issues/2901","id":347736024,"node_id":"MDU6SXNzdWUzNDc3MzYwMjQ=","number":2901,"title":"Feature Request: Load Custom Configurations from Templates","user":{"login":"diazjf","id":13592244,"node_id":"MDQ6VXNlcjEzNTkyMjQ0","avatar_url":"https://avatars3.githubusercontent.com/u/13592244?v=4","gravatar_id":"","url":"https://api.github.com/users/diazjf","html_url":"https://github.com/diazjf","followers_url":"https://api.github.com/users/diazjf/followers","following_url":"https://api.github.com/users/diazjf/following{/other_user}","gists_url":"https://api.github.com/users/diazjf/gists{/gist_id}","starred_url":"https://api.github.com/users/diazjf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diazjf/subscriptions","organizations_url":"https://api.github.com/users/diazjf/orgs","repos_url":"https://api.github.com/users/diazjf/repos","events_url":"https://api.github.com/users/diazjf/events{/privacy}","received_events_url":"https://api.github.com/users/diazjf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2018-08-05T22:18:46Z","updated_at":"2018-08-06T23:42:40Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The purpose of this proposal is to allow for a cloud provider to load a template containing proprietary configurations based on user needs. The templates can be further configured by the user. The feature will be enabled using 2 annotations:\r\n\r\n1. `nginx.ingress.kubernetes.io/custom-config-location` will be used to set where the template is located. It will be a string containing the path to the tmpl file. It is the responsibility of the cloud provider to make sure they add this template to the container storage. For simplicity we can always start at the `/etc/nginx/templates` path.\r\n\r\n2. `nginx.ingress.kubernetes.io/custom-config-variables` will be used to load the required variables for the template in `nginx.ingress.kubernetes.io/custom-config-location`\r\n\r\nThere are 2 requirements. The file specified in `nginx.ingress.kubernetes.io/custom-config-location` must exists and the variables it requires, if any, must be set in `nginx.ingress.kubernetes.io/custom-config-variables`. The variables are then applied to the template and used to generate a custom configuration, which is then applied to the given locations within the ingress resource.\r\n\r\nSample flow:\r\n\r\n1. `my.tmpl` exists in deployment as follows:\r\n\r\n```\r\nproxy_set_header        Host            {{ host }};\r\nproxy_set_header        X-Real-IP       {{ xrealip }};\r\n```\r\n\r\n2. User creates Ingress resource with following YAML: \r\n\r\n```--\r\napiVersion: extensions/v1beta1 \r\nkind: Ingress \r\nmetadata: \r\n  annotations: \r\n    nginx.ingress.kubernetes.io/custom-config-location: my.tmpl \r\n    nginx.ingress.kubernetes.io/custom-config-variables: host=a.com, xrealip=0.0.0.0\r\n  name: cafe-ingress\r\nspec: \r\n  rules:   - host: ok.com \r\n    http:       \r\n      paths:       \r\n      - backend: \r\n          serviceName: tea-svc \r\n          servicePort: 80\r\n       path: /tea  \r\n```\r\n\r\n3. `my.tmpl` is loaded with provided variables\r\n\r\n```\r\nproxy_set_header        Host            a.com;\r\nproxy_set_header        X-Real-IP      0.0.0.0;\r\n```\r\n\r\n4. `nginx.conf` is generated with `/tea` section:\r\n\r\n```\r\nLocation /tea {\r\n         proxy_set_header        Host            a.com;\r\n          proxy_set_header        X-Real-IP      0.0.0.0;\r\n         ….\r\n}\r\n…\r\n```\r\n\r\nLimitations:\r\n1. In this current proposal, only 1 custom configuration can be applied per path\r\n\r\n2. Custom Configuration can only be applied to location level. Maybe another annotation for the server-level and a ConfigMap change can apply it globally.\r\n\r\nOther Questions:\r\n1. Why do we need this?\r\n\r\nCloud Providers may want to provide an Ingress Controller (In this case this one) to a user by default. These Cloud Providers also want to be able to provide custom features as well as maintain a strong community integration. This feature will allow Cloud Providers to add their proprietary features, as well as enable them to keep up with the master.\r\n\r\n2. Why not use location snippets? \r\n\r\nWe don’t want the user to have to provide a full configuration. Our configurations can be large. Hence by just providing a file and a few variables to alter, it makes the user experience a whole lot better.\r\n\r\n3. Having to specify key/value pairs in a value doesn’t follow annotation format? \r\n\r\nFor templating there are not many alternatives, possibly CRDs can be used in this case. We can decide on implementation details."},"comment":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/comments/410886900","html_url":"https://github.com/kubernetes/ingress-nginx/issues/2901#issuecomment-410886900","issue_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2901","id":410886900,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDg4NjkwMA==","user":{"login":"diazjf","id":13592244,"node_id":"MDQ6VXNlcjEzNTkyMjQ0","avatar_url":"https://avatars3.githubusercontent.com/u/13592244?v=4","gravatar_id":"","url":"https://api.github.com/users/diazjf","html_url":"https://github.com/diazjf","followers_url":"https://api.github.com/users/diazjf/followers","following_url":"https://api.github.com/users/diazjf/following{/other_user}","gists_url":"https://api.github.com/users/diazjf/gists{/gist_id}","starred_url":"https://api.github.com/users/diazjf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diazjf/subscriptions","organizations_url":"https://api.github.com/users/diazjf/orgs","repos_url":"https://api.github.com/users/diazjf/repos","events_url":"https://api.github.com/users/diazjf/events{/privacy}","received_events_url":"https://api.github.com/users/diazjf/received_events","type":"User","site_admin":false},"created_at":"2018-08-06T23:42:40Z","updated_at":"2018-08-06T23:42:40Z","author_association":"CONTRIBUTOR","body":"@aledbf it would be cool if we could have a quick call sometime this week with everyone interested and we can nail out some of the details. I'll update this issue with the suggested implementation details"}}
{"actor":{"display_login":"diazjf"}}