File tree 2 files changed +73
-0
lines changed
2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,34 @@ variable "os" {
26
26
default = " ubuntu"
27
27
}
28
28
29
+ variable "cpu" {
30
+ description = " CPU (__ cores)"
31
+ default = 2
32
+ validation {
33
+ condition = contains ([
34
+ " 2" ,
35
+ " 4" ,
36
+ " 6" ,
37
+ " 8"
38
+ ], var. cpu )
39
+ error_message = " Invalid cpu!"
40
+ }
41
+ }
42
+
43
+ variable "memory" {
44
+ description = " Memory (__ GB)"
45
+ default = 2
46
+ validation {
47
+ condition = contains ([
48
+ " 2" ,
49
+ " 4" ,
50
+ " 6" ,
51
+ " 8"
52
+ ], var. memory )
53
+ error_message = " Invalid memory!"
54
+ }
55
+ }
56
+
29
57
resource "coder_agent" "dev" {
30
58
os = " linux"
31
59
arch = " amd64"
@@ -80,10 +108,17 @@ resource "kubernetes_pod" "main" {
80
108
run_as_user = " 1000"
81
109
}
82
110
resources {
111
+ requests = {
112
+ " cpu" = " 250m"
113
+ " memory" = " 500Mi"
114
+ }
83
115
limits = {
84
116
# Acquire a FUSE device, powered by smarter-device-manager
85
117
" github.com/fuse" : 1
118
+ cpu = " ${ var . cpu } "
119
+ memory = " ${ var . memory } Gi"
86
120
}
121
+
87
122
}
88
123
env {
89
124
name = " CODER_AGENT_TOKEN"
Original file line number Diff line number Diff line change @@ -31,6 +31,34 @@ variable "namespace" {
31
31
description = " The Kubernetes namespace to create workspaces in (must exist prior to creating workspaces)"
32
32
}
33
33
34
+ variable "cpu" {
35
+ description = " CPU (__ cores)"
36
+ default = 2
37
+ validation {
38
+ condition = contains ([
39
+ " 2" ,
40
+ " 4" ,
41
+ " 6" ,
42
+ " 8"
43
+ ], var. cpu )
44
+ error_message = " Invalid cpu!"
45
+ }
46
+ }
47
+
48
+ variable "memory" {
49
+ description = " Memory (__ GB)"
50
+ default = 2
51
+ validation {
52
+ condition = contains ([
53
+ " 2" ,
54
+ " 4" ,
55
+ " 6" ,
56
+ " 8"
57
+ ], var. memory )
58
+ error_message = " Invalid memory!"
59
+ }
60
+ }
61
+
34
62
variable "home_disk_size" {
35
63
type = number
36
64
description = " How large would you like your home volume to be (in GB)?"
@@ -147,6 +175,16 @@ resource "kubernetes_pod" "main" {
147
175
name = " CODER_AGENT_TOKEN"
148
176
value = coder_agent. main . token
149
177
}
178
+ resources {
179
+ requests = {
180
+ " cpu" = " 250m"
181
+ " memory" = " 512Mi"
182
+ }
183
+ limits = {
184
+ " cpu" = " ${ var . cpu } "
185
+ " memory" = " ${ var . memory } Gi"
186
+ }
187
+ }
150
188
volume_mount {
151
189
mount_path = " /home/coder"
152
190
name = " home"
You can’t perform that action at this time.
0 commit comments