stackrox / kube-linter

KubeLinter is a static analysis tool that checks Kubernetes YAML files and Helm charts to ensure the applications represented in them adhere to best practices.
https://docs.kubelinter.io/
Apache License 2.0
2.83k stars 228 forks source link

Check if Service has Endpoints for dangling service template #747

Closed marcmognol closed 2 months ago

marcmognol commented 4 months ago

Motivation

Fix #746

Changed

This PR update dangling-service template. When no selector is specified on the Service, check if Endpoints exists in the context with the same name and namespace.

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 50.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 72.28%. Comparing base (49aa5bb) to head (453f608).

Files Patch % Lines
pkg/templates/danglingservice/template.go 50.00% 2 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #747 +/- ## ========================================== - Coverage 72.37% 72.28% -0.10% ========================================== Files 45 45 Lines 1937 1945 +8 ========================================== + Hits 1402 1406 +4 - Misses 421 423 +2 - Partials 114 116 +2 ``` | [Flag](https://app.codecov.io/gh/stackrox/kube-linter/pull/747/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=stackrox) | Coverage Δ | | |---|---|---| | [bats](https://app.codecov.io/gh/stackrox/kube-linter/pull/747/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=stackrox) | `?` | | | [unit](https://app.codecov.io/gh/stackrox/kube-linter/pull/747/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=stackrox) | `72.28% <50.00%> (-0.10%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=stackrox#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

marcmognol commented 3 months ago

Hi @janisz, Is it better now ? Marc