-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path7-restore-entries.sh
executable file
·39 lines (28 loc) · 1.25 KB
/
7-restore-entries.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
36
#!/bin/bash
set -eu
. common.sh
${KUBECTL_PATH} exec -n spire spire-server-0 -c spire-server -- /opt/spire/bin/spire-server entry show \
-spiffeID spiffe://example.org/api-proxy > /tmp/entryFound
ENTRYID=$( grep 'Entry ID :' /tmp/entryFound | awk '{print $4}')
echo $ENTRYID
log-info "Restoring api-proxy entry"
${KUBECTL_PATH} exec -n spire spire-server-0 -c spire-server -- /opt/spire/bin/spire-server entry update \
-entryID $ENTRYID \
-parentID spiffe://example.org/spire-agent-node \
-spiffeID spiffe://example.org/api-proxy \
-selector k8s:container-name:api-proxy \
-selector k8s:ns:api-ns \
-ttl 60
${KUBECTL_PATH} exec -n spire spire-server-0 -c spire-server -- /opt/spire/bin/spire-server entry show \
-spiffeID spiffe://example.org/api > /tmp/entryFound
ENTRYID=$( grep 'Entry ID :' /tmp/entryFound | awk '{print $4}')
echo $ENTRYID
log-info "Restoring api-sidecar entry to a valid DNS"
${KUBECTL_PATH} exec -n spire spire-server-0 -c spire-server -- /opt/spire/bin/spire-server entry update \
-entryID $ENTRYID \
-parentID spiffe://example.org/spire-agent-node \
-spiffeID spiffe://example.org/api \
-selector k8s:container-name:api \
-selector k8s:ns:api-ns \
-dns symuser \
-ttl 60