Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capa-controller-add-delete-volume-permission #94

Merged
merged 8 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Add `iam:ListRoleTags` and `iam:UntagRole` permissions to the AWS operator role.
- CAPA: add new `mc-bootstrap` policy to `capa-controller` role.

## [3.4.0] - 2024-01-16

Expand Down
3 changes: 3 additions & 0 deletions capa-controller-role/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ aws iam attach-role-policy --role-name "${ROLE_NAME}" --policy-arn "${NETWORK_TO

RESOLVER_RULES_POLICY_ARN=$(aws iam create-policy --policy-name "giantswarm-${INSTALLATION_NAME}-resolver-rule-operator-policy" --description "Giant Swarm managed policy for k8s cluster creation" --policy-document file://resolver-rules-operator-policy.json | jq -r '.Policy.Arn')
aws iam attach-role-policy --role-name "${ROLE_NAME}" --policy-arn "${RESOLVER_RULES_POLICY_ARN}"

MC_BOOTSTRAP_POLICY_ARN=$(aws iam create-policy --policy-name "giantswarm-${INSTALLATION_NAME}-mc-bootstrap-policy" --description "Giant Swarm managed policy for k8s cluster cleanup" --policy-document file://mc-bootstrap-policy.json | jq -r '.Policy.Arn')
aws iam attach-role-policy --role-name "${ROLE_NAME}" --policy-arn "${MC_BOOTSTRAP_POLICY_ARN}"
```

### for cleanup execute
Expand Down
2 changes: 1 addition & 1 deletion capa-controller-role/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NC='\033[0m'
ROLE_NAME="giantswarm-${INSTALLATION_NAME}-capa-controller"
AWS_ACCOUNT_ID="$(aws sts get-caller-identity --output text --query 'Account')"

POL_TYPES=("capa-controller" "dns-controller" "eks-controller" "iam-controller" "irsa-controller" "resolver-rule-operator" "network-topology-controller")
POL_TYPES=("capa-controller" "dns-controller" "eks-controller" "iam-controller" "irsa-controller" "resolver-rule-operator" "network-topology-controller" "mc-bootstrap")
POL_ARN_PREFIX="arn:aws:iam::${AWS_ACCOUNT_ID}:policy"

function echo_fail_or_success {
Expand Down
9 changes: 9 additions & 0 deletions capa-controller-role/giantswarm-capa-role.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,12 @@ resource "aws_iam_role_policy_attachment" "giantswarm-resolver-rules-operator-po
role = aws_iam_role.giantswarm-capa-controller-role.name
policy_arn = aws_iam_policy.giantswarm-resolver-rules-operator-policy.arn
}

resource "aws_iam_policy" "giantswarm-mc-bootstrap-policy" {
name = "giantswarm-${var.installation_name}-mc-bootstrap-policy"
policy = file("${path.module}/mc-bootstrap-policy.json")
}
resource "aws_iam_role_policy_attachment" "giantswarm-mc-bootstrap-policy-attachment" {
role = aws_iam_role.giantswarm-capa-controller-role.name
policy_arn = aws_iam_policy.giantswarm-mc-bootstrap-policy.arn
}
14 changes: 14 additions & 0 deletions capa-controller-role/mc-bootstrap-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DeleteVolume"
],
"Resource": [
"*"
]
}
]
}