Merge branch 'kubernetes:main' into main
This commit is contained in:
commit
c23cc0c338
248 changed files with 5133 additions and 3219 deletions
|
|
@ -29,7 +29,6 @@ import (
|
|||
"k8s.io/ingress-nginx/internal/ingress/annotations/cors"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/fastcgi"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/globalratelimit"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/influxdb"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/ipdenylist"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/ipwhitelist"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/log"
|
||||
|
|
@ -338,9 +337,6 @@ type Location struct {
|
|||
// Logs allows to enable or disable the nginx logs
|
||||
// By default access logs are enabled and rewrite logs are disabled
|
||||
Logs log.Config `json:"logs,omitempty"`
|
||||
// InfluxDB allows to monitor the incoming request by sending them to an influxdb database
|
||||
// +optional
|
||||
InfluxDB influxdb.Config `json:"influxDB,omitempty"`
|
||||
// BackendProtocol indicates which protocol should be used to communicate with the service
|
||||
// By default this is HTTP
|
||||
BackendProtocol string `json:"backend-protocol"`
|
||||
|
|
|
|||
|
|
@ -431,10 +431,6 @@ func (l1 *Location) Equal(l2 *Location) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if !(&l1.InfluxDB).Equal(&l2.InfluxDB) {
|
||||
return false
|
||||
}
|
||||
|
||||
if l1.BackendProtocol != l2.BackendProtocol {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,10 +171,11 @@ Requires the update-status parameter.`)
|
|||
reportStatusClasses = flags.Bool("report-status-classes", false,
|
||||
`Use status classes (2xx, 3xx, 4xx and 5xx) instead of status codes in metrics.`)
|
||||
|
||||
timeBuckets = flags.Float64Slice("time-buckets", prometheus.DefBuckets, "Set of buckets which will be used for prometheus histogram metrics such as RequestTime, ResponseTime.")
|
||||
lengthBuckets = flags.Float64Slice("length-buckets", prometheus.LinearBuckets(10, 10, 10), "Set of buckets which will be used for prometheus histogram metrics such as RequestLength, ResponseLength.")
|
||||
sizeBuckets = flags.Float64Slice("size-buckets", prometheus.ExponentialBuckets(10, 10, 7), "Set of buckets which will be used for prometheus histogram metrics such as BytesSent.")
|
||||
monitorMaxBatchSize = flags.Int("monitor-max-batch-size", 10000, "Max batch size of NGINX metrics.")
|
||||
timeBuckets = flags.Float64Slice("time-buckets", prometheus.DefBuckets, "Set of buckets which will be used for prometheus histogram metrics such as RequestTime, ResponseTime.")
|
||||
lengthBuckets = flags.Float64Slice("length-buckets", prometheus.LinearBuckets(10, 10, 10), "Set of buckets which will be used for prometheus histogram metrics such as RequestLength, ResponseLength.")
|
||||
sizeBuckets = flags.Float64Slice("size-buckets", prometheus.ExponentialBuckets(10, 10, 7), "Set of buckets which will be used for prometheus histogram metrics such as BytesSent.")
|
||||
excludeSocketMetrics = flags.StringSlice("exclude-socket-metrics", []string{}, "et of socket request metrics to exclude which won't be exported nor being calculated. E.g. 'nginx_ingress_controller_success,nginx_ingress_controller_header_duration_seconds'.")
|
||||
monitorMaxBatchSize = flags.Int("monitor-max-batch-size", 10000, "Max batch size of NGINX metrics.")
|
||||
|
||||
httpPort = flags.Int("http-port", 80, `Port to use for servicing HTTP traffic.`)
|
||||
httpsPort = flags.Int("https-port", 443, `Port to use for servicing HTTPS traffic.`)
|
||||
|
|
@ -227,14 +228,10 @@ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-g
|
|||
flags.IntVar(&nginx.MaxmindRetriesCount, "maxmind-retries-count", 1, "Number of attempts to download the GeoIP DB.")
|
||||
flags.DurationVar(&nginx.MaxmindRetriesTimeout, "maxmind-retries-timeout", time.Second*0, "Maxmind downloading delay between 1st and 2nd attempt, 0s - do not retry to download if something went wrong.")
|
||||
|
||||
flag.Set("logtostderr", "true")
|
||||
|
||||
flags.AddGoFlagSet(flag.CommandLine)
|
||||
flags.Parse(os.Args)
|
||||
|
||||
// Workaround for this issue:
|
||||
// https://github.com/kubernetes/kubernetes/issues/17162
|
||||
flag.CommandLine.Parse([]string{})
|
||||
if err := flags.Parse(os.Args); err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
|
||||
pflag.VisitAll(func(flag *pflag.Flag) {
|
||||
klog.V(2).InfoS("FLAG", flag.Name, flag.Value)
|
||||
|
|
@ -328,6 +325,7 @@ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-g
|
|||
MetricsPerHost: *metricsPerHost,
|
||||
MetricsBuckets: histogramBuckets,
|
||||
ReportStatusClasses: *reportStatusClasses,
|
||||
ExcludeSocketMetrics: *excludeSocketMetrics,
|
||||
MonitorMaxBatchSize: *monitorMaxBatchSize,
|
||||
DisableServiceExternalName: *disableServiceExternalName,
|
||||
EnableSSLPassthrough: *enableSSLPassthrough,
|
||||
|
|
|
|||
|
|
@ -119,7 +119,9 @@ func (p *TCPProxy) Handle(conn net.Conn) {
|
|||
|
||||
func pipe(client, server net.Conn) {
|
||||
doCopy := func(s, c net.Conn, cancel chan<- bool) {
|
||||
io.Copy(s, c)
|
||||
if _, err := io.Copy(s, c); err != nil {
|
||||
klog.Errorf("Error copying data: %v", err)
|
||||
}
|
||||
cancel <- true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,12 @@ func TestSHA1(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f.Write(test.content)
|
||||
f.Sync()
|
||||
if _, err := f.Write(test.content); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := f.Sync(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
sha := SHA1(f.Name())
|
||||
f.Close()
|
||||
|
|
|
|||
|
|
@ -59,7 +59,9 @@ func TestFileWatcher(t *testing.T) {
|
|||
t.Fatalf("expected no events before writing a file")
|
||||
case <-timeoutChan:
|
||||
}
|
||||
os.WriteFile(f.Name(), []byte{}, ReadWriteByUser)
|
||||
if err := os.WriteFile(f.Name(), []byte{}, ReadWriteByUser); err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
select {
|
||||
case <-events:
|
||||
case <-timeoutChan:
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ func (f *FakeProcess) exiterFunc(code int) {
|
|||
f.exitCode = code
|
||||
}
|
||||
|
||||
func sendDelayedSignal(delay time.Duration) {
|
||||
func sendDelayedSignal(delay time.Duration) error {
|
||||
time.Sleep(delay * time.Second)
|
||||
syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
|
||||
return syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
|
||||
}
|
||||
|
||||
func TestHandleSigterm(t *testing.T) {
|
||||
|
|
@ -66,7 +66,12 @@ func TestHandleSigterm(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
process := &FakeProcess{shouldError: tt.shouldError}
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
go sendDelayedSignal(2) // Send a signal after 2 seconds
|
||||
go func() {
|
||||
err := sendDelayedSignal(2) // Send a signal after 2 seconds
|
||||
if err != nil {
|
||||
t.Errorf("error sending delayed signal: %v", err)
|
||||
}
|
||||
}()
|
||||
HandleSigterm(process, tt.delay, process.exiterFunc)
|
||||
})
|
||||
if tt.shouldError && process.exitCode != 1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue