-
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
fix: adds an additional printer column annotation #6390
Conversation
👍 worked on the same last weekend, but no tests yet: baloo42#10 Looks very similar, but I used enums for format and type. I think using enums is better here, because not all formats and types are allowed to be used here. What do you think on enums?
I also wouldn't like it if we reuse the PrinterColumn. Too many differences to explain.
I think there are pro's and con's about this. It is possible and might be explainable
👍 to postpone this to next iteration at least.
👍 same, as a above. If we validate it, it must support all cases because CRDGenerator is now fully responsible instead of the user. |
Whoops, sorry for the duplication of effort.
My only thought is the mismatch with the PrinterColumn annotation. To evolve the other annotation we'd have to accept Object for a major release before restricting back to an enum. I've added your enums to the this pr.
I'm guessing that it may never be needed - what are the chances that someone wants the same set of printer columns in two different CRDs based upon a common object? |
no worries, I havn't published or noted it somewhere. My fault ^^
👍
This would require the same amount of major releases but avoids Object or do I miss something?
Full ack. There is no need for additional ways. If someone wants to configure a printer column deep in the hierarchy and maybe shared between CRDs, he should and can already use PrinterColumn. |
FLOAT("float"), | ||
DOUBLE("double"), | ||
BYTE("byte"), | ||
BINARY("binary"), |
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.
Sorry, havn't checked it twice: binary
is not allowed. Only byte
.
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.
Updated. Altenatively, I'm fine if you want to take over ownership of this feature from your branch.
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.
If you want, you can assign it to me but it doesn't make a lot sense too me as yours is almost ready.
Your approach is able collect the path, my approach tries to distinguesh between top level annotations and annotations in the hierarchy a little bit more but without the ability to collect the path.
So it depends on which direction we want to go.
Actually Object won't work at all for an annotation property. So it either needs to be a breaking change for 7.0 or done over 3 major releases with the additional field. I'd opt for just doing the breaking change instead. |
...r-annotations/src/main/java/io/fabric8/crd/generator/annotation/AdditionalPrinterColumn.java
Show resolved
Hide resolved
...r-annotations/src/main/java/io/fabric8/crd/generator/annotation/AdditionalPrinterColumn.java
Show resolved
Hide resolved
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.
FYI: I also tried to add an approval test (only for @PrinterColumns
) to compare if something breaks with this change.
Your change in this PR looks good, but it seems there is a bug in api-v1 which blocks us to add an approval test at the moment:
@Data
public class PrinterColumnSpec {
@PrinterColumn
private String fromLevel0;
private DeepLevel1 deepLevel1;
@Data
public static class DeepLevel1 {
@PrinterColumn
private Integer fromLevel1;
}
}
Result with api-v2 (this MR):
- jsonPath: ".spec.deepLevel1.fromLevel1"
name: "FROMLEVEL1"
priority: 0
type: "integer"
- jsonPath: ".spec.fromLevel0"
name: "FROMLEVEL0"
priority: 0
type: "string"
Result with api-v1:
- jsonPath: ".spec.deepLevel1.fromLevel1"
name: "FROMLEVEL1"
priority: 0
type: "integer"
- jsonPath: ".spec.fromLevel0"
name: "FROMLEVEL0"
priority: 0
type: "string"
- jsonPath: ".spec.fromLevel1"
name: "FROMLEVEL1"
priority: 0
type: "integer"
Should we fix this within this PR or create another one and add an approval test later?
...r-annotations/src/main/java/io/fabric8/crd/generator/annotation/AdditionalPrinterColumn.java
Outdated
Show resolved
Hide resolved
} else if ("string".equals(type) && "date".equals(property.schema.getFormat())) { | ||
type = "date"; | ||
} | ||
if (property.annotation instanceof AdditionalPrinterColumn) { |
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.
At the moment the @AdditionalPrinterColum
is collected from everywhere in the spec or status type. Is this intended?
We should either clarify this in the description of the annotation or pick it only from the custom resource class.
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.
At the moment the @AdditionalPrinterColum is collected from everywhere in the spec or status type.
It should not be: https://github.com/fabric8io/kubernetes-client/pull/6390/files#diff-e5491c474236ab12f8e6f5d9895464ecf77754b17ddb0e182682add6db8620ceR146
We should either clarify this in the description of the annotation or pick it only from the custom resource class.
It is documented as intended for the root: https://github.com/fabric8io/kubernetes-client/pull/6390/files#diff-669d381122146d717c360f17fcfe5eeaab88b5c84dd4bfcf81b6de71aa5a75c1R25
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.
Sorry, seems like it was a problem on my side. I have checked out your branch again and could not reproduce it. Looks fine now!
...generator/api-v2/src/main/java/io/fabric8/crdv2/generator/AbstractCustomResourceHandler.java
Show resolved
Hide resolved
Do you mean fix the v1 implementation? I don't think we need to bother doing that. |
closes: fabric8io#3069 Signed-off-by: Steve Hawkins <[email protected]>
based upon Bernhard Strähle's review Signed-off-by: Steve Hawkins <[email protected]>
Signed-off-by: Steve Hawkins <[email protected]>
Yes I mean fixing v1 because of differences in the approval tests. If we don't want to fix v1, then we should start splitting the approval tests so that we can add tests for new or breaking features. (not in this PR) See also #6447 (comment) |
I'm good with that. |
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, thx!
Quality Gate failedFailed conditions |
Description
closes: #3069
I believe the is the most straight-foward appraoch to adding general additional printer columns.
Other thoughts:
Type of change
test, version modification, documentation, etc.)
Checklist