-
Notifications
You must be signed in to change notification settings - Fork 22
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
Update k8s dependencies to 4.14 and controller-runtime to v0.15 #376
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #376 +/- ##
==========================================
+ Coverage 77.47% 77.51% +0.03%
==========================================
Files 49 49
Lines 2007 2019 +12
==========================================
+ Hits 1555 1565 +10
- Misses 398 400 +2
Partials 54 54
|
@@ -16,13 +16,14 @@ import ( | |||
) | |||
|
|||
// NewFakeClient creates a fake K8s client with ability to override specific Get/List/Create/Update/StatusUpdate/Delete functions | |||
func NewFakeClient(t T, initObjs ...runtime.Object) *FakeClient { | |||
func NewFakeClient(t T, initObjs ...client.Object) *FakeClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes initObjs type from runtime.Object to client.Object - see discussion here
WithStatusSubresource can only accept client.Object was a major reason to consider making this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Job!
I have only few minor comments.
@@ -15,6 +16,7 @@ func TestLabelMapper(t *testing.T) { | |||
|
|||
t.Run("resource with expected label", func(t *testing.T) { | |||
// given | |||
ctx := context.TODO() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor - we could move the context creation up in the parent test
created.Status.Replicas = 2 | ||
require.NoError(t, fclient.Status().Update(context.TODO(), created)) | ||
require.NoError(t, fclient.Get(context.TODO(), types.NamespacedName{Namespace: "somenamespace", Name: created.Name}, retrieved)) | ||
assert.EqualValues(t, 2, retrieved.Status.Replicas) // replicas count changed to 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check that generation is 1 or it doesn't bring any benefit ?
Quality Gate passedIssues Measures |
pkg/test/client.go
Outdated
s := scheme.Scheme | ||
err := toolchainv1alpha1.AddToScheme(s) | ||
require.NoError(t, err) | ||
cl := fake.NewClientBuilder(). | ||
WithScheme(s). | ||
WithRuntimeObjects(initObjs...). | ||
WithObjects(initObjs...). | ||
WithStatusSubresource(initObjs...). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to our discussion in the host-operator PR, we could try to improve this logic to register status sub-resource for all "toolchain" resources. In this way we would know that, the status sub-resource is registered for all objects we manage.
So, could you go through all toolchain GVKs and add them to the client builder as objects with the status sub-resource? Try to use a generic logic using the scheme and GVKs, we don't want to update the logic as soon as we add or remove a CRD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in 6dfea01
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Just one minor comment. And +1 to @MatousJobanek's suggestion regarding registering status sub resources for all our API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Co-authored-by: Matous Jobanek <mjobanek@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing/answering my comments 👍
…mon into k8s_1_27_common
…on into k8s_1_27_common
Quality Gate passedIssues Measures |
Updates k8s dependencies to 0.27 and controller-runtime to v0.15.
With the update to controller-runtime v0.15 (changes in release detailed here), this PR has following changes to combat the breaking changes:
Changes wrt - https://issues.redhat.com/browse/SANDBOX-558
DO NOT MERGE (All the PRs related to version updates need to be merged at once, but these PR are for early feedback so that there are not a lot of changes to review at once)