Skip to content

[Suggestion] Resource Diff Printer #2492

Closed

Description

@10000-ki

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"
"""

Activity

  1. csviri commented on Aug 13, 2024

    @csviri
    Collaborator

    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?

  2. 10000-ki commented on Aug 13, 2024

    @10000-ki
    ContributorAuthor

    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?

  3. csviri commented on Aug 13, 2024

    @csviri
    Collaborator

    sure, pls do! thx!

  4. 10000-ki commented on Aug 16, 2024

    @10000-ki
    ContributorAuthor

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

  5. metacosm commented on Aug 16, 2024

    @metacosm
    Collaborator

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

    Yes, please.

  6. 10000-ki commented on Nov 11, 2024

    @10000-ki
    ContributorAuthor

    done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions