forked from eksctl-io/eksctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdump-coredns-manifests.sh
executable file
·35 lines (32 loc) · 1.11 KB
/
dump-coredns-manifests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
resources=(
service/kube-dns
serviceaccount/coredns
configmap/coredns
deployment.apps/coredns
clusterrole.rbac.authorization.k8s.io/system:coredns
clusterrolebinding.rbac.authorization.k8s.io/system:coredns
)
## it turns out `--export` is going away, and it doesn't support
## RBAC objects, so here is a custom stripper for all of our needs
kubectl \
--namespace=kube-system \
--output=json \
get "${resources[@]}" \
| jq -S . \
| jq '
del(.metadata) |
del(.items[].metadata.uid) |
del(.items[].metadata.selfLink) |
del(.items[].metadata.generation) |
del(.items[].metadata.resourceVersion) |
del(.items[].metadata.creationTimestamp) |
del(.items[].metadata.annotations["kubectl.kubernetes.io/last-applied-configuration"]) |
del(.items[].metadata.annotations["deployment.kubernetes.io/revision"]) |
del(.items[].spec.clusterIP) |
del(.items[].secrets) |
del(.items[].status)
'