- Notifications
You must be signed in to change notification settings - Fork1k
chore(examples): update devcontainer-{docker,kubernetes} to use computed env#14328
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -155,17 +155,23 @@ locals { | ||
repo_url = data.coder_parameter.repo.value | ||
# The envbuilder provider requires a key-value map of environment variables. | ||
envbuilder_env = { | ||
# ENVBUILDER_GIT_URL and ENVBUILDER_CACHE_REPO will be overridden by the provider | ||
# if the cache repo is enabled. | ||
"ENVBUILDER_GIT_URL" : local.repo_url, | ||
"ENVBUILDER_CACHE_REPO" : var.cache_repo, | ||
"CODER_AGENT_TOKEN" : coder_agent.main.token, | ||
# Use the docker gateway if the access URL is 127.0.0.1 | ||
"CODER_AGENT_URL" : replace(data.coder_workspace.me.access_url, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal"), | ||
# Use the docker gateway if the access URL is 127.0.0.1 | ||
"ENVBUILDER_INIT_SCRIPT" : replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal"), | ||
"ENVBUILDER_FALLBACK_IMAGE" : data.coder_parameter.fallback_image.value, | ||
"ENVBUILDER_DOCKER_CONFIG_BASE64" : try(data.kubernetes_secret.cache_repo_dockerconfig_secret[0].data[".dockerconfigjson"], ""), | ||
"ENVBUILDER_PUSH_IMAGE" : var.cache_repo == "" ? "" : "true", | ||
"ENVBUILDER_INSECURE" : "${var.insecure_cache_repo}", | ||
# You may need to adjust this if you get an error regarding deleting files when building the workspace. | ||
# For example, when testing in KinD, it was necessary to set `/product_name` and `/product_uuid` in | ||
# addition to `/var/run`. | ||
# "ENVBUILDER_IGNORE_PATHS": "/product_name,/product_uuid,/var/run", | ||
} | ||
} | ||
@@ -260,49 +266,19 @@ resource "kubernetes_deployment" "main" { | ||
image = var.cache_repo == "" ? local.devcontainer_builder_image : envbuilder_cached_image.cached.0.image | ||
image_pull_policy = "Always" | ||
security_context {} | ||
# Set the environment using cached_image.cached.0.env if the cache repo is enabled. | ||
# Otherwise, use the local.envbuilder_env. | ||
# You could alternatively write the environment variables to a ConfigMap or Secret | ||
# and use that as `env_from`. | ||
dynamic "env" { | ||
for_each = nonsensitive(var.cache_repo == "" ? local.envbuilder_env : envbuilder_cached_image.cached.0.env_map) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. review: apparently this is required to be able to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Yes. I previously used it here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This makes sense since | ||
content { | ||
name = env.key | ||
value = env.value | ||
} | ||
} | ||
resources { | ||
requests = { | ||
"cpu" = "250m" | ||