-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Describe the bug
The NIC monitors the config map and alters its behavior when deployed with the -nginx-configmaps
flag. Users have the ability to add and edit custom templates using the config map keys main-template
, ingress-template
, and virtualserver-template
after deployment. However, if a user deletes the config map key or the entire config map, the custom template will persist with the last set value and will not revert to the default until the NIC is restarted.
To Reproduce
Steps to reproduce the behavior:
- Deploy NIC with the flag
--nginx-configmaps=$(POD_NAMESPACE)/nginx-config
and empty configmap, i.e.
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-config
namespace: nginx-ingress
data:
- Add a custom template with the config map entry that is slightly different from the default tempalte, e.g. comment at the top
# custom main template
and re-apply the config map
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-config
namespace: nginx-ingress
data:
main-template: |
# custom main template
worker_processes {{.WorkerProcesses}};
...
include /etc/nginx/conf.d/*.conf;
}
...
- Run
cat etc/nginx/nginx.conf
inside the NIC pod to confirm# custom main template
is at the top ofnginx.conf
- Remove the
main-template
key in config map so that it reverts the one at step 1 again, and then re-apply the config map - Run
cat etc/nginx/nginx.conf
inside the NIC pod,# custom main template
is still at the top ofnginx.conf
, showing that NIC does not revert to using the default template.
Expected behavior
As the NIC monitors the config map in real-time, its behavior should mirror the config map's contents. Thus, when a user inserts a custom template into the config map, the NIC should switch from the default to the custom template. Consequently, if the custom template key is deleted from the config map, the user would anticipate that the NIC reverts to the default template.
Your environment
- NIC 3.5.2
- NGINX
Additional context
Add any other context about the problem here. Any log files you want to share.