Skip to content

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

Draft
nightkr wants to merge 1 commit into
mainfrom
feature/readable-kvp-debug
Draft

Make kvp's Debug impls a lot more readable#886
nightkr wants to merge 1 commit into
mainfrom
feature/readable-kvp-debug

Conversation

@nightkr

@nightkr nightkr commented Oct 11, 2024

Copy link
Copy Markdown
Contributor

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
- [ ] Changes are OpenShift compatible
- [ ] CRD changes approved
- [ ] Integration tests passed (for non trivial changes)
# Reviewer
- [ ] Code contains useful comments
- [ ] (Integration-)Test cases added
- [ ] Documentation added or updated
- [ ] Changelog updated
- [ ] Cargo.toml only contains references to git tags (not specific commits or branches)
# Acceptance
- [ ] Feature Tracker has been updated
- [ ] Proper release label has been added
@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

1 participant