Skip to main content

kubejyg: Kubernetes Resource Extraction with Namespace Grouping built for filtering with jq, yq and grep.

Project description

Kubejyg

Kubernetes Resource Extraction with Namespace Grouping.

How it works

kubejyg extracts Kubernetes resources across multiple namespaces, grouping them by namespace. The output is generated in either JSON or YAML, ready to be piped into well known processors like jq, yq, and grep.

Examples

Fetch all deployment manifests from all namespaces in YAML.

kubejyg | yq ".Namespaces.[].[].[].Deployments" -C

Fetch all the annotations from all the Services across all Namespaces in JSON.

kubejyg -o json | jq ".Namespaces[].[].[].Services | select ( . != null) | .[].metadata.annotations" -C

Output structure

{
    "Namespaces": [
        {
            "ns-1": [
                {
                    "Deployments": [
                        {
                            deployment-manifest-1
                        }
                        ...
                    ]
                    "Services": [
                        {
                            service-manifest-1
                        }
                        ...
                    ]
                    "Ingress": [
                        {
                            ingress-manifest-1
                        }
                        ...
                    ]
                }
            ]
        ...
        }
    ]
}

Installation

pip install kubejyg

Features

Kubernetes resources:

  • Deployments
  • Services
  • Ingresses

Output:

  • YAML
  • JSON

Naming

kubejyg is named after the following utilities:

  1. kubectl
  2. jq
  3. yq
  4. grep

Gotchas

jq: error (at <stdin>:1): Cannot iterate over null (null).

Some namespaces might not contain resources of all kinds. If we apply filters over empty arrays, jq and yq will replaces those arrays with null values. Applying filters over them will error out. Use select ( . != null) to filter null expressions, see examples for details.

Contributing

  1. Create an issue
  2. Fork
  3. Change
  4. Open PR
  5. Profit!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kubejyg-0.0.13.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kubejyg-0.0.13-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file kubejyg-0.0.13.tar.gz.

File metadata

  • Download URL: kubejyg-0.0.13.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.8

File hashes

Hashes for kubejyg-0.0.13.tar.gz
Algorithm Hash digest
SHA256 b2a706ab8c8910bc397995a43fb29de7444055b65f5181fab48b4f2b1ae618e5
MD5 b393defa32eec495eef8cf85d5880269
BLAKE2b-256 8f4cd8997e8a3288c465cc4879dfb73ba7038a7c69b00ce010ec0e0c69695eda

See more details on using hashes here.

File details

Details for the file kubejyg-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: kubejyg-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.8

File hashes

Hashes for kubejyg-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 cd11a8684522e4e061c506eab8afceeed21f77f211cefb9e8ec44cd66df6b42c
MD5 031b549486af0d3d09b85ed47e1fcd5d
BLAKE2b-256 a5d5616bfa01207705a66817f94937ffdf6cdcd8b9ec34deba5d098c399c9d9b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page