Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(templates): add resources to k8s example templates#6310

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
johnstcn wants to merge1 commit intomainfromcj/k8s-templates-resources-requests
Closed
Show file tree
Hide file tree
Changes fromall 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
34 changes: 33 additions & 1 deletionexamples/templates/kubernetes-with-podman/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,36 @@ variable "os" {
default = "ubuntu"
}

variable "cpus" {
type = number
description = "How many CPUs would you like your workspace to have?"
default = 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

take with a grain of salt but IMO 1-2 cores might be better as a default.

validation {
condition = var.cpus > 0
error_message = "Value must be greater than 0."
}
}

variable "memory" {
type = number
description = "How much memory would you like your workspace to have (in GiB)?"
default = 4
validation {
condition = var.memory > 0
error_message = "Value must be greater than 0."
}
}

variable "home_disk_size" {
type = number
description = "How large would you like your home volume to be (in GB)?"
default = 10
validation {
condition = var.home_disk_size >= 1
error_message = "Value must be greater than or equal to 1."
}
}

resource "coder_agent" "dev" {
os = "linux"
arch = "amd64"
Expand DownExpand Up@@ -112,7 +142,9 @@ resource "kubernetes_persistent_volume_claim" "home-directory" {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = "10Gi"
cpus = "${var.cpus}"
memory = "${var.memory}Gi"
storage = "${var.home_disk_size}Gi"
}
}
}
Expand Down
22 changes: 22 additions & 0 deletionsexamples/templates/kubernetes/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,26 @@ variable "namespace" {
description = "The Kubernetes namespace to create workspaces in (must exist prior to creating workspaces)"
}

variable "cpus" {
type = number
description = "How many CPUs would you like your workspace to have?"
default = 4
validation {
condition = var.cpus > 0
error_message = "Value must be greater than 0."
}
}

variable "memory" {
type = number
description = "How much memory would you like your workspace to have (in GiB)?"
default = 4
validation {
condition = var.memory > 0
error_message = "Value must be greater than 0."
}
}

variable "home_disk_size" {
type = number
description = "How large would you like your home volume to be (in GB)?"
Expand DownExpand Up@@ -104,6 +124,8 @@ resource "kubernetes_persistent_volume_claim" "home" {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
cpus = "${var.cpus}"
memory = "${var.memory}Gi"
storage = "${var.home_disk_size}Gi"
}
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp