Skip to content

Commit

Permalink
Correct dump of cluster resources to be single item per file
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalger authored Jul 29, 2021
1 parent fbbf9f7 commit 659710d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions kube-dump
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,17 @@ if [[ "$mode" =~ ^(dump|all|dump-cluster|cls)$ ]]; then
msg-start "$resource" "$name"

# Save resource to file
kubectl get --output='json' "$resource" "${k_args[@]}" | \
kubectl get --output='json' "$resource" "$name" "${k_args[@]}" | \
jq --exit-status --compact-output --monochrome-output \
--raw-output --sort-keys 2>/dev/null \
'del(
.items[].metadata.annotations."kubectl.kubernetes.io/last-applied-configuration",
.items[].metadata.annotations."control-plane.alpha.kubernetes.io/leader",
.items[].metadata.uid,
.items[].metadata.selfLink,
.items[].metadata.resourceVersion,
.items[].metadata.creationTimestamp,
.items[].metadata.generation
.metadata.annotations."kubectl.kubernetes.io/last-applied-configuration",
.metadata.annotations."control-plane.alpha.kubernetes.io/leader",
.metadata.uid,
.metadata.selfLink,
.metadata.resourceVersion,
.metadata.creationTimestamp,
.metadata.generation
)' | \
yq eval --prettyPrint --no-colors --exit-status - \
>"$destination_dir/cluster/${name//:/-}_$resource".yaml 2>/dev/null && \
Expand Down

0 comments on commit 659710d

Please sign in to comment.