-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-trust-zone-cofidectl-eks.sh
More file actions
executable file
·54 lines (38 loc) · 1.58 KB
/
single-trust-zone-cofidectl-eks.sh
File metadata and controls
executable file
·54 lines (38 loc) · 1.58 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
set -euxo pipefail
# This script uses an existing EKS cluster and defines a trust zone, cluster,
# attestation policy and binding in the staging Connect using cofidectl. It
# then runs a ping-pong test.
# Prerequisites: ./prerequisites.sh
source config.env
## Deploy workload cluster
source eks.env
# Create an EBS storageclass for SPIRE server.
export AWS_REGION
envsubst <templates/ebs-storageclass-template.yaml >generated/ebs-storageclass.yaml
kubectl --context $WORKLOAD_K8S_CLUSTER_CONTEXT_1 apply -f generated/ebs-storageclass.yaml
## Deploy workload identity infrastructure using cofidectl
rm -f cofide.yaml
cofidectl connect init \
--connect-url $CONNECT_URL \
--connect-trust-domain $CONNECT_TRUST_DOMAIN \
--connect-bundle-host $CONNECT_BUNDLE_HOST \
--authorization-domain $AUTHORIZATION_DOMAIN \
--authorization-client-id $AUTHORIZATION_CLIENT_ID
cofidectl trust-zone add \
$WORKLOAD_TRUST_ZONE_1 \
--trust-domain $WORKLOAD_TRUST_DOMAIN_1
cofidectl cluster add \
$WORKLOAD_K8S_CLUSTER_NAME_1 \
--trust-zone $WORKLOAD_TRUST_ZONE_1 \
--kubernetes-context $WORKLOAD_K8S_CLUSTER_CONTEXT_1 \
--profile kubernetes
cofidectl attestation-policy add kubernetes \
--name $NAMESPACE-ns-$WORKLOAD_TRUST_ZONE_1 \
--namespace $NAMESPACE
cofidectl attestation-policy-binding add \
--trust-zone $WORKLOAD_TRUST_ZONE_1 \
--attestation-policy $NAMESPACE-ns-$WORKLOAD_TRUST_ZONE_1
cofidectl up --trust-zone $WORKLOAD_TRUST_ZONE_1
## Validate the deployment using ping-pong demo
./ping-pong-demo.sh $WORKLOAD_K8S_CLUSTER_CONTEXT_1 $WORKLOAD_K8S_CLUSTER_CONTEXT_1