Skip to content

docs: use scale testing utility #12643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,9 @@ jobs:
- name: Setup sqlc
uses: ./.github/actions/setup-sqlc

- name: make gen
run: "make --output-sync -j -B gen"

- name: Format
run: |
cd offlinedocs
Expand Down
288 changes: 153 additions & 135 deletions docs/admin/scale.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions scaletest/templates/kubernetes-large/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# kubernetes-large

Provisions a large-sized workspace with no persistent storage.

_Note_: It is assumed you will be running workspaces on a dedicated GKE nodepool.
By default, this template sets a node affinity of `cloud.google.com/gke-nodepool` = `big-workspaces`.
The nodepool affinity can be customized with the variable `kubernetes_nodepool_workspaces`.
88 changes: 88 additions & 0 deletions scaletest/templates/kubernetes-large/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
terraform {
required_providers {
coder = {
source = "coder/coder"
version = "~> 0.7.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.18"
}
}
}

provider "coder" {}

provider "kubernetes" {
config_path = null # always use host
}

variable "kubernetes_nodepool_workspaces" {
description = "Kubernetes nodepool for Coder workspaces"
type = string
default = "big-workspaces"
}

data "coder_workspace" "me" {}

resource "coder_agent" "main" {
os = "linux"
arch = "amd64"
startup_script_timeout = 180
startup_script = ""
}

resource "kubernetes_pod" "main" {
count = data.coder_workspace.me.start_count
metadata {
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
namespace = "coder-big"
labels = {
"app.kubernetes.io/name" = "coder-workspace"
"app.kubernetes.io/instance" = "coder-workspace-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
}
}
spec {
security_context {
run_as_user = "1000"
fs_group = "1000"
}
container {
name = "dev"
image = "docker.io/codercom/enterprise-minimal:ubuntu"
image_pull_policy = "Always"
command = ["sh", "-c", coder_agent.main.init_script]
security_context {
run_as_user = "1000"
}
env {
name = "CODER_AGENT_TOKEN"
value = coder_agent.main.token
}
resources {
requests = {
"cpu" = "4"
"memory" = "4Gi"
}
limits = {
"cpu" = "4"
"memory" = "4Gi"
}
}
}

affinity {
node_affinity {
required_during_scheduling_ignored_during_execution {
node_selector_term {
match_expressions {
key = "cloud.google.com/gke-nodepool"
operator = "In"
values = ["${var.kubernetes_nodepool_workspaces}"]
}
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions scaletest/templates/kubernetes-medium-greedy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# kubernetes-medium-greedy

Provisions a medium-sized workspace with no persistent storage. Greedy agent variant.

_Note_: It is assumed you will be running workspaces on a dedicated GKE nodepool.
By default, this template sets a node affinity of `cloud.google.com/gke-nodepool` = `big-workspaces`.
The nodepool affinity can be customized with the variable `kubernetes_nodepool_workspaces`.
202 changes: 202 additions & 0 deletions scaletest/templates/kubernetes-medium-greedy/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
terraform {
required_providers {
coder = {
source = "coder/coder"
version = "~> 0.7.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.18"
}
}
}

provider "coder" {}

provider "kubernetes" {
config_path = null # always use host
}

variable "kubernetes_nodepool_workspaces" {
description = "Kubernetes nodepool for Coder workspaces"
type = string
default = "big-workspaces"
}

data "coder_workspace" "me" {}

resource "coder_agent" "main" {
os = "linux"
arch = "amd64"
startup_script_timeout = 180
startup_script = ""

# Greedy metadata (3072 bytes base64 encoded is 4097 bytes).
metadata {
display_name = "Meta 01"
key = "01_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 02"
key = "0_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 03"
key = "03_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 04"
key = "04_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 05"
key = "05_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 06"
key = "06_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 07"
key = "07_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 08"
key = "08_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 09"
key = "09_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 10"
key = "10_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 11"
key = "11_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 12"
key = "12_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 13"
key = "13_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 14"
key = "14_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 15"
key = "15_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
metadata {
display_name = "Meta 16"
key = "16_meta"
script = "dd if=/dev/urandom bs=3072 count=1 status=none | base64"
interval = 1
timeout = 10
}
}

resource "kubernetes_pod" "main" {
count = data.coder_workspace.me.start_count
metadata {
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
namespace = "coder-big"
labels = {
"app.kubernetes.io/name" = "coder-workspace"
"app.kubernetes.io/instance" = "coder-workspace-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
}
}
spec {
security_context {
run_as_user = "1000"
fs_group = "1000"
}
container {
name = "dev"
image = "docker.io/codercom/enterprise-minimal:ubuntu"
image_pull_policy = "Always"
command = ["sh", "-c", coder_agent.main.init_script]
security_context {
run_as_user = "1000"
}
env {
name = "CODER_AGENT_TOKEN"
value = coder_agent.main.token
}
resources {
requests = {
"cpu" = "2"
"memory" = "2Gi"
}
limits = {
"cpu" = "2"
"memory" = "2Gi"
}
}
}

affinity {
node_affinity {
required_during_scheduling_ignored_during_execution {
node_selector_term {
match_expressions {
key = "cloud.google.com/gke-nodepool"
operator = "In"
values = ["${var.kubernetes_nodepool_workspaces}"]
}
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions scaletest/templates/kubernetes-medium/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# kubernetes-medium

Provisions a medium-sized workspace with no persistent storage.

_Note_: It is assumed you will be running workspaces on a dedicated GKE nodepool.
By default, this template sets a node affinity of `cloud.google.com/gke-nodepool` = `big-workspaces`.
The nodepool affinity can be customized with the variable `kubernetes_nodepool_workspaces`.
Loading