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

Configmap incorrectly loading break lines #378

Closed
gianrubio opened this issue Mar 6, 2017 · 2 comments
Closed

Configmap incorrectly loading break lines #378

gianrubio opened this issue Mar 6, 2017 · 2 comments

Comments

@gianrubio
Copy link
Contributor

The PR #373 introduces an issue when ingress is loading configmap, with break lines. It loads a broken configmap, avoiding nginx start.

Nginx error

Error: exit status 1
2017/03/06 10:53:30 [emerg] 34#34: directive "log_format" is not terminated by ";" in /tmp/nginx-cfg242778996:63
nginx: [emerg] directive "log_format" is not terminated by ";" in /tmp/nginx-cfg242778996:63
nginx: configuration file /tmp/nginx-cfg242778996 test failed

------------------------------------------------------------------------------- 

Configmap

apiVersion: v1
data:
  log-format-upstream: |
    '{ "time": "$time_iso8601", "remote_addr": "$proxy_protocol_addr", "x-forward-for": "$proxy_add_x_forwarded_for", "request_id": "$request_id", "remote_user": "$remote_user", "bytes_sent": $bytes_sent, "request_time": $request_time, "status": $status, "vhost": "$host", "request_proto": "$server_protocol", "path": "$uri", "request_query": "$args", "request_length": $request_length, "duration": $request_time, "method": "$request_method", "http_referrer": "$http_referer", "http_user_agent": "$http_user_agent" }'
  proxy-connect-timeout: "16"
  proxy-cookie-path: |
    "/" "/" 
  use-proxy-protocol: "true"
kind: ConfigMap
metadata: 
  name: nginx-ingress
  namespace: kube-system

Generated nginx.conf

...
    server_tokens on;

    log_format upstreaminfo '$proxy_protocol_addr - '{ "time": "$time_iso8601", "remote_addr": "$proxy_protocol_addr", "x-forward-for": "$proxy_add_x_forwarded_for", "request_id": "$request_id", "remote_user": "$remote_user", "bytes_sent": $bytes_sent, "request_time": $request_time, "status": $status, "vhost": "$host", "request_proto": "$server_protocol", "path": "$uri", "request_query": "$args", "request_length": $request_length, "duration": $request_time, "method": "$request_method", "http_referrer": "$http_referer", "http_user_agent": "$http_user_agent" }'
';

....
            proxy_cookie_path                       "/" "/"
;
@gianrubio
Copy link
Contributor Author

Also my log_format is broken, I setup on configmap without $proxy_protocol_addr. I already make some comment on #373 (comment)

@aledbf
Copy link
Member

aledbf commented Mar 6, 2017

@gianrubio please remove the ' character at the beginning and end.

@aledbf aledbf closed this as completed Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants