Skip to content

Commit 69c44a8

Browse files
added missing .tf files (#93)
Co-authored-by: Pavan Savanoor <[email protected]>
1 parent d63774c commit 69c44a8

11 files changed

+1998
-0
lines changed
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
#
2+
# Apache v2 license
3+
# Copyright (C) 2023 Intel Corporation
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
variable "disk_spec_1" {
8+
default = {
9+
disk_count = 1
10+
disk_size = 200
11+
disk_format = "ext4"
12+
disk_type = "cloud_essd"
13+
disk_performance = null
14+
}
15+
}
16+
17+
variable "disk_spec_2" {
18+
default = {
19+
disk_count = 1
20+
disk_size = 200
21+
disk_format = "ext4"
22+
disk_type = "cloud_essd"
23+
disk_performance = null
24+
}
25+
}
26+
27+
variable "region" {
28+
default = null
29+
}
30+
31+
variable "zone" {
32+
default = "cn-beijing-l"
33+
}
34+
35+
variable "resource_group_id" {
36+
default = "rg-aekzpvcftlcma5a"
37+
}
38+
39+
variable "owner" {
40+
default = ""
41+
}
42+
43+
variable "custom_tags" {
44+
default = {}
45+
}
46+
47+
variable "spot_instance" {
48+
default = true
49+
}
50+
51+
variable "wl_name" {
52+
default = ""
53+
}
54+
55+
variable "wl_registry_map" {
56+
default = ""
57+
}
58+
59+
variable "wl_namespace" {
60+
default = ""
61+
}
62+
63+
variable "worker_profile" {
64+
default = {
65+
name = "worker"
66+
instance_type = "ecs.g6.large"
67+
cpu_model_regex = null
68+
vm_count = 1
69+
70+
os_image = null
71+
os_type = "ubuntu2204"
72+
os_disk_type = "cloud_essd"
73+
os_disk_size = 200
74+
os_disk_performance = null
75+
76+
data_disk_spec = null
77+
}
78+
}
79+
80+
variable "client_profile" {
81+
default = {
82+
name = "client"
83+
instance_type = "ecs.g6.large"
84+
cpu_model_regex = null
85+
vm_count = 1
86+
87+
os_image = null
88+
os_type = "ubuntu2204"
89+
os_disk_type = "cloud_essd"
90+
os_disk_size = 200
91+
os_disk_performance = null
92+
93+
data_disk_spec = null
94+
}
95+
}
96+
97+
variable "controller_profile" {
98+
default = {
99+
name = "controller"
100+
instance_type = "ecs.g6.large"
101+
cpu_model_regex = null
102+
vm_count = 1
103+
104+
os_image = null
105+
os_type = "ubuntu2204"
106+
os_disk_type = "cloud_essd"
107+
os_disk_size = 200
108+
os_disk_performance = null
109+
110+
data_disk_spec = null
111+
}
112+
}
113+
114+
module "wsf" {
115+
source = "./template/terraform/alicloud/main"
116+
117+
region = var.region
118+
zone = var.zone
119+
resource_group_id = var.resource_group_id
120+
job_id = var.wl_namespace
121+
122+
sg_whitelist_cidr_blocks = compact(split("\n",file("proxy-ip-list.txt")))
123+
ssh_pub_key = file("ssh_access.key.pub")
124+
125+
common_tags = {
126+
for k,v in merge(var.custom_tags, {
127+
owner: var.owner,
128+
workload: var.wl_name,
129+
}) : k => substr(replace(lower(v), "/[^a-z0-9_-]/", ""), 0, 63)
130+
}
131+
132+
instance_profiles = [
133+
merge(var.worker_profile, {
134+
data_disk_spec: null,
135+
}),
136+
merge(var.client_profile, {
137+
data_disk_spec: null,
138+
}),
139+
merge(var.controller_profile, {
140+
data_disk_spec: null,
141+
}),
142+
]
143+
144+
spot_instance = var.spot_instance
145+
}
146+
147+
output "options" {
148+
value = {
149+
wl_name : var.wl_name,
150+
wl_registry_map : var.wl_registry_map,
151+
wl_namespace : var.wl_namespace,
152+
153+
docker_dist_repo: "https://mirrors.aliyun.com/docker-ce",
154+
containerd_pause_registry: "registry.aliyuncs.com/google_containers",
155+
156+
k8s_repo_key_url: {
157+
"debian": "http://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg",
158+
"centos": ["http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg","https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg"],
159+
},
160+
k8s_repo_url: {
161+
"debian": "http://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial main",
162+
"centos": "http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-$basearch",
163+
},
164+
k8s_kubeadm_options: {
165+
"ClusterConfiguration": {
166+
"imageRepository": "registry.aliyuncs.com/google_containers",
167+
},
168+
},
169+
k8s_registry_image: "public.ecr.aws/docker/library/registry:2",
170+
k8s_calico_cni_repo: "public.ecr.aws/metakube/calico",
171+
k8s_cni: "calico",
172+
k8s_enable_nfd: false,
173+
}
174+
}
175+
176+
output "instances" {
177+
value = {
178+
for k,v in module.wsf.instances : k => merge(v, {
179+
csp = "alicloud",
180+
zone = var.zone,
181+
})
182+
}
183+
}
184+
185+
output "terraform_replace" {
186+
value = lookup(module.wsf, "terraform_replace", null)==null?null:{
187+
command = replace(module.wsf.terraform_replace.command, "=", "=module.wsf.")
188+
cpu_model = module.wsf.terraform_replace.cpu_model
189+
}
190+
}
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
#
2+
# Apache v2 license
3+
# Copyright (C) 2023 Intel Corporation
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
variable "disk_spec_1" {
7+
default = {
8+
disk_count = 1
9+
disk_size = 200
10+
disk_format = "ext4"
11+
disk_type = "gp2"
12+
disk_iops = null
13+
disk_throughput = null
14+
}
15+
}
16+
17+
variable "disk_spec_2" {
18+
default = {
19+
disk_count = 1
20+
disk_size = 200
21+
disk_format = "ext4"
22+
disk_type = "gp2"
23+
disk_iops = null
24+
disk_throughput = null
25+
}
26+
}
27+
28+
variable "network_spec_1" {
29+
default = {
30+
network_count = 1
31+
network_type = null
32+
}
33+
}
34+
35+
variable "region" {
36+
default = null
37+
}
38+
39+
variable "zone" {
40+
default = "us-west-2a"
41+
}
42+
43+
variable "owner" {
44+
default = ""
45+
}
46+
47+
variable "spot_instance" {
48+
default = true
49+
}
50+
51+
variable "custom_tags" {
52+
default = {}
53+
}
54+
55+
variable "wl_name" {
56+
default = ""
57+
}
58+
59+
variable "wl_namespace" {
60+
default = ""
61+
}
62+
63+
variable "wl_registry_map" {
64+
default = ""
65+
}
66+
67+
variable "worker_profile" {
68+
default = {
69+
name = "worker"
70+
instance_type = "t2.medium"
71+
cpu_model_regex = null
72+
threads_per_core = null
73+
cpu_core_count = null
74+
vm_count = 1
75+
76+
os_image = null
77+
os_type = "ubuntu2204"
78+
os_disk_type = "gp2"
79+
os_disk_size = 200
80+
os_disk_iops = null
81+
os_disk_throughput = null
82+
83+
data_disk_spec = null
84+
network_spec = null
85+
}
86+
}
87+
88+
variable "client_profile" {
89+
default = {
90+
name = "client"
91+
instance_type = "t2.medium"
92+
cpu_model_regex = null
93+
threads_per_core = null
94+
cpu_core_count = null
95+
vm_count = 1
96+
97+
os_image = null
98+
os_type = "ubuntu2204"
99+
os_disk_type = "gp2"
100+
os_disk_size = 200
101+
os_disk_iops = null
102+
os_disk_throughput = null
103+
104+
data_disk_spec = null
105+
network_spec = null
106+
}
107+
}
108+
109+
variable "controller_profile" {
110+
default = {
111+
name = "controller"
112+
instance_type = "t2.medium"
113+
cpu_model_regex = null
114+
threads_per_core = null
115+
cpu_core_count = null
116+
vm_count = 1
117+
118+
os_image = null
119+
os_type = "ubuntu2204"
120+
os_disk_type = "gp2"
121+
os_disk_size = 200
122+
os_disk_iops = null
123+
os_disk_throughput = null
124+
125+
data_disk_spec = null
126+
network_spec = null
127+
}
128+
}
129+
130+
module "wsf" {
131+
source = "./template/terraform/aws/main"
132+
133+
region = var.region
134+
zone = var.zone
135+
job_id = var.wl_namespace
136+
137+
sg_whitelist_cidr_blocks = compact(split("\n",file("proxy-ip-list.txt")))
138+
ssh_pub_key = file("ssh_access.key.pub")
139+
140+
common_tags = {
141+
for k,v in merge(var.custom_tags, {
142+
owner: var.owner,
143+
workload: var.wl_name,
144+
}) : k => substr(replace(lower(v), "/[^a-z0-9_-]/", ""), 0, 63)
145+
}
146+
147+
instance_profiles = [
148+
merge(var.worker_profile, {
149+
data_disk_spec: null,
150+
network_spec: null,
151+
}),
152+
merge(var.client_profile, {
153+
data_disk_spec: null
154+
network_spec: null,
155+
}),
156+
merge(var.controller_profile, {
157+
data_disk_spec: null,
158+
network_spec: null,
159+
}),
160+
]
161+
162+
spot_instance = var.spot_instance
163+
}
164+
165+
output "options" {
166+
value = {
167+
wl_name : var.wl_name,
168+
wl_registry_map : var.wl_registry_map,
169+
wl_namespace : var.wl_namespace,
170+
# k8s_registry_storage: "aws",
171+
# k8s_registry_aws_storage_bucket: "registry-content",
172+
# k8s_registry_aws_storage_region: var.region,
173+
}
174+
}
175+
176+
output "instances" {
177+
sensitive = true
178+
value = {
179+
for k,v in module.wsf.instances : k => merge(v, {
180+
csp = "aws",
181+
zone = var.zone,
182+
})
183+
}
184+
}
185+
186+
output "terraform_replace" {
187+
value = lookup(module.wsf, "terraform_replace", null)==null?null:{
188+
command = replace(module.wsf.terraform_replace.command, "=", "=module.wsf.")
189+
cpu_model = module.wsf.terraform_replace.cpu_model
190+
}
191+
}
192+

0 commit comments

Comments
 (0)