Allow to disable NGINX metrics
This commit is contained in:
parent
c4ba23832a
commit
06d33c16b5
9 changed files with 42 additions and 9 deletions
|
|
@ -715,6 +715,7 @@ type TemplateConfig struct {
|
|||
ListenPorts *ListenPorts
|
||||
PublishService *apiv1.Service
|
||||
DynamicCertificatesEnabled bool
|
||||
EnableMetrics bool
|
||||
}
|
||||
|
||||
// ListenPorts describe the ports required to run the
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ type Configuration struct {
|
|||
|
||||
EnableProfiling bool
|
||||
|
||||
EnableMetrics bool
|
||||
|
||||
EnableSSLChainCompletion bool
|
||||
|
||||
FakeCertificatePath string
|
||||
|
|
|
|||
|
|
@ -602,6 +602,7 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
|
|||
ListenPorts: n.cfg.ListenPorts,
|
||||
PublishService: n.GetPublishService(),
|
||||
DynamicCertificatesEnabled: n.cfg.DynamicCertificatesEnabled,
|
||||
EnableMetrics: n.cfg.EnableMetrics,
|
||||
}
|
||||
|
||||
tc.Cfg.Checksum = ingressCfg.ConfigurationChecksum
|
||||
|
|
|
|||
|
|
@ -914,13 +914,15 @@ func proxySetHeader(loc interface{}) string {
|
|||
|
||||
// buildCustomErrorDeps is a utility function returning a struct wrapper with
|
||||
// the data required to build the 'CUSTOM_ERRORS' template
|
||||
func buildCustomErrorDeps(proxySetHeaders map[string]string, errorCodes []int) interface{} {
|
||||
func buildCustomErrorDeps(proxySetHeaders map[string]string, errorCodes []int, enableMetrics bool) interface{} {
|
||||
return struct {
|
||||
ProxySetHeaders map[string]string
|
||||
ErrorCodes []int
|
||||
EnableMetrics bool
|
||||
}{
|
||||
ProxySetHeaders: proxySetHeaders,
|
||||
ErrorCodes: errorCodes,
|
||||
EnableMetrics: enableMetrics,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -826,7 +826,7 @@ func TestEscapeLiteralDollar(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func Test_opentracingPropagateContext(t *testing.T) {
|
||||
func TestOpentracingPropagateContext(t *testing.T) {
|
||||
tests := map[interface{}]string{
|
||||
&ingress.Location{BackendProtocol: "HTTP"}: "opentracing_propagate_context",
|
||||
&ingress.Location{BackendProtocol: "HTTPS"}: "opentracing_propagate_context",
|
||||
|
|
|
|||
|
|
@ -16,7 +16,15 @@ limitations under the License.
|
|||
|
||||
package metric
|
||||
|
||||
import "k8s.io/ingress-nginx/internal/ingress"
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/ingress-nginx/internal/ingress"
|
||||
)
|
||||
|
||||
// NewDummyCollector returns a dummy metric collector
|
||||
func NewDummyCollector() Collector {
|
||||
return &DummyCollector{}
|
||||
}
|
||||
|
||||
// DummyCollector dummy implementation for mocks in tests
|
||||
type DummyCollector struct{}
|
||||
|
|
@ -41,3 +49,6 @@ func (dc DummyCollector) Stop() {}
|
|||
|
||||
// SetSSLExpireTime ...
|
||||
func (dc DummyCollector) SetSSLExpireTime([]*ingress.Server) {}
|
||||
|
||||
// SetHosts ...
|
||||
func (dc DummyCollector) SetHosts(hosts sets.String) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue