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

[crd-generator] Fix inconsistent additionalPrinterColumns jsonPath #4614

Merged
merged 1 commit into from Nov 30, 2022

Conversation

andreaTP
Copy link
Member

@andreaTP andreaTP commented Nov 28, 2022

Description

This is a proposal to fix #4610

After this fix, additionalPrinterColumns with different paths will be emitted with colliding names. I'm not sure if this has implications.

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

@@ -40,41 +42,42 @@ public AddAdditionPrinterColumnDecorator(String name, String version, String typ

@Override
public void andThenVisit(CustomResourceDefinitionVersionFluent<?> spec) {
Predicate<CustomResourceColumnDefinitionBuilder> matchingColumn = col -> col.getName() != null && col.getName().equals(columnName);
Predicate<CustomResourceColumnDefinitionBuilder> matchingColumn = col -> col.getName() != null
&& col.getName().equals(columnName) && col.getJsonPath() != null && col.getJsonPath().equals(path);
Copy link
Member Author

Choose a reason for hiding this comment

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

Just highlighting the "real change" in this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps we should issue a warning when we encounter such a situation?

Copy link
Member Author

Choose a reason for hiding this comment

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

I checked the behavior, and it looks consistent to me without the need for a warning.
Using the "Joke" CRD used in the tests and created a corresponding "Joke" CR:

apiVersion: "samples.javaoperatorsdk.io/v1alpha1"
kind: JokeRequest
metadata:
  name: jr-any
spec:
  category: Any
status:
  category: Pun

the output of kubectl get seems fine to me:
Screenshot 2022-11-29 at 10 47 21

Copy link
Contributor

@lburgazzoli lburgazzoli left a comment

Choose a reason for hiding this comment

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

I don't know enough about the details so LGTM :)

@andreaTP
Copy link
Member Author

rebased and now this diff looks great 🙂 cc. @manusa

@sonarcloud
Copy link

sonarcloud bot commented Nov 29, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

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

71.4% 71.4% Coverage
0.0% 0.0% Duplication

@manusa manusa added this to the 6.3.0 milestone Nov 30, 2022
@manusa manusa merged commit 665e72a into fabric8io:master Nov 30, 2022
@manusa manusa added the changelog missing A line to changelog.md regarding the change is not added label Nov 30, 2022
@manusa manusa removed the changelog missing A line to changelog.md regarding the change is not added label Dec 12, 2022
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.

Inconsistent additionalPrinterColumns jsonPath
4 participants