terraform: update AWS LB permissions (#3681)

* bazel: add download rules for AWS LB policy

* docs: add migration notice

* terraform: re-download lb policy
This commit is contained in:
Moritz Sanft 2025-03-06 16:44:49 +01:00 committed by GitHub
parent a1e24742a9
commit a491cac57a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 79 additions and 4 deletions

View File

@ -0,0 +1,13 @@
load("//bazel/sh:def.bzl", "sh_template")
sh_template(
name = "pull_files",
data = [
"@com_github_kubernetes_sigs_aws_load_balancer_controller//:lb_policy",
],
substitutions = {
"@@POLICY_SRC@@": "$(rootpath @com_github_kubernetes_sigs_aws_load_balancer_controller//:lb_policy)",
},
template = "pull_files.sh",
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
###### script header ######
lib=$(realpath @@BASE_LIB@@) || exit 1
stat "${lib}" >> /dev/null || exit 1
# shellcheck source=../../../bazel/sh/lib.bash
if ! source "${lib}"; then
echo "Error: could not find import"
exit 1
fi
controller_policy_source="@@POLICY_SRC@@"
###### script body ######
controller_policy_real_source=$(realpath "${controller_policy_source}")
cd "${BUILD_WORKSPACE_DIRECTORY}" # needs to be done after realpath
targetDir="terraform/infrastructure/iam/aws/alb_policy.json"
cp "${controller_policy_real_source}" "${targetDir}"

View File

@ -0,0 +1,22 @@
"""A module defining the source of the AWS load balancer controller."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def aws_load_balancer_controller_deps():
http_archive(
name = "com_github_kubernetes_sigs_aws_load_balancer_controller",
urls = [
"https://cdn.confidential.cloud/constellation/cas/sha256/0cb78cdff9742945c9968ac12c785164a052b52260d19d218bb28a8bec04a2fd",
"https://github.com/kubernetes-sigs/aws-load-balancer-controller/archive/refs/tags/v2.11.0.tar.gz",
],
strip_prefix = "aws-load-balancer-controller-2.11.0",
build_file_content = """
filegroup(
srcs = ["docs/install/iam_policy.json"],
name = "lb_policy",
visibility = ["//visibility:public"],
)
""",
type = "tar.gz",
sha256 = "0cb78cdff9742945c9968ac12c785164a052b52260d19d218bb28a8bec04a2fd",
)

View File

@ -234,6 +234,10 @@ load("//3rdparty/bazel/com_github_medik8s_node_maintainance_operator:source.bzl"
node_maintainance_operator_deps() node_maintainance_operator_deps()
load("//3rdparty/bazel/com_github_kubernetes_sigs_aws_load_balancer_controller:source.bzl", "aws_load_balancer_controller_deps")
aws_load_balancer_controller_deps()
# CI deps # CI deps
load("//bazel/toolchains:ci_deps.bzl", "ci_deps") load("//bazel/toolchains:ci_deps.bzl", "ci_deps")

View File

@ -558,6 +558,7 @@ multirun(
commands = [ commands = [
":terraform_gen", ":terraform_gen",
"//3rdparty/bazel/com_github_medik8s_node_maintainance_operator:pull_files", "//3rdparty/bazel/com_github_medik8s_node_maintainance_operator:pull_files",
"//3rdparty/bazel/com_github_kubernetes_sigs_aws_load_balancer_controller:pull_files",
":go_generate", ":go_generate",
":proto_generate", ":proto_generate",
], ],

View File

@ -36,7 +36,13 @@ done
echo "All specified rules have been deleted." echo "All specified rules have been deleted."
``` ```
## Migrations to v2.19.0 ## Migrating from CLI versions before 2.21.1
### AWS
* AWS clusters that use `LoadBalancer` resources require more IAM permissions. Please upgrade your IAM roles using `constellation iam upgrade apply`. This will show necessary changes and apply them, if desired.
## Migrating from CLI versions before 2.19.0
### Azure ### Azure
@ -46,7 +52,7 @@ echo "All specified rules have been deleted."
If your Constellation has services of type `LoadBalancer`, please remove them before the upgrade and re-apply them If your Constellation has services of type `LoadBalancer`, please remove them before the upgrade and re-apply them
afterward. afterward.
## Migrating from Azure's service principal authentication to managed identity authentication (during the upgrade to Constellation v2.8.0) ## Migrating from CLI versions before 2.18.0
* The `provider.azure.appClientID` and `provider.azure.appClientSecret` fields are no longer supported and should be removed. * The `provider.azure.appClientID` and `provider.azure.appClientSecret` fields are no longer supported and should be removed.
* To keep using an existing UAMI, add the `Owner` permission with the scope of your `resourceGroup`. * To keep using an existing UAMI, add the `Owner` permission with the scope of your `resourceGroup`.

View File

@ -29,6 +29,7 @@
"ec2:DescribeTags", "ec2:DescribeTags",
"ec2:GetCoipPoolUsage", "ec2:GetCoipPoolUsage",
"ec2:DescribeCoipPools", "ec2:DescribeCoipPools",
"ec2:GetSecurityGroupsForVpc",
"elasticloadbalancing:DescribeLoadBalancers", "elasticloadbalancing:DescribeLoadBalancers",
"elasticloadbalancing:DescribeLoadBalancerAttributes", "elasticloadbalancing:DescribeLoadBalancerAttributes",
"elasticloadbalancing:DescribeListeners", "elasticloadbalancing:DescribeListeners",
@ -39,7 +40,9 @@
"elasticloadbalancing:DescribeTargetGroupAttributes", "elasticloadbalancing:DescribeTargetGroupAttributes",
"elasticloadbalancing:DescribeTargetHealth", "elasticloadbalancing:DescribeTargetHealth",
"elasticloadbalancing:DescribeTags", "elasticloadbalancing:DescribeTags",
"elasticloadbalancing:DescribeTrustStores" "elasticloadbalancing:DescribeTrustStores",
"elasticloadbalancing:DescribeListenerAttributes",
"elasticloadbalancing:DescribeCapacityReservation"
], ],
"Resource": "*" "Resource": "*"
}, },
@ -188,7 +191,9 @@
"elasticloadbalancing:DeleteLoadBalancer", "elasticloadbalancing:DeleteLoadBalancer",
"elasticloadbalancing:ModifyTargetGroup", "elasticloadbalancing:ModifyTargetGroup",
"elasticloadbalancing:ModifyTargetGroupAttributes", "elasticloadbalancing:ModifyTargetGroupAttributes",
"elasticloadbalancing:DeleteTargetGroup" "elasticloadbalancing:DeleteTargetGroup",
"elasticloadbalancing:ModifyListenerAttributes",
"elasticloadbalancing:ModifyCapacityReservation"
], ],
"Resource": "*", "Resource": "*",
"Condition": { "Condition": {