-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Exposing apigroups and apiresources #3487
Conversation
Can one of the admins verify this patch? |
openshift-client/src/main/java/io/fabric8/openshift/client/OpenshiftAdapterSupport.java
Outdated
Show resolved
Hide resolved
8bf0fd8
to
00f510f
Compare
00f510f
to
aafd503
Compare
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.
LGTM
Still getting some errors in the tests (I assume that the original PR would have those same errors, did you build it with tests locally?) Errors are due to the |
The problem should be with https://github.com/fabric8io/kubernetes-client/pull/3487/files#diff-7b405d7bf5ccb2d183a3bdd42f24aad3cf3e7d1bb419323b2a8a4d422bc6bac4R233 If there is no endpoint, then this call will fail. Previously the exception was swallowed in the OpenshiftAdapterSupport. I guess karaf logic is expecting to construct the openshift client without a failure. |
After looking at this some more, I'm not sure it was ever working as intended. Between the boolean confusion, exception swallowing, and API_GROUPS_ENABLED_PER_URL.containsKey - rather than a get, it seems to have a very narrow path to work consistently. I've tried in the next commit to satisfy #3184 as well. Essentially the behavior is: if isDisableApiGroupCheck is true, then we'll report that it's openshift. That somewhat addresses #3184 |
Your fix seems to be passing the tests now, thx. Shall I remove this one e59f433? (It didn't seem to have any effect either) (We really need some proper unit tests to document the logic of the configuration) I'm a little worried about possible regressions introduced by this PR when working on OpenShift. Shall we skip it from today's release and delay it to 5.9.0? |
ad75147
to
47b406c
Compare
I can understand that. On the one hand this wasn't functioning like it should. After the first time through the DefaultOpenShiftClient constructor, the check https://github.com/fabric8io/kubernetes-client/pull/3487/files#diff-7b405d7bf5ccb2d183a3bdd42f24aad3cf3e7d1bb419323b2a8a4d422bc6bac4L235 would assume "enabled" for any url previously checked. However since it's not altering the config in that path it's really not doing anything to the config flags at that point. Only on the first time through this logic was there a possibility of checking the api groups. If disableApiGroupCheck was false, then openshiftApiGroupsEnabled became false - regardless of what was set on the OpenShiftConfig (which is also confusing because in the OpenShiftConfig openshiftApiGroupsEnabled is treated as the primary property). If disableApiGroupCheck was true (which appears to be only for mock logic), then it would perform the group check and use that result as openshiftApiGroupsEnabled - that seems completely contrary to the disable flag. The proposed changes are trying somewhat to honor the original intent of the flags, and thus introducing the need to set the disable flag in more places. You could make the case to further change this logic for clarity. Since the way we check for openshift is based upon the presence of openshift apigroups, in effect isOpenShift == isOpenshiftApiGroupsEnabled. Also since OpenShift 3.6 and earlier is no longer supported, at this point I'd say we don't need to preserve isOpenshiftApiGroupsEnabled at all. The rationale for keeping disableApiGroupCheck is for making the isAdaptable check work in mock scenarios. I've added a commit that does this. The concern there is that it's actually behavioral different from before - what I can see/infer if you leave everything at the defaults, we'll only ever use oapi. With this change we'll use apis. @rohanKanojia is there anything that is required to use oapi that is an openshift.io group? So it's probably best to get more eyes and testing on this. |
Also my apologizes for applying the "Whenever I run into a problem I can't solve, I always make it bigger" principle here. |
Since there is nothing critical here, I'll schedule this for 5.9.0 (due in < 3 weeks)
I added a breaking change note in the changelog, at least to warn the users. It wasn't working as supposed, but has been like this for a while. The recent changes now enforce the check which might (or might not) break some user's current setup. The warning should help them figure out the issue. |
As far as I remember |
I've updated that to reflect these next changes. |
@@ -721,4 +722,27 @@ private MediaType getMediaTypeFromPatchContextOrDefault(PatchContext patchContex | |||
} | |||
return STRATEGIC_MERGE_JSON_PATCH; | |||
} | |||
|
|||
public <R1> R1 restCall(Class<R1> result, String... path) { |
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.
TIL, I always run out of letters from the alphabet :)
When compiled in Java 8, there's an error caused by sundrio not being able to traverse the full dependency graph of OkHttpClient. Most likely OkHttp was compiled with JDK11+ and has references that are not available for local compilation. Sundrio faces this issue since when traversing the OkHttp AST for the return type it ends up analyzing types that are not available in the current JDK.
We removed the negation of isDisableApiGroupCheck in DefaultOpenShiftClient (now in OpenshiftAdapterSupport). This means that API group check is now enabled by default. Previously it wasn't due to a bug.
moving the rest call down to operation support
829d647
to
6f62fd1
Compare
SonarCloud Quality Gate failed. |
Description
Supersedes #3405
Fixes #3294
Fixes #3303
Fixes issue when compiling in JDK 8.
Sundrio has an issue when traversing the AST path for OkHttpClient (return type in previos Config#adaptClient).
The new commits on top of #3405 remove the adaptClient from the Config classes and places a similar method in the BaseClient class. The Config class is a little more anemic but at least OkHttpClient adaptation has been abstracted 🤷.
Type of change
test, version modification, documentation, etc.)
Checklist