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: Avoid calling functions under package k8s.io/kubernetes, move it to util (#1967) #1983

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:

such as https://github.com/openyurtio/openyurt/blob/34b14ccadfe26b8956144d21ec62a79a3aef1760/pkg/yurtmanager/controller/yurtappset/revision.go#L96

https://github.com/openyurtio/openyurt/blob/34b14ccadfe26b8956144d21ec62a79a3aef1760/pkg/yurtmanager/controller/yurtappset/revision.go#L103

https://github.com/openyurtio/openyurt/blob/34b14ccadfe26b8956144d21ec62a79a3aef1760/pkg/yurtmanager/controller/yurtappset/revision.go#L193

they all call functions in k8s.io/kubernetes/pkg/controller/history, for avoiding this, just simply copy related functions codes into pkg/util/kebernetes, then we can call these functions in our directory.

Which issue(s) this PR fixes:

Fixes #1967

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 52.90%. Comparing base (273e8df) to head (e0a7df7). Report is 6 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1983 +/- ## ========================================== + Coverage 52.38% 52.90% +0.52% ========================================== Files 174 176 +2 Lines 20975 20959 -16 ========================================== + Hits 10988 11089 +101 + Misses 9039 8918 -121 - Partials 948 952 +4 ``` | [Flag](https://app.codecov.io/gh/openyurtio/openyurt/pull/1983/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/1983/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openyurtio) | `52.90% <ø> (+0.52%)` | :arrow_up: | 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.

rambohe-ch commented 5 months ago

@vie-serendipity PTAL

huangchenzhao commented 5 months ago

/rerun

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
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

/rerun

vie-serendipity commented 5 months ago

/lgtm @rambohe-ch

rambohe-ch commented 5 months ago

/lgtm