Skip to content

Commit 0072eb6

Browse files
authored
Add ACSA config script (#188)
## Purpose Adds config script to enable ACSA resource sync ## Does this introduce a breaking change? <!-- Mark one with an "x". --> ``` [ ] Yes [x] No ``` ## Pull Request Type What kind of change does this Pull Request introduce? <!-- Please check the one that applies to this PR using "x". --> ``` [ ] Bugfix [ ] Feature [ ] Code style update (formatting, local variables) [ ] Refactoring (no functional changes, no api changes) [x] Documentation content changes [ ] Other... Please describe: ```
1 parent 1ef9f70 commit 0072eb6

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
RG=$(kubectl get connectedclusters -A -o json | jq -r '.items[0].spec.azureResourceId | split("/") | .[4]')
4+
5+
function howto_lookup {
6+
echo "Lookup the k8 bridge oid using this command:"
7+
echo " az ad sp list --filter \"appId eq '319f651f-7ddb-4fc6-9857-7aef9250bd05'\" --query '[].id' -o tsv"
8+
}
9+
10+
if [[ -z "$K8_BRIDGE" ]]; then
11+
echo "Error: K8_BRIDGE is not set in env."
12+
howto_lookup
13+
exit 1
14+
fi
15+
16+
if [ -z "${RG}" ]; then
17+
echo "No Arc cluster found in current kube context"
18+
fi
19+
20+
set -e
21+
22+
echo "Assigning acsa-rp-role to k8bridge (${K8_BRIDGE})"
23+
24+
kubectl apply -f - <<EOF
25+
apiVersion: rbac.authorization.k8s.io/v1
26+
kind: ClusterRoleBinding
27+
metadata:
28+
annotations:
29+
labels:
30+
name: k8bridge
31+
roleRef:
32+
apiGroup: rbac.authorization.k8s.io
33+
kind: ClusterRole
34+
name: acsa-rp-role
35+
subjects:
36+
- kind: User
37+
name: "${K8_BRIDGE}"
38+
namespace: azure-arc
39+
EOF

0 commit comments

Comments
 (0)