linkerd2/pkg/util
Kevin Leimkuhler d611af3647
Filter default opaque ports for pods and services (#6774)
#6719 changed the proxy injector so that it adds the `config.linkerd.io/opaque-ports` annotation to all pods and services if they or their namespace do not already contain the annotation. The value used is the default list of opaque ports—which is `25,443,587,3306,4444,5432,6379,9300,11211` unless otherwise specified by the user during installation.

Closes #6729

The main issue with this is that if a service exposes a service port `9090` that targets `3306`, the service _should_ have `9090` set as opaque since it targets a default opaque port, but it does not. This change ensures that services with this situation have `9090` set as opaque.

Additionally, services and pods do not need an annotation for with the entire default opaque ports list if they don't expose those ports in the first place. This change will filter out ports from the default list if the service or pod does not expose them.

### tests
I've added some unit tests that demonstrate the change in behavior and explained in the original issue #6729.

Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
2021-08-31 16:11:42 -06:00
..
http.go Add go linting to CI config (#2018) 2018-12-20 15:33:09 -08:00
http_test.go Add unit test for pkg/util/http.go (#4770) 2020-07-21 14:08:53 -07:00
parsing.go Filter default opaque ports for pods and services (#6774) 2021-08-31 16:11:42 -06:00
parsing_test.go destination: pass opaque-ports through cmd flag (#5829) 2021-03-01 16:00:20 +05:30