Skip to content

[Suggestion] Resource Diff Printer #2492

Closed
@10000-ki

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

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