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

Make kvp's Debug impls a lot more readable #886

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nightkr
Copy link
Member

@nightkr nightkr commented Oct 11, 2024

Description

Changes the output from:

Labels(
    KeyValuePairs(
        {
            KeyValuePair {
                key: Key {
                    prefix: None,
                    name: KeyName(
                        "group",
                    ),
                },
                value: LabelValue(
                    "default",
                ),
            },
            KeyValuePair {
                key: Key {
                    prefix: None,
                    name: KeyName(
                        "role",
                    ),
                },
                value: LabelValue(
                    "namenode",
                ),
            },
            KeyValuePair {
                key: Key {
                    prefix: Some(
                        KeyPrefix(
                            "app.kubernetes.io",
                        ),
                    ),
                    name: KeyName(
                        "component",
                    ),
                },
                value: LabelValue(
                    "namenode",
                ),
            },
            KeyValuePair {
                key: Key {
                    prefix: Some(
                        KeyPrefix(
                            "app.kubernetes.io",
                        ),
                    ),
                    name: KeyName(
                        "instance",
                    ),
                },
                value: LabelValue(
                    "simple-hdfs",
                ),
            },
            KeyValuePair {
                key: Key {
                    prefix: Some(
                        KeyPrefix(
                            "app.kubernetes.io",
                        ),
                    ),
                    name: KeyName(
                        "name",
                    ),
                },
                value: LabelValue(
                    "hdfs",
                ),
            },
            KeyValuePair {
                key: Key {
                    prefix: Some(
                        KeyPrefix(
                            "app.kubernetes.io",
                        ),
                    ),
                    name: KeyName(
                        "role-group",
                    ),
                },
                value: LabelValue(
                    "default",
                ),
            },
        },
    ),
)

To:

Labels(
    KeyValuePairs(
        {
            "group": "default",
            "role": "namenode",
            "app.kubernetes.io"/"component": "namenode",
            "app.kubernetes.io"/"instance": "simple-hdfs",
            "app.kubernetes.io"/"name": "hdfs",
            "app.kubernetes.io"/"role-group": "default",
        },
    ),
)

The useful information is still there, it's just.. a lot more readable if we cut away the fluff.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

Preview Give feedback

Reviewer

Preview Give feedback

Acceptance

Preview Give feedback

@nightkr nightkr marked this pull request as draft October 11, 2024 11:50
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.

1 participant