Implement a validation webhook

In case some ingress have a syntax error in the snippet configuration,
the freshly generated configuration will not be reloaded to prevent tearing down existing rules.
Although, once inserted, this configuration is preventing from any other valid configuration to be inserted as it remains in the ingresses of the cluster.
To solve this problem, implement an optional validation webhook that simulates the addition of the ingress to be added together with the rest of ingresses.
In case the generated configuration is not validated by nginx, deny the insertion of the ingress.

In case certificates are mounted using kubernetes secrets, when those
changes, keys are automatically updated in the container volume, and the
controller reloads it using the filewatcher.

Related changes:

- Update vendors
- Extract useful functions to check configuration with an additional ingress
- Update documentation for validating webhook
- Add validating webhook examples
- Add a metric for each syntax check success and errors
- Add more certificate generation examples
This commit is contained in:
Thibault Jamet 2019-02-21 20:45:21 +01:00
parent 7283a01b9f
commit 1cd17cd12c
No known key found for this signature in database
GPG key ID: 9D28A304A3810C17
30 changed files with 3314 additions and 131 deletions

4
go.mod
View file

@ -19,8 +19,10 @@ require (
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
github.com/go-openapi/spec v0.19.0 // indirect
github.com/gofortune/gofortune v0.0.1-snapshot // indirect
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/google/uuid v1.0.0
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/gophercloud/gophercloud v0.0.0-20190410012400-2c55d17f707c // indirect
github.com/imdario/mergo v0.3.7
@ -54,7 +56,9 @@ require (
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926
github.com/vromero/gofortune v0.0.1-snapshot
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272
google.golang.org/grpc v1.19.1
gopkg.in/fsnotify/fsnotify.v1 v1.4.7
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/pool.v3 v3.1.1