-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IRSA to airflow dev environment (#4455)
* Add IRSA to airflow dev environment * fixed s3 arns and removed hard-coding * update policy statements, split out namespaces --------- Co-authored-by: julialawrence <98329494+julialawrence@users.noreply.github.com> Co-authored-by: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk>
- Loading branch information
1 parent
62f79dd
commit eb999b3
Showing
5 changed files
with
134 additions
and
58 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
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
58 changes: 58 additions & 0 deletions
58
terraform/aws/analytical-platform-data-production/airflow/kubernetes-namespaces.tf
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,58 @@ | ||
resource "kubernetes_namespace" "dev_kube2iam" { | ||
provider = kubernetes.dev-airflow-cluster | ||
metadata { | ||
annotations = { | ||
"iam.amazonaws.com/allowed-roles" = jsonencode(["*"]) | ||
} | ||
labels = { | ||
"app.kubernetes.io/managed-by" = "terraform" | ||
} | ||
name = "kube2iam-system" | ||
} | ||
timeouts {} | ||
} | ||
|
||
resource "kubernetes_namespace" "dev_airflow" { | ||
provider = kubernetes.dev-airflow-cluster | ||
metadata { | ||
|
||
name = "airflow" | ||
annotations = { | ||
"iam.amazonaws.com/allowed-roles" = jsonencode(["airflow_dev*"]) | ||
} | ||
labels = { | ||
"app.kubernetes.io/managed-by" = "Terraform" | ||
} | ||
} | ||
timeouts {} | ||
} | ||
|
||
resource "kubernetes_namespace" "kyverno_dev" { | ||
provider = kubernetes.dev-airflow-cluster | ||
metadata { | ||
name = "kyverno" | ||
labels = { | ||
"app.kubernetes.io/managed-by" = "Terraform" | ||
} | ||
} | ||
timeouts {} | ||
} | ||
|
||
resource "kubernetes_namespace" "cluster_autoscaler_system" { | ||
provider = kubernetes.dev-airflow-cluster | ||
metadata { | ||
name = "cluster-autoscaler-system" | ||
annotations = { | ||
"iam.amazonaws.com/allowed-roles" = jsonencode(["airflow-dev-cluster-autoscaler-role"]) | ||
} | ||
labels = { | ||
"app.kubernetes.io/managed-by" = "Terraform" | ||
} | ||
} | ||
timeouts {} | ||
} | ||
|
||
moved { | ||
from = kubernetes_namespace.cluster-autoscaler-system | ||
to = kubernetes_namespace.cluster_autoscaler_system | ||
} |
9 changes: 9 additions & 0 deletions
9
terraform/aws/analytical-platform-data-production/airflow/kubernetes-service-accounts.tf
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,9 @@ | ||
resource "kubernetes_service_account" "airflow" { | ||
metadata { | ||
namespace = kubernetes_namespace.dev_airflow.metadata[0].name | ||
name = "airflow" | ||
annotations = { | ||
"eks.amazonaws.com/role-arn" = module.airflow_dev_monitoring_iam_role.iam_role_arn | ||
} | ||
} | ||
} |