support custom configuration to main context of nginx config
This commit is contained in:
parent
23ce9b5db1
commit
1bacf1655e
4 changed files with 55 additions and 3 deletions
|
@ -114,6 +114,7 @@ The following table shows a configuration option's name, type, and the default v
|
|||
|[jaeger-service-name](#jaeger-service-name)|string|"nginx"|
|
||||
|[jaeger-sampler-type](#jaeger-sampler-type)|string|"const"|
|
||||
|[jaeger-sampler-param](#jaeger-sampler-param)|string|"1"|
|
||||
|[main-snippet](#main-snippet)|string|""|
|
||||
|[http-snippet](#http-snippet)|string|""|
|
||||
|[server-snippet](#server-snippet)|string|""|
|
||||
|[location-snippet](#location-snippet)|string|""|
|
||||
|
@ -633,20 +634,21 @@ Specifies the sampler to be used when sampling traces. The available samplers ar
|
|||
Specifies the argument to be passed to the sampler constructor. Must be a number.
|
||||
For const this should be 0 to never sample and 1 to always sample. _**default:**_ 1
|
||||
|
||||
## main-snippet
|
||||
|
||||
Adds custom configuration to the main section of the nginx configuration.
|
||||
|
||||
## http-snippet
|
||||
|
||||
Adds custom configuration to the http section of the nginx configuration.
|
||||
_**default:**_ ""
|
||||
|
||||
## server-snippet
|
||||
|
||||
Adds custom configuration to all the servers in the nginx configuration.
|
||||
_**default:**_ ""
|
||||
|
||||
## location-snippet
|
||||
|
||||
Adds custom configuration to all the locations in the nginx configuration.
|
||||
_**default:**_ ""
|
||||
|
||||
## custom-http-errors
|
||||
|
||||
|
|
|
@ -459,6 +459,9 @@ type Configuration struct {
|
|||
// Default: 1
|
||||
JaegerSamplerParam string `json:"jaeger-sampler-param"`
|
||||
|
||||
// MainSnippet adds custom configuration to the main section of the nginx configuration
|
||||
MainSnippet string `json:"main-snippet"`
|
||||
|
||||
// HTTPSnippet adds custom configuration to the http section of the nginx configuration
|
||||
HTTPSnippet string `json:"http-snippet"`
|
||||
|
||||
|
|
|
@ -41,6 +41,10 @@ events {
|
|||
use epoll;
|
||||
}
|
||||
|
||||
{{ if not (empty $cfg.MainSnippet) }}
|
||||
{{ $cfg.MainSnippet }}
|
||||
{{ end }}
|
||||
|
||||
http {
|
||||
{{ if not $all.DisableLua }}
|
||||
lua_package_cpath "/usr/local/lib/lua/?.so;/usr/lib/lua-platform-path/lua/5.1/?.so;;";
|
||||
|
|
43
test/e2e/settings/main_snippet.go
Normal file
43
test/e2e/settings/main_snippet.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package settings
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||
)
|
||||
|
||||
var _ = framework.IngressNginxDescribe("Main Snippet", func() {
|
||||
f := framework.NewDefaultFramework("main-snippet")
|
||||
mainSnippet := "main-snippet"
|
||||
|
||||
It("should add value of main-snippet setting to nginx config", func() {
|
||||
expectedComment := "# main snippet"
|
||||
err := f.UpdateNginxConfigMapData(mainSnippet, expectedComment)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = f.WaitForNginxConfiguration(
|
||||
func(cfg string) bool {
|
||||
return strings.Contains(cfg, expectedComment)
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue