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

[Suggestion] Resource Diff Printer #2492

Open
10000-ki opened this issue Aug 13, 2024 · 5 comments
Open

[Suggestion] Resource Diff Printer #2492

10000-ki opened this issue Aug 13, 2024 · 5 comments

Comments

@10000-ki
Copy link
Contributor

10000-ki commented Aug 13, 2024

Idea

I'd like to propose an idea.
How about providing a utility function that outputs the diff information to show which fields have changed between the actual resource and the desired resource?

Currently, it seems that such a feature doesn't exist, so when unintended events are generated, we have to log both the actual and desired resources as text and manually compare them field by field to find the differences. This process takes too much time.

Example

    override fun match(
        actualResource: StatefulSet,
        desired: StatefulSet,
        primary: OpenSearch,
        context: Context<OpenSearch>,
    ): Matcher.Result<StatefulSet> {
        println(ResourceDiffPrinter.printDiff(actualResource, desired))
    }

"""
Diff : 
(actual) -> (desired)
annotations.last-modification-timestamp: "2024-08-13T11:07:04+09:00" -> annotations.last-modification-timestamp: "2024-08-13T12:07:04+09:00" 
spec.replicas: "3" -> spec.replicas: "4"
"""
@csviri
Copy link
Collaborator

csviri commented Aug 13, 2024

Would make sense IMO, I can imagine that as part of SSABasedGenericKubernetesResourceMatcher, that could also log this information.

Do you plan to also create a PR?

@10000-ki
Copy link
Contributor Author

Do you plan to also create a PR?

@csviri
Of course! In that case, would it be okay if I work on it and then submit a PR?

@csviri
Copy link
Collaborator

csviri commented Aug 13, 2024

sure, pls do! thx!

@10000-ki
Copy link
Contributor Author

@csviri
the PR should be created based on the next branch right??

@metacosm
Copy link
Collaborator

@csviri the PR should be created based on the next branch right??

Yes, please.

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

No branches or pull requests

3 participants