Skip to content

Commit 6813e0b

Browse files
Fix/kubernetes devcontainer template to require fewer updates on initial deployment (#386)
Co-authored-by: greg-the-coder <[email protected]> Co-authored-by: Atif Ali <[email protected]>
1 parent 9e47369 commit 6813e0b

File tree

1 file changed

+23
-19
lines changed
  • registry/coder/templates/kubernetes-devcontainer

1 file changed

+23
-19
lines changed

registry/coder/templates/kubernetes-devcontainer/main.tf

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ variable "use_kubeconfig" {
4040

4141
variable "namespace" {
4242
type = string
43-
default = "default"
43+
default = "coder"
4444
description = "The Kubernetes namespace to create workspaces in (must exist prior to creating workspaces). If the Coder host is itself running as a Pod on the same Kubernetes cluster as you are deploying workspaces to, set this to the same namespace."
4545
}
4646

@@ -62,7 +62,7 @@ data "coder_parameter" "cpu" {
6262
display_name = "CPU"
6363
description = "CPU limit (cores)."
6464
default = "2"
65-
icon = "/emojis/1f5a5.png"
65+
icon = "/icon/memory.svg"
6666
mutable = true
6767
validation {
6868
min = 1
@@ -161,6 +161,8 @@ locals {
161161
# ENVBUILDER_GIT_URL and ENVBUILDER_CACHE_REPO will be overridden by the provider
162162
# if the cache repo is enabled.
163163
"ENVBUILDER_GIT_URL" : var.cache_repo == "" ? local.repo_url : "",
164+
# Used for when SSH is an available authentication mechanism for git providers
165+
"ENVBUILDER_GIT_SSH_PRIVATE_KEY_BASE64" : base64encode(try(data.coder_workspace_owner.me.ssh_private_key, "")),
164166
# Use the docker gateway if the access URL is 127.0.0.1
165167
"ENVBUILDER_INIT_SCRIPT" : replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal"),
166168
"ENVBUILDER_FALLBACK_IMAGE" : data.coder_parameter.fallback_image.value,
@@ -263,8 +265,9 @@ resource "kubernetes_deployment" "main" {
263265
name = "dev"
264266
image = var.cache_repo == "" ? local.devcontainer_builder_image : envbuilder_cached_image.cached.0.image
265267
image_pull_policy = "Always"
266-
security_context {}
267-
268+
security_context {
269+
privileged = true
270+
}
268271
# Set the environment using cached_image.cached.0.env if the cache repo is enabled.
269272
# Otherwise, use the local.envbuilder_env.
270273
# You could alternatively write the environment variables to a ConfigMap or Secret
@@ -352,21 +355,22 @@ resource "coder_agent" "main" {
352355
# if you don't want to display any information.
353356
# For basic resources, you can use the `coder stat` command.
354357
# If you need more control, you can write your own script.
355-
metadata {
356-
display_name = "CPU Usage"
357-
key = "0_cpu_usage"
358-
script = "coder stat cpu"
359-
interval = 10
360-
timeout = 1
361-
}
362-
363-
metadata {
364-
display_name = "RAM Usage"
365-
key = "1_ram_usage"
366-
script = "coder stat mem"
367-
interval = 10
368-
timeout = 1
369-
}
358+
# Note: May not work on AWS Linux Nodes See: https://github.com/coder/clistat/issues/17
359+
# metadata {
360+
# display_name = "CPU Usage"
361+
# key = "0_cpu_usage"
362+
# script = "coder stat cpu"
363+
# interval = 10
364+
# timeout = 1
365+
# }
366+
# Note: May not work on AWS Linux Nodes
367+
# metadata {
368+
# display_name = "RAM Usage"
369+
# key = "1_ram_usage"
370+
# script = "coder stat mem"
371+
# interval = 10
372+
# timeout = 1
373+
# }
370374

371375
metadata {
372376
display_name = "Workspaces Disk"

0 commit comments

Comments
 (0)