-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Added hsts settings, Refactored bool/integer parsing #75
Conversation
that's awesome!
I think it should reflect a useful production value. When the user sets the incorrect values for Another problem is what to do In case of errors when parsing annotations. Do you think the controller should proceed with creating the configuration for such an Ingress resource? I don't see a better solution in case of errors in the configmap other then reporting an error for the incorrect keys. And to stick with the same behavior when parsing annotations. |
Thanks, If the annotations based configuration of a ingress object do not make sense, or are wrong it is quite simple to emit a error and wait for the next time it is updated and the error is fixed. But if the error is in the configmap I am not sure what I would prefer... What do you think about writing error messages into the ingress/configmap object, so the user does not need to grep through the ingress log? annotations:
nginx.org/errors: |
Invalid value for 'hsts-include-subdomains': 'tue' cannot be parsed to bool
Invalid value for 'hsts-max-age': -199 a positive number or 0 is required |
This can be a solution. However, for some of the keys we don't do validation at all, relying on NGINX to report an error when doing a config test. I suggest to stick to reporting errors and improving the reporting part for now.
I think the approach used in gce and nginx community controllers when the controller is emitting events is suitable. kubectl shows those events when using |
You are completely right, I forgot about Events, So if I understand correctly we should add the current annotation error messages also to the ingress object as events. So back to the original topic: |
I think it's better to emit those Events to Ingress object only, so the user don't need to check for errors in multiple places
A separate issue/pull request makes sense |
I have added support for the HSTS header (#67)
While I was adding the new annotations I was bothered by the repeated code so I refactored the sections for ParseBool and added unittests for the new utility functions.
I was not yet able to test these changes on k8s.
The default value of the HSTS max-age directive is open for discussion.
I am not sure if the default should protect the user from setting it too long while testing,
or if it should reflect a useful production value.
ATM it is set to 1 Month.