-
Notifications
You must be signed in to change notification settings - Fork 9
/
README.yaml
229 lines (205 loc) · 6.28 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: Terraform AWS EKS
# License of this project
license: "MIT"
# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-eks
# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v0.13-green"
url: "https://www.terraform.io"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-eks/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-eks/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Changelog"
image: "https://img.shields.io/badge/Changelog-blue"
url: "CHANGELOG.md"
# Prerequesties to display
prerequesties:
- name: Terraform
url: https://learn.hashicorp.com/terraform/getting-started/install.html
version: ">= 1.5.4"
providers:
- name: aws
url: https://aws.amazon.com/
version: ">= 5.11.0"
module_dependencies:
- name: Labels Module
url: https://github.com/clouddrove/terraform-aws-labels
description: Provides resource tagging.
# description of this project
description: |-
Terraform module will be created Autoscaling, Workers, EKS, Node Groups.
# How to use this project
usage : |-
### Sample example
Here is an example of how you can use this module in your inventory structure:
```hcl
module "eks" {
source = "clouddrove/eks/aws"
version = "1.0.1"
name = "eks"
environment = "test"
label_order = ["environment", "name"]
enabled = true
kubernetes_version = "1.25"
endpoint_private_access = true
endpoint_public_access = true
enabled_cluster_log_types = ["api", "audit", "authenticator", "controllerManager", "scheduler"]
oidc_provider_enabled = true
# Network
vpc_id = module.vpc.vpc_id
subnet_ids = module.subnets.private_subnet_id
allowed_security_groups = [module.ssh.security_group_ids]
allowed_cidr_blocks = ["0.0.0.0/0"]
# Node Groups Defaults Values It will Work all Node Groups
self_node_group_defaults = {
subnet_ids = module.subnets.private_subnet_id
key_name = module.keypair.name
propagate_tags = [{
key = "aws-node-termination-handler/managed"
value = true
propagate_at_launch = true
},
{
key = "autoscaling:ResourceTag/k8s.io/cluster-autoscaler/${module.eks.cluster_id}"
value = "owned"
propagate_at_launch = true
}
]
block_device_mappings = {
xvda = {
device_name = "/dev/xvda"
ebs = {
volume_size = 50
volume_type = "gp3"
iops = 3000
throughput = 150
}
}
}
}
self_node_groups = {
tools = {
name = "tools"
min_size = 1
max_size = 7
desired_size = 2
bootstrap_extra_args = "--kubelet-extra-args '--max-pods=110'"
instance_type = "t3a.medium"
}
spot = {
name = "spot"
instance_market_options = {
market_type = "spot"
}
min_size = 1
max_size = 7
desired_size = 1
bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'"
instance_type = "m5.large"
}
}
# Schdule self Managed Auto Scaling node group
schedules = {
scale-up = {
min_size = 2
max_size = 2 # Retains current max size
desired_size = 2
start_time = "2023-05-15T19:00:00Z"
end_time = "2023-05-19T19:00:00Z"
timezone = "Europe/Amsterdam"
recurrence = "0 7 * * 1"
},
scale-down = {
min_size = 0
max_size = 0 # Retains current max size
desired_size = 0
start_time = "2023-05-12T12:00:00Z"
end_time = "2024-03-05T12:00:00Z"
timezone = "Europe/Amsterdam"
recurrence = "0 7 * * 5"
}
}
# Node Groups Defaults Values It will Work all Node Groups
managed_node_group_defaults = {
subnet_ids = module.subnets.private_subnet_id
key_name = module.keypair.name
nodes_additional_security_group_ids = [module.ssh.security_group_ids]
tags = {
Example = "test"
}
block_device_mappings = {
xvda = {
device_name = "/dev/xvda"
ebs = {
volume_size = 50
volume_type = "gp3"
iops = 3000
throughput = 150
}
}
}
}
managed_node_group = {
test = {
min_size = 1
max_size = 7
desired_size = 2
instance_types = ["t3a.medium"]
}
spot = {
name = "spot"
capacity_type = "SPOT"
min_size = 1
max_size = 7
desired_size = 1
force_update_version = true
instance_types = ["t3.medium", "t3a.medium"]
}
}
apply_config_map_aws_auth = true
map_additional_iam_users = [
{
userarn = "arn:aws:iam::xxxxxx:user/[email protected]"
username = "[email protected]"
groups = ["system:masters"]
},
{
userarn = "arn:aws:iam::xxxxxx:user/[email protected]"
username = "[email protected]"
groups = ["system:masters"]
}
]
# Schdule EKS Managed Auto Scaling node group
schedules = {
scale-up = {
min_size = 2
max_size = 2 # Retains current max size
desired_size = 2
start_time = "2023-05-15T19:00:00Z"
end_time = "2023-05-19T19:00:00Z"
timezone = "Europe/Amsterdam"
recurrence = "0 7 * * 1"
},
scale-down = {
min_size = 0
max_size = 0 # Retains current max size
desired_size = 0
start_time = "2023-05-12T12:00:00Z"
end_time = "2024-03-05T12:00:00Z"
timezone = "Europe/Amsterdam"
recurrence = "0 7 * * 5"
}
}
}
```