Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7d9d87

Browse files
authored
docs: use scale testing utility (#12643)
1 parent 37a0537 commit a7d9d87

File tree

13 files changed

+833
-140
lines changed

13 files changed

+833
-140
lines changed

.github/workflows/ci.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,9 @@ jobs:
604604
- name: Setup sqlc
605605
uses: ./.github/actions/setup-sqlc
606606

607+
- name: make gen
608+
run: "make --output-sync -j -B gen"
609+
607610
- name: Format
608611
run: |
609612
cd offlinedocs

docs/admin/scale.md

+153-135
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# kubernetes-large
2+
3+
Provisions a large-sized workspace with no persistent storage.
4+
5+
_Note_: It is assumed you will be running workspaces on a dedicated GKE nodepool.
6+
By default, this template sets a node affinity of `cloud.google.com/gke-nodepool` = `big-workspaces`.
7+
The nodepool affinity can be customized with the variable `kubernetes_nodepool_workspaces`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
terraform {
2+
required_providers {
3+
coder = {
4+
source = "coder/coder"
5+
version = "~> 0.7.0"
6+
}
7+
kubernetes = {
8+
source = "hashicorp/kubernetes"
9+
version = "~> 2.18"
10+
}
11+
}
12+
}
13+
14+
provider "coder" {}
15+
16+
provider "kubernetes" {
17+
config_path = null # always use host
18+
}
19+
20+
variable "kubernetes_nodepool_workspaces" {
21+
description = "Kubernetes nodepool for Coder workspaces"
22+
type = string
23+
default = "big-workspaces"
24+
}
25+
26+
data "coder_workspace" "me" {}
27+
28+
resource "coder_agent" "main" {
29+
os = "linux"
30+
arch = "amd64"
31+
startup_script_timeout = 180
32+
startup_script = ""
33+
}
34+
35+
resource "kubernetes_pod" "main" {
36+
count = data.coder_workspace.me.start_count
37+
metadata {
38+
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
39+
namespace = "coder-big"
40+
labels = {
41+
"app.kubernetes.io/name" = "coder-workspace"
42+
"app.kubernetes.io/instance" = "coder-workspace-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
43+
}
44+
}
45+
spec {
46+
security_context {
47+
run_as_user = "1000"
48+
fs_group = "1000"
49+
}
50+
container {
51+
name = "dev"
52+
image = "docker.io/codercom/enterprise-minimal:ubuntu"
53+
image_pull_policy = "Always"
54+
command = ["sh", "-c", coder_agent.main.init_script]
55+
security_context {
56+
run_as_user = "1000"
57+
}
58+
env {
59+
name = "CODER_AGENT_TOKEN"
60+
value = coder_agent.main.token
61+
}
62+
resources {
63+
requests = {
64+
"cpu" = "4"
65+
"memory" = "4Gi"
66+
}
67+
limits = {
68+
"cpu" = "4"
69+
"memory" = "4Gi"
70+
}
71+
}
72+
}
73+
74+
affinity {
75+
node_affinity {
76+
required_during_scheduling_ignored_during_execution {
77+
node_selector_term {
78+
match_expressions {
79+
key = "cloud.google.com/gke-nodepool"
80+
operator = "In"
81+
values = ["${var.kubernetes_nodepool_workspaces}"]
82+
}
83+
}
84+
}
85+
}
86+
}
87+
}
88+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# kubernetes-medium-greedy
2+
3+
Provisions a medium-sized workspace with no persistent storage. Greedy agent variant.
4+
5+
_Note_: It is assumed you will be running workspaces on a dedicated GKE nodepool.
6+
By default, this template sets a node affinity of `cloud.google.com/gke-nodepool` = `big-workspaces`.
7+
The nodepool affinity can be customized with the variable `kubernetes_nodepool_workspaces`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
terraform {
2+
required_providers {
3+
coder = {
4+
source = "coder/coder"
5+
version = "~> 0.7.0"
6+
}
7+
kubernetes = {
8+
source = "hashicorp/kubernetes"
9+
version = "~> 2.18"
10+
}
11+
}
12+
}
13+
14+
provider "coder" {}
15+
16+
provider "kubernetes" {
17+
config_path = null # always use host
18+
}
19+
20+
variable "kubernetes_nodepool_workspaces" {
21+
description = "Kubernetes nodepool for Coder workspaces"
22+
type = string
23+
default = "big-workspaces"
24+
}
25+
26+
data "coder_workspace" "me" {}
27+
28+
resource "coder_agent" "main" {
29+
os = "linux"
30+
arch = "amd64"
31+
startup_script_timeout = 180
32+
startup_script = ""
33+
34+
# Greedy metadata (3072 bytes base64 encoded is 4097 bytes).
35+
metadata {
36+
display_name = "Meta 01"
37+
key = "01_meta"
38+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
39+
interval = 1
40+
timeout = 10
41+
}
42+
metadata {
43+
display_name = "Meta 02"
44+
key = "0_meta"
45+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
46+
interval = 1
47+
timeout = 10
48+
}
49+
metadata {
50+
display_name = "Meta 03"
51+
key = "03_meta"
52+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
53+
interval = 1
54+
timeout = 10
55+
}
56+
metadata {
57+
display_name = "Meta 04"
58+
key = "04_meta"
59+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
60+
interval = 1
61+
timeout = 10
62+
}
63+
metadata {
64+
display_name = "Meta 05"
65+
key = "05_meta"
66+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
67+
interval = 1
68+
timeout = 10
69+
}
70+
metadata {
71+
display_name = "Meta 06"
72+
key = "06_meta"
73+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
74+
interval = 1
75+
timeout = 10
76+
}
77+
metadata {
78+
display_name = "Meta 07"
79+
key = "07_meta"
80+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
81+
interval = 1
82+
timeout = 10
83+
}
84+
metadata {
85+
display_name = "Meta 08"
86+
key = "08_meta"
87+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
88+
interval = 1
89+
timeout = 10
90+
}
91+
metadata {
92+
display_name = "Meta 09"
93+
key = "09_meta"
94+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
95+
interval = 1
96+
timeout = 10
97+
}
98+
metadata {
99+
display_name = "Meta 10"
100+
key = "10_meta"
101+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
102+
interval = 1
103+
timeout = 10
104+
}
105+
metadata {
106+
display_name = "Meta 11"
107+
key = "11_meta"
108+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
109+
interval = 1
110+
timeout = 10
111+
}
112+
metadata {
113+
display_name = "Meta 12"
114+
key = "12_meta"
115+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
116+
interval = 1
117+
timeout = 10
118+
}
119+
metadata {
120+
display_name = "Meta 13"
121+
key = "13_meta"
122+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
123+
interval = 1
124+
timeout = 10
125+
}
126+
metadata {
127+
display_name = "Meta 14"
128+
key = "14_meta"
129+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
130+
interval = 1
131+
timeout = 10
132+
}
133+
metadata {
134+
display_name = "Meta 15"
135+
key = "15_meta"
136+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
137+
interval = 1
138+
timeout = 10
139+
}
140+
metadata {
141+
display_name = "Meta 16"
142+
key = "16_meta"
143+
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
144+
interval = 1
145+
timeout = 10
146+
}
147+
}
148+
149+
resource "kubernetes_pod" "main" {
150+
count = data.coder_workspace.me.start_count
151+
metadata {
152+
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
153+
namespace = "coder-big"
154+
labels = {
155+
"app.kubernetes.io/name" = "coder-workspace"
156+
"app.kubernetes.io/instance" = "coder-workspace-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
157+
}
158+
}
159+
spec {
160+
security_context {
161+
run_as_user = "1000"
162+
fs_group = "1000"
163+
}
164+
container {
165+
name = "dev"
166+
image = "docker.io/codercom/enterprise-minimal:ubuntu"
167+
image_pull_policy = "Always"
168+
command = ["sh", "-c", coder_agent.main.init_script]
169+
security_context {
170+
run_as_user = "1000"
171+
}
172+
env {
173+
name = "CODER_AGENT_TOKEN"
174+
value = coder_agent.main.token
175+
}
176+
resources {
177+
requests = {
178+
"cpu" = "2"
179+
"memory" = "2Gi"
180+
}
181+
limits = {
182+
"cpu" = "2"
183+
"memory" = "2Gi"
184+
}
185+
}
186+
}
187+
188+
affinity {
189+
node_affinity {
190+
required_during_scheduling_ignored_during_execution {
191+
node_selector_term {
192+
match_expressions {
193+
key = "cloud.google.com/gke-nodepool"
194+
operator = "In"
195+
values = ["${var.kubernetes_nodepool_workspaces}"]
196+
}
197+
}
198+
}
199+
}
200+
}
201+
}
202+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# kubernetes-medium
2+
3+
Provisions a medium-sized workspace with no persistent storage.
4+
5+
_Note_: It is assumed you will be running workspaces on a dedicated GKE nodepool.
6+
By default, this template sets a node affinity of `cloud.google.com/gke-nodepool` = `big-workspaces`.
7+
The nodepool affinity can be customized with the variable `kubernetes_nodepool_workspaces`.

0 commit comments

Comments
 (0)