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

Removing clientset and upgrading scaffolding using kubebuilder v3.8.0 #31

Merged
merged 31 commits into from
Mar 14, 2023

Conversation

hellt
Copy link
Member

@hellt hellt commented Mar 11, 2023

Updating srl-controller to use recent version of

  • client-go
  • controller-runtime
  • kubebuilder

removing clientset in favor of using controller-runtime Client.

supersedes #30

@@ -1,480 +0,0 @@
// Copyright 2022 Nokia
Copy link
Contributor

Choose a reason for hiding this comment

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

why delete this?

why not just make a test which loads the fake dynamic client and validates the operations?

Copy link
Member Author

Choose a reason for hiding this comment

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

@marcushines My way of thinking was that if there is no clientset provided in this repo, there is no need to have tests that verify CRUD operations on custom resources, as this is now automatically done via controller-runtime.

As far as I see, from KNE perspective, there is no degradation in code coverage, and controller's operations are being tested (WIP) with ginkgo e2e tests https://github.com/srl-labs/srl-controller/blob/clientset-removal/controllers/srlinux_controller_test.go.

Copy link
Contributor

Choose a reason for hiding this comment

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

so right now the srl node in kne depends on srlinux client api for create and delete - there should be clear tests in srlinux which test that api doesn't break - you could "run kne tests in an integration test" or you could just write your own api tests and leave them in the repo

Copy link
Member Author

Choose a reason for hiding this comment

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

@marcushines I think in openconfig/kne#326 we removed "srlinux client API" in favor of a generic/dynamic controller-runtime client specifically to match the removal of a clientset in this PR.

Maybe I am missing something here?

Copy link
Contributor

Choose a reason for hiding this comment

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

okay in kne - you are gonna now use this new client... how does kne know how to use that client and how can kne trust that api?

if you had a set of "unittests" showing hey when you create these objects this way they behave how you want it is very obvious how it is meant to be used however if you delete all the tests and the clientset it is not

Copy link
Member Author

Choose a reason for hiding this comment

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

@marcushines I will create a test that

  1. creates Srlinux{} CR with that client and ensures the object is created
  2. creates Srlinux{} CR, then deletes Srlinux{} CR and ensures no more named object with that kind is available.

@codecov
Copy link

codecov bot commented Mar 14, 2023

Codecov Report

Merging #31 (a16ecd7) into main (1fb2980) will increase coverage by 45.87%.
The diff coverage is 95.65%.

@@             Coverage Diff             @@
##             main      #31       +/-   ##
===========================================
+ Coverage   19.81%   65.69%   +45.87%     
===========================================
  Files          10        7        -3     
  Lines         772      548      -224     
===========================================
+ Hits          153      360      +207     
+ Misses        615      164      -451     
- Partials        4       24       +20     
Impacted Files Coverage Δ
api/v1/srl_version.go 100.00% <ø> (ø)
api/v1/types.go 0.00% <ø> (ø)
controllers/secret.go 41.30% <ø> (+41.30%) ⬆️
controllers/pod.go 71.07% <90.00%> (+71.07%) ⬆️
api/v1/srlinux_types.go 100.00% <100.00%> (ø)
controllers/cfgmap.go 60.00% <100.00%> (+60.00%) ⬆️
controllers/srlinux_controller.go 65.06% <100.00%> (+65.06%) ⬆️

... and 1 file with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants