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

fix #3615: always requesting bookmarks #3617

Merged
merged 6 commits into from
Dec 16, 2021
Merged

Conversation

shawkins
Copy link
Contributor

@shawkins shawkins commented Nov 25, 2021

Description

Draft fix for #3615 - always enable bookmarks since we always implicitly retry watches.

Since this affects a great number of test results, some of which are also touched by the okhttp refactoring, I'll pick this back up after that is committed.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@centos-ci
Copy link

Can one of the admins verify this patch?

@shawkins
Copy link
Contributor Author

@manusa @rohanKanojia other than needing to correct a lot of tests, is there any reason why we shouldn't automatically request bookmarks? I see our watch logic as being the same as a retry watcher, so it really should support this by default.

@shawkins shawkins marked this pull request as ready for review December 7, 2021 20:55
@shawkins
Copy link
Contributor Author

shawkins commented Dec 7, 2021

@manusa after some discussion we decided that opt into bookmarks by default seems reasonable. This can be considered for inclusion in 5.11, I'll deal with any test conflicts with the okhttp refactoring later.

@@ -178,6 +185,10 @@ boolean isForceClosed() {
}

void eventReceived(Watcher.Action action, HasMetadata resource) {
if (!receiveBookmarks && action == Action.BOOKMARK) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is that all that's required to support bookmarks? What is needed by watchers to handle bookmark events?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If a user has not explicitly set allowWatchBookmarks=true in their ListOptions, then this will filter the events before they reach the Watcher. Otherwise the built-in handling is already there in AbstractWatchManager.onMessage - we just need updateResourceVersion to be called on a bookmark.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So will that update of the resource version be part of a separate PR or will it be done once the status of the okhttp PR is settled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's already there, this is what I was referring to:

@manusa manusa added this to the 5.11.0 milestone Dec 14, 2021
@@ -39,8 +39,8 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static io.fabric8.kubernetes.client.Watcher.Action.DELETED;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: Maybe have these imports ordering changes in a separate changeset/commit (or not including them to the PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd opt for leaving this change. I know imports can be a touchy subject. If devs are open to it I can add automatic import ordering using the the impsort-maven-plugin, just like is done with quarkus.

//We need to connect the pipe here, because onResponse might not be called in time (if log is empty)
//This will cause a `Pipe not connected` exception for everyone that tries to read. By always opening
//the pipe the user will get a ready to use inputstream, which will block until there is actually something to read.
if (this.out instanceof PipedOutputStream && this.output != null) {
try {
Copy link
Collaborator

@sunix sunix Dec 15, 2021

Choose a reason for hiding this comment

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

I am not sure if this is related to always enable bookmarks. Could you tell us more about these changes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this came in unintentionally and are part of another pr.

@rohanKanojia
Copy link
Member

There are some conflicts which need to be resolved

bookmarks

# Conflicts:
#	CHANGELOG.md
#	kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java
#	kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/RawCustomResourceOperationsImplTest.java
@shawkins
Copy link
Contributor Author

There are some conflicts which need to be resolved

Should be good now.

@rohanKanojia
Copy link
Member

Thanks a lot, let's wait for Marc to approve then we can proceed with merge.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

72.7% 72.7% Coverage
0.0% 0.0% Duplication

Copy link
Member

@manusa manusa left a comment

Choose a reason for hiding this comment

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

LGTM, thx!

@manusa manusa merged commit f45ed4f into fabric8io:master Dec 16, 2021
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.

6 participants