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

[Feature] Show output in either table/yaml/json format for timoni inspect resources command #454

Open
rrmistry opened this issue Dec 12, 2024 · 1 comment

Comments

@rrmistry
Copy link

rrmistry commented Dec 12, 2024

Business Problem Being Solved For

> External tool requires YAML manifests of all resources deployed by timoni

Context:

Currently, we are using Tilt which requires the YAML manifest of all resources deployed by an external tool (in this case timoni)

Reference: k8s_custom_deploy

Excerpt:

The apply_cmd ... should output the YAML of the objects it applied to the Kubernetes cluster to stdout. Tilt will track workload status and stream pod logs based on this result.

Work Around:

Currently, we are using a script like this to get the YAML manifest of all resources deployed by timoni:

#!/bin/bash

# Run timoni apply command and pipe the output to the while loop with prefix "#" to comment it out in YAML format
# Could have also ignored the output except if there is an error
timoni apply $RELEASE ./ --namespace $NAMESPACE 2>&1 | while read line; do echo "# $line"; done

# Run timoni inspect resources and store the output
resources=$(timoni inspect resources $RELEASE --namespace $NAMESPACE)

# Skip the header line and parse each resource
echo "$resources" | tail -n +2 | while read -r line; do
    echo "---" # Separator between resources

    # Extract resource type and name
    resource_type=$(echo "$line" | awk '{print $1}' | cut -d/ -f1)
    resource_name=$(echo "$line" | awk '{print $1}' | cut -d/ -f2)
    namespace=$(echo "$line" | awk '{print $2}')

    # Generate and run kubectl get command
    kubectl get "$resource_type" "$resource_name" --namespace "$namespace" --output YAML
done

Expected Outcome:

> Add a new flag for timoni inspect resources called --output with values table, yaml or json which can be used to get the YAML manifest of all resources deployed by timoni.


This great tool saves us a lot of time by abstracting CUE for Kubernetes.

Kudos! and much appreciation! 🙏

@rrmistry rrmistry changed the title [Feature] Show table/YAML/JSON format for timoni inspect resources command [Feature] Show output in either table/yaml/json format for timoni inspect resources command Dec 12, 2024
@stefanprodan
Copy link
Owner

stefanprodan commented Dec 14, 2024

timoni build does output all the resources in YAML format

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

No branches or pull requests

2 participants