-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes for azure-workload-identity - use helm in minikube + fix aws no…
… roles after last commit (#205)
- Loading branch information
1 parent
b4336d2
commit 6cd104d
Showing
31 changed files
with
425 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
# | ||
# Run as: | ||
# ./bootstrap.sh "AWS_REGION" "AWS_ACCOUNT" "CLUSTER_NAME" "AKS_NAMESPACE" | ||
# | ||
|
||
set -eux | ||
|
||
AWS_REGION=${1:-rg} | ||
AWS_ACCOUNT=${2:-account} | ||
CLUSTER_NAME=${3:-cluster} | ||
# quourum | ||
AKS_NAMESPACE=${4:-quorum} | ||
|
||
echo "aws get-credentials ..." | ||
aws sts get-caller-identity | ||
aws eks --region "${AWS_REGION}" update-kubeconfig --name "${CLUSTER_NAME}" | ||
|
||
helm repo add secrets-store-csi-driver https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts | ||
helm install --namespace kube-system --create-namespace csi-secrets-store secrets-store-csi-driver/secrets-store-csi-driver | ||
kubectl apply -f https://raw.githubusercontent.com/aws/secrets-store-csi-driver-provider-aws/main/deployment/aws-provider-installer.yaml | ||
|
||
# If you have deployed the above policy before, acquire its ARN: | ||
POLICY_ARN=$(aws iam list-policies --scope Local --query 'Policies[?PolicyName==`quorum-node-secrets-mgr-policy`].Arn' --output text) | ||
if [ $? -eq 1 ] | ||
then | ||
echo "Deploy the policy" | ||
POLICY_ARN=$(aws --region $AWS_REGION --query Policy.Arn --output text iam create-policy --policy-name quorum-node-secrets-mgr-policy --policy-document '{ | ||
"Version": "2012-10-17", | ||
"Statement": [ { | ||
"Effect": "Allow", | ||
"Action": ["secretsmanager:CreateSecret","secretsmanager:UpdateSecret","secretsmanager:DescribeSecret","secretsmanager:GetSecretValue","secretsmanager:PutSecretValue","secretsmanager:ReplicateSecretToRegions","secretsmanager:TagResource"], | ||
"Resource": ["arn:aws:secretsmanager:$AWS_REGION:$AWS_ACCOUNT:secret:goquorum-node-*", "arn:aws:secretsmanager:$AWS_REGION:$AWS_ACCOUNT:secret:besu-node-*"] | ||
} ] | ||
}') | ||
fi | ||
|
||
eksctl create iamserviceaccount --name quorum-sa --namespace "${NAMESPACE}" --region="${AWS_REGION}" --cluster "${CLUSTER_NAME}" --attach-policy-arn "$POLICY_ARN" --approve --override-existing-serviceaccounts | ||
echo "Done... " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
helm/charts/besu-genesis/templates/genesis-service-account.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
{{- if not .Values.cluster.cloudNativeServices }} | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "besu-genesis.name" . }}-sa | ||
namespace: {{ .Release.Namespace }} | ||
|
||
{{- end }} | ||
|
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: {{ include "besu-genesis.name" . }}-role | ||
namespace: {{ .Release.Namespace }} | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["secrets", "configmaps"] | ||
verbs: ["create", "get", "list", "update", "delete" ] | ||
- apiGroups: [""] | ||
resources: ["pods"] | ||
verbs: ["get", "list", "watch" ] | ||
|
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ include "besu-genesis.name" . }}-rb | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: {{ include "besu-genesis.name" . }}-role | ||
subjects: | ||
- kind: ServiceAccount | ||
namespace: {{ .Release.Namespace }} | ||
{{- if and (eq .Values.cluster.provider "azure") (.Values.cluster.cloudNativeServices) }} | ||
name: {{ .Values.azure.serviceAccountName }} | ||
{{- else if and (eq .Values.cluster.provider "aws") (.Values.cluster.cloudNativeServices) }} | ||
name: {{ .Values.aws.serviceAccountName }} | ||
{{- else }} | ||
name: {{ include "besu-genesis.name" . }}-sa | ||
{{- end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.