Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After removing the custom template, NIC does not restore to default template without restarting NIC pod #5906

Closed
haywoodsh opened this issue Jul 1, 2024 · 2 comments · Fixed by #6661
Assignees
Labels
backlog Pull requests/issues that are backlog items bug An issue reporting a potential bug refined Issues that are ready to be prioritized
Milestone

Comments

@haywoodsh
Copy link
Contributor

haywoodsh commented Jul 1, 2024

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:

  1. 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:
  1. 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;
    }
...
  1. Run cat etc/nginx/nginx.conf inside the NIC pod to confirm # custom main template is at the top of nginx.conf
  2. 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
  3. Run cat etc/nginx/nginx.conf inside the NIC pod, # custom main template is still at the top of nginx.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.

Copy link

github-actions bot commented Jul 1, 2024

Hi @haywoodsh thanks for reporting!

Be sure to check out the docs and the Contributing Guidelines while you wait for a human to take a look at this 🙂

Cheers!

@haywoodsh haywoodsh added bug An issue reporting a potential bug ready for refinement An issue that was triaged and it is ready to be refined labels Jul 1, 2024
@danielnginx danielnginx added refined Issues that are ready to be prioritized and removed ready for refinement An issue that was triaged and it is ready to be refined labels Aug 13, 2024
@shaun-nx shaun-nx added the backlog Pull requests/issues that are backlog items label Sep 2, 2024
@shaun-nx shaun-nx added this to the v4.0.0 milestone Oct 1, 2024
@jjngx
Copy link
Contributor

jjngx commented Oct 10, 2024

Notes:

nginx.conf is updated when the nginx config map is updated with new content (main-template)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Pull requests/issues that are backlog items bug An issue reporting a potential bug refined Issues that are ready to be prioritized
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants