Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ishustava authored Jan 29, 2021
2 parents 8d6143b + a26c9fd commit 2bd2556
Show file tree
Hide file tree
Showing 31 changed files with 210 additions and 103 deletions.
8 changes: 4 additions & 4 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ project adheres to [Semantic Versioning](http://semver.org/).
{{ .Title }}:
{{ range .Commits -}}
{{- if .Subject -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject | upperFirst }}
{{ end -}}
{{ end }}
{{ end -}}
{{ else }}
{{ range .Unreleased.Commits -}}
{{- if .Subject -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject | upperFirst}}
{{ end -}}
{{ end }}
{{ end -}}
Expand All @@ -43,14 +43,14 @@ project adheres to [Semantic Versioning](http://semver.org/).
{{ .Title }}:
{{ range .Commits -}}
{{- if .Subject -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject | upperFirst }}
{{ end -}}
{{ end }}
{{ end -}}
{{ else }}
{{ range .Commits -}}
{{- if .Subject -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject | upperFirst }}
{{ end -}}
{{ end }}
{{ end -}}
Expand Down
10 changes: 9 additions & 1 deletion .chglog/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ options:

commit_groups:
group_by: Type
sort_by: Type
sort_by: Custom
title_order:
- feat
- improvement
- refactor
- fix
- docs
- test
- ci
title_maps:
feat: FEATURES
fix: BUG FIXES
Expand Down
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Please note we have a code of conduct, please follow it in all your interactions
## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
3. Once all outstanding comments and checklist items have been addressed, your contribution will be merged! Merged PRs will be included in the next release. The terraform-aws-eks mainteners takes care of updating the CHANGELOG as they merge.
2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations, and container parameters.
3. Once all outstanding comments and checklist items have been addressed, your contribution will be merged! Merged PRs will be included in the next release. The terraform-aws-eks maintainers take care of updating the CHANGELOG as they merge.

## Checklists for contributions

- [ ] Add [sementics prefix](#semantic-pull-requests) to your PR or Commits (at leats one of your commit groups)
- [ ] Add [semantics prefix](#semantic-pull-requests) to your PR or Commits (at least one of your commit groups)
- [ ] CI tests are passing
- [ ] README.md has been updated after any changes to variables and outputs. See https://github.com/terraform-aws-modules/terraform-aws-eks/#doc-generation

## Semantic Pull Requests

To generate changelog, Pull Requests or Commits must have sementic and must follow conventional specs below:
To generate changelog, Pull Requests or Commits must have semantic and must follow conventional specs below:

- `feat:` for new features
- `fix:` for bug fixes
Expand Down
127 changes: 82 additions & 45 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ TAG_QUERY=v11.0.0..
scope ?= "minor"

changelog-unrelease:
git-chglog -o $(CHANGELOG_FILE) $(TAG_QUERY)
git-chglog --no-case -o $(CHANGELOG_FILE) $(TAG_QUERY)

changelog:
git-chglog -o $(CHANGELOG_FILE) --next-tag `$(SEMTAG) final -s $(scope) -o -f` $(TAG_QUERY)
git-chglog --no-case -o $(CHANGELOG_FILE) --next-tag `$(SEMTAG) final -s $(scope) -o -f` $(TAG_QUERY)

release:
$(SEMTAG) final -s $(scope)
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You also need to ensure your applications and add ons are updated, or workloads

An example of harming update was the removal of several commonly used, but deprecated APIs, in Kubernetes 1.16. More information on the API removals, see the [Kubernetes blog post](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/).

By default, this module manage the `aws-auth` configmap for you (`manage_aws_auth=true`). To avoid the following [issue](https://github.com/aws/containers-roadmap/issues/654) where the EKS creation is `ACTIVE` but not ready, we implemented a retry logic with an `local-exec` provisioner and `wget` (by default) with failover to `curl`.
By default, this module manages the `aws-auth` configmap for you (`manage_aws_auth=true`). To avoid the following [issue](https://github.com/aws/containers-roadmap/issues/654) where the EKS creation is `ACTIVE` but not ready, we implemented a retry logic with an `local-exec` provisioner and `wget` (by default) with failover to `curl`.

**If you want to manage your `aws-auth` configmap, ensure you have `wget` (or `curl`) and `/bin/sh` installed where you're running Terraform or set `wait_for_cluster_cmd` and `wait_for_cluster_interpreter` to match your needs.**

Expand Down Expand Up @@ -145,7 +145,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
| Name | Version |
|------|---------|
| terraform | >= 0.12.9, != 0.13.0 |
| aws | >= 3.3.0 |
| aws | >= 3.22.0 |
| kubernetes | >= 1.11.1 |
| local | >= 1.4 |
| null | >= 2.1 |
Expand All @@ -156,7 +156,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a

| Name | Version |
|------|---------|
| aws | >= 3.3.0 |
| aws | >= 3.22.0 |
| kubernetes | >= 1.11.1 |
| local | >= 1.4 |
| null | >= 2.1 |
Expand All @@ -168,7 +168,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| attach\_worker\_cni\_policy | Whether to attach the Amazon managed `AmazonEKS_CNI_Policy` IAM policy to the default worker IAM role. WARNING: If set `false` the permissions must be assigned to the `aws-node` DaemonSet pods via another method or nodes will not be able to join the cluster. | `bool` | `true` | no |
| aws\_auth\_additional\_labels | Additionnal kubernetes labels applied on aws-auth ConfigMap | `map(string)` | `{}` | no |
| aws\_auth\_additional\_labels | Additional kubernetes labels applied on aws-auth ConfigMap | `map(string)` | `{}` | no |
| cluster\_create\_endpoint\_private\_access\_sg\_rule | Whether to create security group rules for the access to the Amazon EKS private API server endpoint. | `bool` | `false` | no |
| cluster\_create\_security\_group | Whether to create a security group for the cluster or attach the cluster to `cluster_security_group_id`. | `bool` | `true` | no |
| cluster\_create\_timeout | Timeout value when creating the EKS cluster. | `string` | `"30m"` | no |
Expand All @@ -179,11 +179,12 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
| cluster\_endpoint\_private\_access\_cidrs | List of CIDR blocks which can access the Amazon EKS private API server endpoint. | `list(string)` | `null` | no |
| cluster\_endpoint\_public\_access | Indicates whether or not the Amazon EKS public API server endpoint is enabled. | `bool` | `true` | no |
| cluster\_endpoint\_public\_access\_cidrs | List of CIDR blocks which can access the Amazon EKS public API server endpoint. | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| cluster\_iam\_role\_name | IAM role name for the cluster. Only applicable if manage\_cluster\_iam\_resources is set to false. | `string` | `""` | no |
| cluster\_iam\_role\_name | IAM role name for the cluster. Only applicable if manage\_cluster\_iam\_resources is set to false. Set this to reuse an existing IAM role. | `string` | `""` | no |
| cluster\_log\_kms\_key\_id | If a KMS Key ARN is set, this key will be used to encrypt the corresponding log group. Please be sure that the KMS Key has an appropriate key policy (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html) | `string` | `""` | no |
| cluster\_log\_retention\_in\_days | Number of days to retain log events. Default retention - 90 days. | `number` | `90` | no |
| cluster\_name | Name of the EKS cluster. Also used as a prefix in names of related resources. | `string` | n/a | yes |
| cluster\_security\_group\_id | If provided, the EKS cluster will be attached to this security group. If not given, a security group will be created with necessary ingress/egress to work with the workers | `string` | `""` | no |
| cluster\_service\_ipv4\_cidr | service ipv4 cidr for the kubernetes cluster | `string` | `null` | no |
| cluster\_version | Kubernetes version to use for the EKS cluster. | `string` | n/a | yes |
| config\_output\_path | Where to save the Kubectl config file (if `write_kubeconfig = true`). Assumed to be a directory if the value ends with a forward slash `/`. | `string` | `"./"` | no |
| create\_eks | Controls if EKS resources should be created (it affects almost all resources) | `bool` | `true` | no |
Expand All @@ -208,7 +209,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
| node\_groups\_defaults | Map of values to be applied to all node groups. See `node_groups` module's documentation for more details | `any` | `{}` | no |
| permissions\_boundary | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no |
| subnets | A list of subnets to place the EKS cluster and workers within. | `list(string)` | n/a | yes |
| tags | A map of tags to add to all resources. Tags added to launch coniguration or templates override these values for ASG Tags only. | `map(string)` | `{}` | no |
| tags | A map of tags to add to all resources. Tags added to launch configuration or templates override these values for ASG Tags only. | `map(string)` | `{}` | no |
| vpc\_id | VPC where the cluster and workers will be deployed. | `string` | n/a | yes |
| wait\_for\_cluster\_cmd | Custom local-exec command to execute for determining if the eks cluster is healthy. Cluster endpoint will be available as an environment variable called ENDPOINT | `string` | `"for i in `seq 1 60`; do if `command -v wget > /dev/null`; then wget --no-check-certificate -O - -q $ENDPOINT/healthz >/dev/null && exit 0 || true; else curl -k -s $ENDPOINT/healthz >/dev/null && exit 0 || true;fi; sleep 5; done; echo TIMEOUT && exit 1"` | no |
| wait\_for\_cluster\_interpreter | Custom local-exec command line interpreter for the command to determining if the eks cluster is healthy. | `list(string)` | <pre>[<br> "/bin/sh",<br> "-c"<br>]</pre> | no |
Expand Down
6 changes: 5 additions & 1 deletion cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ resource "aws_eks_cluster" "this" {
public_access_cidrs = var.cluster_endpoint_public_access_cidrs
}

kubernetes_network_config {
service_ipv4_cidr = var.cluster_service_ipv4_cidr
}

timeouts {
create = var.cluster_create_timeout
delete = var.cluster_delete_timeout
}

dynamic encryption_config {
dynamic "encryption_config" {
for_each = toset(var.cluster_encryption_config)

content {
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ module "eks" {
worker_groups = [
{
name = "worker-group-1"
instance_type = "t2.small"
instance_type = "t3.small"
additional_userdata = "echo foo bar"
asg_desired_capacity = 2
additional_security_group_ids = [aws_security_group.worker_group_mgmt_one.id]
},
{
name = "worker-group-2"
instance_type = "t2.medium"
instance_type = "t3.medium"
additional_userdata = "echo foo bar"
additional_security_group_ids = [aws_security_group.worker_group_mgmt_two.id]
asg_desired_capacity = 1
Expand Down
3 changes: 3 additions & 0 deletions examples/fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ module "eks" {
# GithubOrg = "terraform-aws-modules"
# }

# using specific subnets instead of all the ones configured in eks
# subnets = ["subnet-0ca3e3d1234a56c78"]

tags = {
Owner = "test"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/irsa/irsa.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "iam_assumable_role_admin" {
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc"
version = "2.14.0"
version = "3.6.0"
create_role = true
role_name = "cluster-autoscaler"
provider_url = replace(module.eks.cluster_oidc_issuer_url, "https://", "")
Expand Down
4 changes: 2 additions & 2 deletions examples/irsa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ data "aws_caller_identity" "current" {}

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "2.47.0"
version = "2.64.0"
name = "test-vpc"
cidr = "10.0.0.0/16"
azs = data.aws_availability_zones.available.names
Expand All @@ -65,7 +65,7 @@ module "eks" {
worker_groups = [
{
name = "worker-group-1"
instance_type = "t2.medium"
instance_type = "t3.medium"
asg_desired_capacity = 1
tags = [
{
Expand Down
4 changes: 2 additions & 2 deletions examples/launch_templates/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ module "eks" {
worker_groups_launch_template = [
{
name = "worker-group-1"
instance_type = "t2.small"
instance_type = "t3.small"
asg_desired_capacity = 2
public_ip = true
},
{
name = "worker-group-2"
instance_type = "t2.medium"
instance_type = "t3.medium"
asg_desired_capacity = 1
public_ip = true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Content-Type: multipart/mixed; boundary="//"

--//
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
set -xe
#!/bin/bash
set -e

# Bootstrap and join the cluster
/etc/eks/bootstrap.sh --b64-cluster-ca '${cluster_auth_base64}' --apiserver-endpoint '${endpoint}' ${bootstrap_extra_args} --kubelet-extra-args "${kubelet_extra_args}" '${cluster_name}'
Expand Down
5 changes: 3 additions & 2 deletions examples/managed_node_groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ module "eks" {
max_capacity = 10
min_capacity = 1

instance_type = "m5.large"
instance_types = ["m5.large"]
capacity_type = "SPOT"
k8s_labels = {
Environment = "test"
GithubRepo = "terraform-aws-eks"
Expand All @@ -121,7 +122,7 @@ module "eks" {
# worker_groups_launch_template = [
# {
# name = "worker-group-1"
# instance_type = "t2.small"
# instance_type = "t3.small"
# asg_desired_capacity = 2
# public_ip = true
# }
Expand Down
2 changes: 1 addition & 1 deletion examples/secrets_encryption/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module "eks" {
worker_groups = [
{
name = "worker-group-1"
instance_type = "t2.small"
instance_type = "t3.small"
additional_userdata = "echo foo bar"
asg_desired_capacity = 2
},
Expand Down
1 change: 1 addition & 0 deletions fargate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module "fargate" {
create_fargate_pod_execution_role = var.create_fargate_pod_execution_role
fargate_pod_execution_role_name = var.fargate_pod_execution_role_name
fargate_profiles = var.fargate_profiles
permissions_boundary = var.permissions_boundary
iam_path = var.iam_path
iam_policy_arn_prefix = local.policy_arn_prefix
subnets = var.subnets
Expand Down
5 changes: 4 additions & 1 deletion local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ locals {
asg_initial_lifecycle_hooks = [] # Initital lifecycle hook for the autoscaling group.
asg_recreate_on_change = false # Recreate the autoscaling group when the Launch Template or Launch Configuration change.
default_cooldown = null # The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
health_check_type = null # Controls how health checking is done. Valid values are "EC2" or "ELB".
health_check_grace_period = null # Time in seconds after instance comes into service before checking health.
instance_type = "m4.large" # Size of the workers instances.
spot_price = "" # Cost of spot instance.
placement_tenancy = "" # The tenancy of the instance. Valid values are "default" or "dedicated".
root_volume_size = "100" # root volume size of workers instances.
root_volume_type = "gp2" # root volume type of workers instances, can be 'standard', 'gp2', or 'io1'
root_volume_type = "gp3" # root volume type of workers instances, can be "standard", "gp3", "gp2", or "io1"
root_iops = "0" # The amount of provisioned IOPS. This must be set with a volume_type of "io1".
root_volume_throughput = null # The amount of throughput to provision for a gp3 volume.
key_name = "" # The key pair name that should be used for the instances in the autoscaling group
pre_userdata = "" # userdata to pre-append to the default userdata.
userdata_template_file = "" # alternate template to use for userdata
Expand All @@ -52,6 +54,7 @@ locals {
additional_userdata = "" # userdata to append to the default userdata.
ebs_optimized = true # sets whether to use ebs optimization on supported types.
enable_monitoring = true # Enables/disables detailed monitoring.
enclave_support = false # Enables/disables enclave support
public_ip = false # Associate a public ip address with a worker
kubelet_extra_args = "" # This string is passed directly to kubelet if set. Useful for adding labels or taints.
subnets = var.subnets # A list of subnets to place the worker nodes in. i.e. ["subnet-123", "subnet-456", "subnet-789"]
Expand Down
2 changes: 2 additions & 0 deletions modules/fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Helper submodule to create and manage resources related to `aws_eks_fargate_prof
| namespace | Kubernetes namespace for selection | `string` | n/a | yes |
| labels | Key-value map of Kubernetes labels for selection | `map(string)` | `{}` | no |
| tags | Key-value map of resource tags. Will be merged with root module tags. | `map(string)` | `var.tags` | no |
| subnets | List of subnet IDs. Will replace the root module subnets. | `list(string)` | `var.subnets` | no |

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
Expand All @@ -38,6 +39,7 @@ No requirements.
| fargate\_profiles | Fargate profiles to create. See `fargate_profile` keys section in README.md for more details | `any` | `{}` | no |
| iam\_path | IAM roles will be created on this path. | `string` | `"/"` | no |
| iam\_policy\_arn\_prefix | IAM policy prefix with the correct AWS partition. | `string` | n/a | yes |
| permissions\_boundary | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no |
| subnets | A list of subnets for the EKS Fargate profiles. | `list(string)` | `[]` | no |
| tags | A map of tags to add to all resources. | `map(string)` | `{}` | no |

Expand Down
2 changes: 1 addition & 1 deletion modules/fargate/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ data "aws_iam_policy_document" "eks_fargate_pod_assume_role" {
}

data "aws_iam_role" "custom_fargate_iam_role" {
count = local.create_eks && ! var.create_fargate_pod_execution_role ? 1 : 0
count = local.create_eks && !var.create_fargate_pod_execution_role ? 1 : 0
name = var.fargate_pod_execution_role_name
}
Loading

0 comments on commit 2bd2556

Please sign in to comment.