doitintl / kube-no-trouble

Easily check your clusters for use of deprecated APIs
MIT License
3.21k stars 158 forks source link

feat(resource-labels): Add labels flag #637

Closed femrtnz closed 1 month ago

femrtnz commented 2 months ago

As part of the issue #405 and and #410 , we are adding a new flag called --labels. This flag is not active as default

Setting the flag --labels=true will include in the output a list of labels for each resource, please check the example output below

Example for TEXT output

__________________________________________________________________________________________
>>> Deprecated APIs removed in 1.26 <<<
------------------------------------------------------------------------------------------
KIND                      NAMESPACE     NAME            API_VERSION           REPLACE_WITH      (SINCE)     LABELS
HorizontalPodAutoscaler   <undefined>   test-labels-1   autoscaling/v2beta2   autoscaling/v2    (1.23.0)    k8s-app:gcp-compute-persistent-disk-csi-driver

Example for CSV output

api_version,kind,namespace,name,replace_with,since,rule_set,labels
autoscaling/v2beta2,HorizontalPodAutoscaler,<undefined>,test-labels-1,autoscaling/v2,1.23.0,Deprecated APIs removed in 1.26,k8s-app:gcp-compute-persistent-disk-csi-driver

Example for JSON output

[
    {
        "Name": "test-labels-1",
        "Namespace": "\u003cundefined\u003e",
        "Kind": "HorizontalPodAutoscaler",
        "ApiVersion": "autoscaling/v2beta2",
        "RuleSet": "Deprecated APIs removed in 1.26",
        "ReplaceWith": "autoscaling/v2",
        "Since": "1.23.0",
        "Labels": {
            "k8s-app": "gcp-compute-persistent-disk-csi-driver"
        }
    }
]
femrtnz commented 2 months ago

Hey @dark0dave I appreciate any insights on this change 🙏

dark0dave commented 2 months ago

This PR is too long, style is incorrect and introduces way too many commits. Rebase and clean this up.

dark0dave commented 2 months ago

Printer should not depend on config. Please don't create this binding....

femrtnz commented 2 months ago

Judge should not depend on config. Please don't create this binding....

Could you please detail what you mean? which file, line etc? it will be easier if you comment on the file.

dark0dave commented 2 months ago

Also why has the printer changed.... Like this feels brittle.

dark0dave commented 1 month ago

Printer should not depend on config. Please don't create this binding....

@femrtnz Read this again and now understand my pr https://github.com/doitintl/kube-no-trouble/pull/649

dark0dave commented 1 month ago

This pr is massive mistake. Not the functionality the way it was done.