Commit graph

799 commits

Author SHA1 Message Date
Ehsan Saei
ac9a50751e
OpenTelemetry default config (#9978) 2023-05-21 10:04:19 -07:00
Ricardo Katz
c540b58474
Validate path types (#9967)
* Validate path types

* Fix the year of header

* Update internal/ingress/controller/config/config.go

Co-authored-by: Jintao Zhang <tao12345666333@163.com>

---------

Co-authored-by: Jintao Zhang <tao12345666333@163.com>
2023-05-20 04:58:18 -07:00
Ricardo Katz
297036e169
Deprecate and remove influxdb feature (#9861) 2023-04-16 17:26:43 -07:00
Marco Cadetg
4e8d0b5836
Exclude socket metrics (#9770)
* exclude creation and exporting of socket metrics via flag

* make exclude metric naming more consistent

* fix connect time metric update

* add documentation

* e2e test

* improve creation of metric mapping
2023-04-11 01:01:18 -07:00
Ehsan Saei
c8cb9167d3
feat: OpenTelemetry module integration (#9062)
* OpenTelemetry module integration

* e2e test

* e2e test fix

* default OpentelemetryConfig

* e2e values

* mount otel module for otel test only

* propagate IS_CHROOT

* propagate IS_CHROOT e2e test

* code doc

* comments

* golint

* opentelemetry doc

* zipkin

* zipkin

* typo

* update e2e test OpenTelemetry value

* use opentelemetry value

* revert merge conflict

* fix

* format

* review comments

* clean
2023-03-22 11:58:22 -07:00
Sergei Kaznakhovskii
e4a66fd2f6
Fix canary-weight-total annotation ignored in rule backends (#9729)
* Missed canary weight total

    - added canary weight total for spec rules

* - added e2e test
2023-03-21 06:47:09 -07:00
cui fliter
82e836fbe8
fix some comments (#9688)
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-03-05 11:00:57 -08:00
Mitsuo Heijo
c5d73d58c6
migrate mitchellh/hashstructure to v2 (#9651) 2023-02-22 07:27:57 -08:00
Toon Schoenmakers
4aef45c177
controller: Don't panic when ready condition in a endpointslice is missing (#9550) 2023-02-17 13:48:10 -08:00
Hervé
d6bba85351
Rework Ginkgo usage (#9522)
* Rework Ginkgo usage

Currently Ginkgo is launched multiple times with different options to
accomodate various use-cases. In particular, some specs needs to be run
sequentially because non-namespaced objects are created that conflicts
with concurent Helm deployments.
However Ginkgo is able to handle such cases natively, in particular
specs that needs to be run sequentially are supported (Serial spec).

This commit marks the specs that needs to be run sequentially as Serial
specs and runs the whole test suite from a single Ginkgo invocation. As
a result, a single JUnit report is now generated.

Signed-off-by: Hervé Werner <dud225@hotmail.com>

* Fix controller error in test

Error getting ConfigMap "$NAMESPACE/tcp-services": no object matching key "$NAMESPACE/tcp-services" in local store

Signed-off-by: Hervé Werner <dud225@hotmail.com>

* Replace "go get" invocations by "go install"

Executing "go get" changes the go.mod & go.sum files which is not the
case of "go install".

Signed-off-by: Hervé Werner <dud225@hotmail.com>

* Always clean out the Helm deployment

Signed-off-by: Hervé Werner <dud225@hotmail.com>

* Add E2E test to verify that changes to one or more configmap trigger an update

Signed-off-by: Hervé Werner <dud225@hotmail.com>

---------

Signed-off-by: Hervé Werner <dud225@hotmail.com>
2023-02-16 06:15:39 -08:00
Fish-pro
ac8dd3dd53
sets.String is deprecated: use generic Set instead. new ways: s1 := Set[string]{} s2 := New[string]() (#9589)
Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
2023-02-16 06:05:48 -08:00
Fish-pro
1cdd61fb94
Adjust the import package order and use http library variables (#9587)
Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
2023-02-16 06:05:40 -08:00
James Strong
5e85747db7
remove tests and regex path checks (#9626)
Signed-off-by: James Strong <strong.james.e@gmail.com>
2023-02-14 12:33:52 -08:00
James Strong
01c9a2bf25
Revert Implement pathType validation (#9511) (#9607)
Signed-off-by: James Strong <strong.james.e@gmail.com>
2023-02-12 22:57:29 -08:00
James Strong
7d1c47ab54
Switch logic on path type validation and setting it to false (#9543)
* update path type validation to be false and update e2e test scripts

Signed-off-by: James Strong <strong.james.e@gmail.com>

* update to make tests clear

Signed-off-by: James Strong <strong.james.e@gmail.com>

* update test params

Signed-off-by: James Strong <strong.james.e@gmail.com>

* Adding else per pr comments

Signed-off-by: James Strong <james.strong@chainguard.dev>

---------

Signed-off-by: James Strong <strong.james.e@gmail.com>
Signed-off-by: James Strong <james.strong@chainguard.dev>
2023-01-31 17:09:06 -08:00
Christian Schaefer
ea0db8de77
Align default value for keepalive_request with NGINX default (#9518)
* Align default value for keepalive_request with NGINX default

* Align default value for keepalive_request with NGINX default
2023-01-18 05:22:35 -08:00
Ricardo Katz
da98c744b9
Implement pathType validation (#9511) 2023-01-16 23:51:23 -03:00
Samuel Vaillant
e6dcd6845e
feat(configmap): expose gzip-disable (#9505)
* docs(configmap): add link for gzip-min-length

* feat(configmap): expose gzip-disable

* test(e2e): cover gzip settings

* docs(configmap): simplify description with NGINX link

* refactor(configmap): simplify condition
2023-01-16 17:08:32 -08:00
Makhonin Alexey
39b5ce844b
Add new prometheus metric for orphaned ingress (#8230)
* Add new metric for orhaned ingress

* Fix const labels

* Fix after rebase
2023-01-16 04:22:51 -08:00
Tomas Hulata
5b2a9475dc
feat: support topology aware hints (#9165)
* support topology aware hints

Signed-off-by: tombokombo <tombo@sysart.tech>

* add flag to enable topology and fixes

Signed-off-by: tombokombo <tombo@sysart.tech>

* update readme

Signed-off-by: tombokombo <tombo@sysart.tech>

* add e2e test

Signed-off-by: tombokombo <tombo@sysart.tech>

* isolate topology test

Signed-off-by: tombokombo <tombo@sysart.tech>

* gofmt fix

Signed-off-by: tombokombo <tombo@sysart.tech>

Signed-off-by: tombokombo <tombo@sysart.tech>
2023-01-15 18:46:50 -08:00
Marcus Noble
e7bee5308e
added option to disable sync event creation (#8528)
* added option to disable event creation

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

* Re-trigger github workflows

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-01-09 06:37:31 -08:00
Phil Nichol
8ed3a27e25
Adding ipdenylist annotation (#8795)
* feat: Add support for IP Deny List

* fixed gomod

* Update package

* go mod tidy

* Revert "go mod tidy"

This reverts commit e6a837e1e7.

* update ginko version

* Updates e2e tests

* fix test typo
2023-01-08 14:43:28 -08:00
Ricardo Katz
3916f7b8b7
move tests to gh actions (#9461) 2022-12-29 14:09:29 -08:00
Ricardo Katz
c1413e6079
Validate ingress path fields (#9309)
* Validate characters in path fields

* Add e2e tests for path validation

* Fix review comments
2022-11-17 04:24:40 -08:00
Tomas Hulata
490ecffc52
fix svc long name (#9245)
Signed-off-by: tombokombo <tombo@sysart.tech>

Signed-off-by: tombokombo <tombo@sysart.tech>
2022-11-05 14:22:15 -07:00
Tomas Hulata
499dbf57af
fix ports (#9149) 2022-10-12 17:11:00 -07:00
Nate Campbell
7cb91ef9c1
Support none keyword in log-format escape (#8692)
* Support none keyword in log-format escape


## What this PR does / why we need it:
ingress-nginx does not support disabling escaping of special characters in the nginx log. This PR exposes the setting to support that functionality.

## Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation only

## Which issue/s this PR fixes
<!--
(optional, in `fixes #<issue number>` format, will close that issue when PR gets merged):

fixes #
-->

## How Has This Been Tested?
Followed the [getting-started](96b6228a6b/docs/developer-guide/getting-started.md) guide. Used ppa:longsleep/golang-backports on WSL Ubuntu to establish a golang-1.18 environment with latest docker and recommended kind. Built the dev-env successfully; had issues with make test, but they are entirely unrelated to anything I touched. Ultimate test was
```
FOCUS=log-format make kind-e2e-test
...
Ginkgo ran 1 suite in 6m29.7437865s
Test Suite Passed
```

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] I've read the [CONTRIBUTION](https://github.com/kubernetes/ingress-nginx/blob/main/CONTRIBUTING.md) guide
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.

I did not update docs/e2e-tests.md.

* gofmt -s ./internal/ingress/controller/config/config.go
2022-09-30 08:00:29 -07:00
Matthias Neugebauer
26fe69cb47
Add annotation for setting sticky cookie domain (#9088)
This adds the new annotation `nginx.ingress.kubernetes.io/session-cookie-domain`
for setting the cookie `Domain` attribute of the sticky cookie.

Signed-off-by: Matthias Neugebauer <mtneug@mailbox.org>

Signed-off-by: Matthias Neugebauer <mtneug@mailbox.org>
2022-09-28 07:28:37 -07:00
Tomas Hulata
3579ed0487
feat: switch from endpoints to endpointslices (#8890)
* endpointslices

Signed-off-by: tombokombo <tombo@sysart.tech>

* cleanup

Signed-off-by: tombokombo <tombo@sysart.tech>

* fix rbac

Signed-off-by: tombokombo <tombo@sysart.tech>

* fix comments

Signed-off-by: tombokombo <tombo@sysart.tech>

* cleanup store, add store tests

Signed-off-by: tombokombo <tombo@sysart.tech>

* fix copyright date

Signed-off-by: tombokombo <tombo@sysart.tech>

Signed-off-by: tombokombo <tombo@sysart.tech>
2022-09-23 12:38:04 -07:00
Harpreet singh
69318355b1
Fix defaultServer backend update for Ingress with defaultBackend. (#8825) 2022-08-22 16:26:23 -07:00
Zadkiel Aharonian
d5893d4a2e
fix(controller): typo in catch-all CheckIngress error message (#8905) 2022-08-22 16:20:16 -07:00
Jintao Zhang
730174f73d
feat: using LeaseLock for election (#8921)
We removed the use of configmap as an election lock, so we will use the
Lease API to complete the election.

Before this, we used `MultiLock` to facilitate smooth migration of
existing users of ingress-nginx from configmap to LeaseLock.

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2022-08-22 15:38:16 -07:00
Ricardo Katz
4508493dfe
Clean old code and move helper functions (#8946) 2022-08-21 14:21:51 -07:00
Ricardo Katz
c86d50ecef
Move APIs to be used by both controller and configurer (#8854) 2022-07-21 17:32:48 -07:00
Ricardo Pchevuzinske Katz
32d06d4b3b Move TCPProxy to pkg 2022-07-21 18:08:28 -03:00
Ricardo Pchevuzinske Katz
7304086202 Move util to specific package location 2022-07-21 18:06:55 -03:00
Ricardo Katz
4c6a7ee158
Decouple shared functions between controllers (#8829)
* Decouple shared functions between controllers

* Apply suggestions from code review

Co-authored-by: Jintao Zhang <tao12345666333@163.com>

* Fix package names and fmt

Co-authored-by: Jintao Zhang <tao12345666333@163.com>
2022-07-20 11:53:44 -07:00
Jintao Zhang
cf4dca8e43
feat: migrate leaderelection lock to leases (#8733)
* feat: migrate leaderelection lock to leases

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>

* Update RBAC

Co-authored-by: Shafeeque E S <shafeeque.e.s@sap.com>
2022-07-09 05:37:46 -07:00
James Strong
f5d3ab4505
fix the gosec test and a make target for it 2022-06-15 13:19:30 -04:00
zou rui
2852e2998c
feat: support enbale nginx debug_connection (#8637) 2022-06-10 04:01:46 -07:00
Filip Petkovski
4da96ea26a
Implement reporting status classes in metrics (#8548)
This commit introduces a backwards compatible command line option
--report-status-classes which will enable reporting response status classes
(2xx, 3xx..) instead of status codes in exported metrics.
2022-05-21 11:18:00 -07:00
Maksim Nabokikh
2c27e66cc7
feat: always set auth cookie (#8213)
* feat: always set auth cookie

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

* feat: Add annotation to always set auth cookie

* Add annotation
* Add global configmap key
* Provide unit tests and e2e tests
* Fix e2e documentation autogen script

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

* Regenerate e2e tests

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
2022-05-19 15:27:53 -07:00
serge-r
730b7408ca
Add header Host into mirror annotations (#8178) 2022-05-07 17:39:17 -07:00
Florian Michel
ee50e38b44
disable modsecurity on error page (#8202)
* disable modsecurity on error page

* fix modsecurity error pages test

* fix variable in nginx template

* disable modsecurity on all internal locations

* fix pipeline checks for gofmt

Signed-off-by: Florian Michel <florianmichel@hotmail.de>
2022-05-04 08:29:51 -07:00
sskserk
d4b9b486e6
Upstream keepalive time (#8319)
* nginx 1.19.10 keepalive_time parameter

* nginx v1.19.10 base image

* keepalive_time documentation

* base image

* restore base image

* e2e test

* replace default value in test
2022-04-15 04:09:10 -07:00
David Shay
47a266df45
Fix for buggy ingress sync with retries (#8325) 2022-04-11 11:42:06 -07:00
Ricardo Katz
89ed571d2a
Implement object deep inspector (#8456) 2022-04-11 07:06:07 -07:00
Ricardo Katz
3def835a6a
Jail/chroot nginx process inside controller container (#8337)
* Initial work on chrooting nginx process

* More improvements in chroot

* Fix charts and some file locations

* Fix symlink on non chrooted container

* fix psp test

* Add e2e tests to chroot image

* Fix logger

* Add internal logger in controller

* Fix overlay for chrooted tests

* Fix tests

* fix boilerplates

* Fix unittest to point to the right pid

* Fix PR review
2022-04-08 21:48:04 -07:00
Gabor Lekeny
83ce21b4dd
Add keepalive support for auth requests (#8219)
* Add keepalive support for auth requests

* Fix typo

* Address PR comments

* Log warning when auth-url contains variable in its host:port
* Generate upstream name without replacing dots to underscores in server name
* Add comment in the nginx template when the keepalive upstream block is referenced

* Workaround for auth_request module ignores keepalive in upstream block

* The `auth_request` module does not support HTTP keepalives in upstream block:
  https://trac.nginx.org/nginx/ticket/1579
* As a workaround we use ngx.location.capture but unfortunately it does not
  support HTTP/2 so `use-http2` configuration parameter is needed.

* Handle PR comments

* Address PR comments

* Handle invalid values for int parameters

* Handle PR comments

* Fix e2e test
2022-04-08 20:22:04 -07:00
Thibault Jamet
1e66a54974
Add a certificate info metric (#8253)
When the ingress controller loads certificates  (new ones or following a
secret update), it performs a series of check to ensure its validity.

In our systems, we detected a case where, when the secret object is
compromised, for example when the certificate does not match the secret
key, different pods of the ingress controller are serving a different
version of the certificate.

This behaviour is due to the cache mechanism of the ingress controller,
keeping the last known certificate in case of corruption. When this
happens, old ingress-controller pods will keep serving the old one,
while new pods, by failing to load the corrupted certificates, would
use the default certificate, causing invalid certificates for its
clients.

This generates a random error on the client side, depending on the
actual pod instance it reaches.

In order to allow detecting occurences of those situations, add a metric
to expose, for all ingress controlller pods, detailed informations of
the currently loaded certificate.

This will, for example, allow setting an alert when there is a
certificate discrepency across all ingress controller pods using a query
similar to `sum(nginx_ingress_controller_ssl_certificate_info{host="name.tld"})by(serial_number)`

This also allows to catch other exceptions loading certificates (failing
to load the certificate from the k8s API, ...

Co-authored-by: Daniel Ricart <danielricart@users.noreply.github.com>

Co-authored-by: Daniel Ricart <danielricart@users.noreply.github.com>
2022-02-24 07:08:32 -08:00