openyurtio / openyurt

OpenYurt - Extending your native Kubernetes to edge(project under CNCF)
https://openyurt.io
Apache License 2.0
1.69k stars 398 forks source link

feat: improve hostNetwork mode of NodePool by adding NodeAffinity to pods with specified annotation (#1935) #1959

Closed huangchenzhao closed 5 months ago

huangchenzhao commented 5 months ago

What type of PR is this?

/kind feature

What this PR does / why we need it:

A mutating webhook is introduced in yurt-manager component for adding NodeAffinity to pods with annotation["apps.openyurt.io/exclude-host-network-pool"] = true. The NodeAffinity indicates that the pods don't want to be scheduled to nodes in hostNetwork mode NodePool.

Users should add annotation ["apps.openyurt.io/exclude-host-network-pool"] = true manually to pods if they don't want to run pods on edge nodes in hostNetwork mode nodepool.

Which issue(s) this PR fixes:

Fixes #1935

codecov[bot] commented 5 months ago

Codecov Report

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

Project coverage is 52.37%. Comparing base (34b14cc) to head (44ad71e). Report is 1 commits behind head on master.

Files Patch % Lines
...kg/yurtmanager/webhook/pod/v1alpha1/pod_handler.go 0.00% 14 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1959 +/- ## ========================================== - Coverage 52.41% 52.37% -0.04% ========================================== Files 173 174 +1 Lines 21015 20972 -43 ========================================== - Hits 11014 10985 -29 + Misses 9051 9039 -12 + Partials 950 948 -2 ``` | [Flag](https://app.codecov.io/gh/openyurtio/openyurt/pull/1959/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openyurtio) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/openyurtio/openyurt/pull/1959/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openyurtio) | `52.37% <68.88%> (-0.04%)` | :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=openyurtio#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.

huangchenzhao commented 5 months ago

/rerun

rambohe-ch commented 5 months ago

@huangchenzhao filter hostnetworkpropagation also should be removed.

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

huangchenzhao commented 5 months ago

@huangchenzhao filter hostnetworkpropagation also should be removed.

removed

rambohe-ch commented 5 months ago

/lgtm