Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

[nginx-ingress-controller]: Check for errors in nginx template #1450

Merged

Conversation

aledbf
Copy link
Contributor

@aledbf aledbf commented Jul 28, 2016

fixes #1448

@@ -67,7 +67,9 @@ func NewManager(kubeClient *client.Client) *Manager {

ngx.sslDHParam = ngx.SearchDHParamFile(config.SSLDirectory)

ngx.loadTemplate()
if err := ngx.loadTemplate(); err != nil {
glog.Fatalf("invalid NGINX template: %v", err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you really want to fatal when a load fails? isn't this different from what nginx usually does? meanign if you have a working config and you overwrite it with some invalid config, nginx will keep working with the old config right?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm specifically asking about what we should do if someone modifies the template to have a syntax error. I think the answer is we should do whatever nginx would do if someone modified the nginx.conf to have a syntax error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you really want to fatal when a load fails?

Only the first time is loaded (in case someone uses a custom template)

I think the answer is we should do whatever nginx would do if someone modified the nginx.conf to have a syntax error.

If the template cannot be loaded the pod will fail the health checks (crashloop) and the log doesn't help (check the output of 1448).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we don't watch the custom template? failing on first failure to load is fine, I'm more concerned with what happens if i:

  1. kubectl exec and overwrite template
  2. endpoints change

do we crashloop, or keep using the old template (sounds like we keep using the old template, meaning we ignore updates to the config map. that's fine as long as it's clear in the doc)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we don't watch the custom template?

nop, we keep using the old template.

I'll add a watch to the template file to cover:

  1. kubectl exec and overwrite template
  2. update in the config map (mounted template)

if there's an error log the error and keep using the working version of the template

@bprashanth
Copy link

LGTM assume you're going to make proposed changes in a follow up pr

@bprashanth bprashanth added the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2016
@bprashanth bprashanth merged commit 52beb66 into kubernetes-retired:master Aug 5, 2016
aledbf pushed a commit to aledbf/contrib that referenced this pull request Nov 10, 2016
…te-errors

[nginx-ingress-controller]: Check for errors in nginx template
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NGINX ingress - Invalid memory or nil pointer dereference
3 participants