Skip to content

Commit cfbcf04

Browse files
feat: use pod identity
1 parent c04ba25 commit cfbcf04

File tree

4 files changed

+48
-49
lines changed

4 files changed

+48
-49
lines changed

README.md

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
> TL;DR
44
>
5-
> Skip the theory? Go [here](README.md#how-to-spin-up-your-humanitec-aws-reference-architecture) to spin up your Humanitec AWS Reference Architecture Implementation.
5+
> Skip the theory? Go [here](README.md#how-to-spin-up-your-humanitec-aws-reference-architecture) to spin up your Humanitec AWS Reference Architecture Implementation.
66
>
77
> [Follow this learning path to master your Internal Developer Platform](https://developer.humanitec.com/training/master-your-internal-developer-platform/introduction/).
88
>
99
1010
Building an Internal Developer Platform (IDP) can come with many challenges. To give you a head start, we’ve created a set of [reference architectures](https://humanitec.com/reference-architectures) based on hundreds of real-world setups. These architectures described in code provide a starting point to build your own IDP within minutes, along with customization capabilities to ensure your platform meets the unique needs of your users (developers).
1111

12-
The initial version of this reference architecture has been presented by Mike Gatto, Sr. DevOps Engineer, McKinsey and Stephan Schneider, Digital Expert Associate Partner, McKinsey at [PlartformCon 2023](https://www.youtube.com/watch?v=AimSwK8Mw-U).
12+
The initial version of this reference architecture has been presented by Mike Gatto, Sr. DevOps Engineer, McKinsey and Stephan Schneider, Digital Expert Associate Partner, McKinsey at [PlartformCon 2023](https://www.youtube.com/watch?v=AimSwK8Mw-U).
1313

1414
## What is an Internal Developer Platform (IDP)?
1515

@@ -21,36 +21,34 @@ When McKinsey originally [published the reference architecture](https://www.yout
2121

2222
![AWS reference architecture Humanitec](docs/images/AWS-reference-architecture-Humanitec.png)
2323

24-
### Developer Control Plane
24+
### Developer Control Plane
2525

2626
This plane is the primary configuration layer and interaction point for the platform users. It harbors the following components:
2727

28-
29-
3028
* A **Version Control System**. GitHub is a prominent example, but this can be any system that contains two types of repositories:
31-
* Application Source Code
32-
* Platform Source Code, e.g. using Terraform
29+
* Application Source Code
30+
* Platform Source Code, e.g. using Terraform
3331
* **Workload specifications**. The reference architecture uses [Score](https://developer.humanitec.com/score/overview/).
3432
* A **portal** for developers to interact with. It can be the Humanitec Portal, but you might also use [Backstage](https://backstage.io/) or any other portal on the market.
3533

36-
37-
### Integration and Delivery Plane
34+
### Integration and Delivery Plane
3835

3936
This plane is about building and storing the image, creating app and infra configs from the abstractions provided by the developers, and deploying the final state. It’s where the domains of developers and platform engineers meet.
4037

4138
This plane usually contains four different tools:
39+
4240
* A **CI pipeline**. It can be Github Actions or any CI tooling on the market.
4341
* The **image registry** holding your container images. Again, this can be any registry on the market.
4442
* An **orchestrator** which in our example, is the Humanitec Platform Orchestrator.
4543
* The **CD system**, which can be the Platform Orchestrator’s deployment pipeline capabilities — an external system triggered by the Orchestrator using a webhook, or a setup in tandem with GitOps operators like ArgoCD.
4644

47-
### Monitoring and Logging Plane
45+
### Monitoring and Logging Plane
4846

4947
The integration of monitoring and logging systems varies greatly depending on the system. This plane however is not a focus of the reference architecture.
5048

51-
### Security Plane
49+
### Security Plane
5250

53-
The security plane of the reference architecture is focused on the secrets management system. The secrets manager stores configuration information such as database passwords, API keys, or TLS certificates needed by an Application at runtime. It allows the Platform Orchestrator to reference the secrets and inject them into the Workloads dynamically. You can learn more about secrets management and integration with other secrets management [here](https://developer.humanitec.com/platform-orchestrator/security/overview).
51+
The security plane of the reference architecture is focused on the secrets management system. The secrets manager stores configuration information such as database passwords, API keys, or TLS certificates needed by an Application at runtime. It allows the Platform Orchestrator to reference the secrets and inject them into the Workloads dynamically. You can learn more about secrets management and integration with other secrets management [here](https://developer.humanitec.com/platform-orchestrator/security/overview).
5452

5553
The reference architecture sample implementations use the secrets store attached to the Humanitec SaaS system.
5654

@@ -59,6 +57,7 @@ The reference architecture sample implementations use the secrets store attached
5957
This plane is where the actual infrastructure exists including clusters, databases, storage, or DNS services. The configuration of the Resources is managed by the Platform Orchestrator which dynamically creates app and infrastructure configurations with every deployment and creates, updates, or deletes dependent Resources as required.
6058

6159
## How to spin up your Humanitec AWS Reference Architecture
60+
6261
This repo contains an implementation of part of the Humanitec Reference Architecture for an Internal Developer Platform.
6362

6463
To install an implementation containing add-ons, follow the separate README. We currently feature these add-ons:
@@ -69,13 +68,13 @@ This repo covers the base layer of the implementation for AWS.
6968

7069
By default, the following will be provisioned:
7170

72-
- VPC
73-
- EKS Cluster
74-
- IAM User to access the cluster
75-
- Ingress NGINX in the cluster
76-
- Resource Definitions in Humanitec for:
77-
- Kubernetes Cluster
78-
- Logging
71+
* VPC
72+
* EKS Cluster
73+
* IAM User to access the cluster
74+
* Ingress NGINX in the cluster
75+
* Resource Definitions in Humanitec for:
76+
* Kubernetes Cluster
77+
* Logging
7978

8079
### Prerequisites
8180

@@ -115,22 +114,12 @@ This reference architecture implementation uses Terraform. You will need to do t
115114
terraform apply
116115
```
117116

118-
`terraform plan` and `apply` might output this message:
119-
```
120-
│ Warning: Argument is deprecated
121-
122-
│ with module.base.module.aws_eks.aws_eks_addon.this["aws-ebs-csi-driver"],
123-
│ [...]
124-
```
125-
This is due to an upstream issue with the Terraform AWS modules, and can be ignored.
126-
127117
#### Required input variables
128118

129119
Terraform reads variables by default from a file called `terraform.tfvars`. You can create your own file by renaming the `terraform.tfvars.example` file in the root of the repo and then filling in the missing values.
130120

131121
You can see find a details about each of those variables and additional supported variables under [Inputs](#inputs).
132122

133-
134123
### Verify your result
135124

136125
Check for the existence of key elements of the reference architecture. This is a subset of all elements only. For a complete list of what was installed, review the Terraform code.
@@ -148,8 +137,9 @@ Check for the existence of key elements of the reference architecture. This is a
148137
--header "Authorization: Bearer ${HUMANITEC_TOKEN}" \
149138
| jq .id,.type
150139
```
151-
140+
152141
This should output:
142+
153143
```
154144
"ref-arch"
155145
"k8s-cluster"
@@ -160,9 +150,9 @@ Check for the existence of key elements of the reference architecture. This is a
160150
```
161151
aws eks list-clusters --region <your-region>
162152
```
163-
153+
164154
This should output:
165-
155+
166156
```
167157
{
168158
"clusters": [
@@ -216,9 +206,7 @@ Once you are finished with the reference architecture, you can remove all provis
216206

217207
## Learn more
218208

219-
Expand your knowledge by heading over to our learning path, and discover how to:
220-
221-
209+
Expand your knowledge by heading over to our learning path, and discover how to:
222210

223211
* Deploy the Humanitec reference architecture using a cloud provider of your choice
224212
* Deploy and manage Applications using the Humanitec Platform Orchestrator and Score
@@ -228,8 +216,6 @@ Expand your knowledge by heading over to our learning path, and discover how to:
228216

229217
[Master your Internal Developer Platform](https://developer.humanitec.com/training/master-your-internal-developer-platform/introduction/)
230218

231-
232-
233219
* [Introduction](https://developer.humanitec.com/training/master-your-internal-developer-platform/introduction/)
234220
* [Design principles](https://developer.humanitec.com/training/master-your-internal-developer-platform/design-principles/)
235221
* [Structure and integration points](https://developer.humanitec.com/training/master-your-internal-developer-platform/structure-and-integration-points/)

examples/with-backstage/backstage-humanitec.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ module "backstage_iam_role_service_account" {
153153

154154
policy_classes = ["default"]
155155

156-
oidc_provider = module.base.eks_oidc_provider
157-
oidc_provider_arn = module.base.eks_oidc_provider_arn
158-
prefix = local.res_def_prefix
156+
cluster_name = module.base.eks_cluster_name
157+
prefix = local.res_def_prefix
159158
}
160159

161160
resource "humanitec_resource_definition_criteria" "backstage_iam_role_service_account" {

modules/base/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Module that provides the reference architecture.
2424

2525
| Name | Source | Version |
2626
|------|--------|---------|
27-
| <a name="module_aws_eks"></a> [aws\_eks](#module\_aws\_eks) | terraform-aws-modules/eks/aws | ~> 19.16 |
27+
| <a name="module_aws_eks"></a> [aws\_eks](#module\_aws\_eks) | terraform-aws-modules/eks/aws | ~> 20.2 |
2828
| <a name="module_aws_vpc"></a> [aws\_vpc](#module\_aws\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.1 |
2929
| <a name="module_ebs_csi_irsa_role"></a> [ebs\_csi\_irsa\_role](#module\_ebs\_csi\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.30 |
3030

modules/base/main.tf

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ data "aws_caller_identity" "current" {}
4848

4949
locals {
5050
default_aws_auth_users = [
51-
{
52-
userarn = data.aws_caller_identity.current.arn
53-
username = "creator"
54-
groups = ["system:masters"]
55-
},
5651
{
5752
userarn = aws_iam_user.humanitec_svc.arn
5853
username = aws_iam_user.humanitec_svc.name
@@ -81,7 +76,7 @@ module "ebs_csi_irsa_role" {
8176

8277
module "aws_eks" {
8378
source = "terraform-aws-modules/eks/aws"
84-
version = "~> 19.16"
79+
version = "~> 20.2"
8580

8681
cluster_name = var.cluster_name
8782
cluster_version = var.cluster_version
@@ -111,10 +106,29 @@ module "aws_eks" {
111106
most_recent = true
112107
service_account_role_arn = module.ebs_csi_irsa_role.iam_role_arn
113108
}
109+
eks-pod-identity-agent = {
110+
most_recent = true
111+
}
114112
}
115113

116-
manage_aws_auth_configmap = true
117-
aws_auth_users = local.aws_auth_users
114+
enable_cluster_creator_admin_permissions = true
115+
116+
access_entries = {
117+
for s in local.aws_auth_users : s.username => {
118+
kubernetes_groups = []
119+
principal_arn = s.userarn
120+
121+
policy_associations = {
122+
cluster_admin = {
123+
policy_arn = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy"
124+
access_scope = {
125+
namespaces = []
126+
type = "cluster"
127+
}
128+
}
129+
}
130+
}
131+
}
118132

119133
# required for ingress-nginx see https://github.com/terraform-aws-modules/terraform-aws-eks/issues/2513
120134
node_security_group_additional_rules = {

0 commit comments

Comments
 (0)