Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move util funcs in sub packages #5754

Merged
merged 5 commits into from
Dec 22, 2022

Conversation

eddycharly
Copy link
Member

Explanation

This PR moves a couple util funcs in sub packages.
The root utils package is too generic and it will be easier to track unit tests coverage.

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
@codecov
Copy link

codecov bot commented Dec 21, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@3c997d8). Click here to learn what that means.
The diff coverage is 43.80%.

@@           Coverage Diff           @@
##             main    #5754   +/-   ##
=======================================
  Coverage        ?   34.88%           
=======================================
  Files           ?      189           
  Lines           ?    20862           
  Branches        ?        0           
=======================================
  Hits            ?     7277           
  Misses          ?    12782           
  Partials        ?      803           
Impacted Files Coverage Δ
pkg/background/generate/generate.go 0.00% <0.00%> (ø)
pkg/cosign/cosign.go 28.78% <0.00%> (ø)
pkg/engine/mutate/mutation.go 35.52% <0.00%> (ø)
pkg/policy/common.go 0.00% <0.00%> (ø)
pkg/userinfo/roleRef.go 69.09% <0.00%> (ø)
pkg/utils/kube/crd.go 0.00% <0.00%> (ø)
pkg/utils/util.go 4.51% <0.00%> (ø)
pkg/utils/data/data.go 28.57% <28.57%> (ø)
pkg/utils/kube/version.go 38.88% <38.88%> (ø)
pkg/engine/jsonutils/traverse.go 59.42% <50.00%> (ø)
... and 6 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -53,7 +53,7 @@ func main() {
kyvernoClient := internal.CreateKyvernoClient(logger)
client := internal.CreateDClient(logger, ctx, dynamicClient, kubeClient, 15*time.Minute)
// Exit for unsupported version of kubernetes cluster
if !utils.HigherThanKubernetesVersion(kubeClient.Discovery(), logging.GlobalLogger(), 1, 16, 0) {
if !kubeutils.HigherThanKubernetesVersion(kubeClient.Discovery(), logging.GlobalLogger(), 1, 16, 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is no longer needed, we should consider removing it.

pkg/utils/kube/crd.go Outdated Show resolved Hide resolved
Signed-off-by: shuting <shutting06@gmail.com>
@realshuting realshuting enabled auto-merge (squash) December 22, 2022 05:56
@realshuting realshuting merged commit 94abfaf into kyverno:main Dec 22, 2022
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Dec 29, 2022
* refactor: move util func in sub packages

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* Update pkg/utils/kube/crd.go

Signed-off-by: shuting <shutting06@gmail.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shutting06@gmail.com>
Signed-off-by: Md Sahil <Mohdssahil1@gmail.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 11, 2023
* refactor: move util func in sub packages

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* Update pkg/utils/kube/crd.go

Signed-off-by: shuting <shutting06@gmail.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shutting06@gmail.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 11, 2023
* refactor: move util func in sub packages

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* Update pkg/utils/kube/crd.go

Signed-off-by: shuting <shutting06@gmail.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shutting06@gmail.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants