ub64m is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the command-line executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install ub64m
It will make the ub64m command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall ub64m uninstalls.
Adding ub64m library as a dependency
Run this command in a terminal, in your project's directory:
cargo add ub64m
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
ub64m = "1.1.0"
The ub64m library will be automatically available globally.
Read the ub64m library documentation .
Back to the crate overview .
Readme
UnBase64Manifest - ub64m
A tool to help me with kubernetes manifest wrangling. There is probably a
simpler/more elegant way to do this using standard cli tools, but where's
the fun in that? 😂
This tool will take a JSON or YAML document and decode
all base64 encoded strings in the values for any field. It will then
print the output as a new YAML file.
Example uses
$ cat tests/data/encoded-sample.yaml
---
Name: Cloud Configuration
Version: 1
Private: true
Account:
User: Qm9iCg==
Zones:
- ZWFzdC0xLWEK
- ZWFzdC0xLWIK
- c291dGgtMi1hCg==
ProjectName: Ym9icy1iaWctcHJvamVjdAo=
Token: c3VwZXItc2VjcmV0Cg==
$ ./target/debug/ub64m tests/data/encoded-sample.yaml
---
Name: Cloud Configuration
Version: 1
Private: true
Account:
User: Bob
Zones:
- east-1-a
- east-1-b
- south-2-a
ProjectName: bobs-big-project
Token: super-secret
$ kubectl create - f tests/data/kubernetes-configmap.yaml
$ kubectl get cm cloud-config - o yaml
apiVersion: v1
data:
projectName: Ym9icy1iaWctcHJvamVjdAo=
token: c3VwZXItc2VjcmV0Cg==
user: Qm9iCg==
kind: ConfigMap
metadata:
creationTimestamp: " 2023-10-15T23:50:15Z"
name: cloud-config
namespace: default
resourceVersion: " 1776"
uid: 7aeee832-4421-472e-a27d-83b4dece0c7f
[mike@gamebox] devel ~ /dev/ub64m
$ kubectl get cm cloud-config - o yaml | ./target/debug/ub64m -
---
apiVersion: v1
data:
projectName: bobs-big-project
token: super-secret
user: Bob
kind: ConfigMap
metadata:
creationTimestamp: " 2023-10-15T23:50:15Z"
name: cloud-config
namespace: default
resourceVersion: " 1776"
uid: 7aeee832-4421-472e-a27d-83b4dece0c7f
Install using cargo
From $ HOME in your terminal type the following:
cargo install ub64m
This will install the ub64m binary to the . cargo/ bin directory, please
note that this will need to be in your $ PATH for easier use.