-
Notifications
You must be signed in to change notification settings - Fork 219
feat: allow return additional information for conditions #2426
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1e90219
feat: JDK client is now the default (#2235)
csviri 53372ae
improve: replace current formatting plugins with spotless plugin (#2…
csviri 8c10dbf
fix: format after rebase
csviri 8e578f2
refactor: clean-up (#2325)
metacosm 934a1fb
feat: allow return additional information for conditions
metacosm ed4ccc7
wip: record results for all conditions
metacosm ed50216
fix: properly output target dependent
metacosm c8c2b5d
feat: add causes when skipping reconcile
metacosm b959688
fix: explicitly mark as visited
metacosm 0cfc3d6
fix: properly extract result
metacosm 5525992
fix: wrong condition
metacosm 4e48ccb
fix: wrong provided or checked conditions
metacosm 530b174
fix: inverted condition, display causes when skipping a node
metacosm e50e141
refactor: remove markedForDelete field
metacosm f819c69
feat: add getDependentConditionResult method and document it
metacosm 79a70d1
refactor: move ConditionWithType to top level
metacosm b536290
refactor: remove caching
metacosm 86232ab
refactor: clean-up ResultCondition
metacosm d68441a
feat: add retrieval of condition result and DR by name
metacosm 0fcdd7f
chore(tests): add condition with result tests
metacosm ed392be
chore(docs): document ResultCondition and how to use it
metacosm 7d81812
refactor: rename ResultCondition to DetailedCondition
metacosm 047c66e
fix: adjust after rebase
metacosm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ain/java/io/javaoperatorsdk/operator/processing/dependent/workflow/ConditionWithType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.javaoperatorsdk.operator.processing.dependent.workflow; | ||
|
||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.javaoperatorsdk.operator.api.reconciler.Context; | ||
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource; | ||
|
||
class ConditionWithType<R, P extends HasMetadata, T> implements DetailedCondition<R, P, T> { | ||
private final Condition<R, P> condition; | ||
private final Type type; | ||
|
||
ConditionWithType(Condition<R, P> condition, Type type) { | ||
this.condition = condition; | ||
this.type = type; | ||
} | ||
|
||
public Type type() { | ||
return type; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Result<T> detailedIsMet(DependentResource<R, P> dependentResource, P primary, | ||
Context<P> context) { | ||
if (condition instanceof DetailedCondition detailedCondition) { | ||
return detailedCondition.detailedIsMet(dependentResource, primary, context); | ||
} else { | ||
return Result | ||
.withoutResult(condition.isMet(dependentResource, primary, context)); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...rc/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/DefaultResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.javaoperatorsdk.operator.processing.dependent.workflow; | ||
|
||
public class DefaultResult<T> implements DetailedCondition.Result<T> { | ||
private final T result; | ||
private final boolean success; | ||
|
||
public DefaultResult(boolean success, T result) { | ||
this.result = result; | ||
this.success = success; | ||
} | ||
|
||
@Override | ||
public T getDetail() { | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean isSuccess() { | ||
return success; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return asString(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.