mirror of
https://github.com/coder/coder.git
synced 2026-09-21 12:44:32 +08:00
chore: update legacy parameters in envbox template (#7898)
This commit is contained in:
@@ -27,6 +27,20 @@ The following environment variables can be used to configure various aspects of
|
||||
| `CODER_CPUS` | Dictates the number of CPUs to allocate the inner container. It is recommended to set this using the Kubernetes [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-container-fields-as-values-for-environment-variables). | false |
|
||||
| `CODER_MEMORY` | Dictates the max memory (in bytes) to allocate the inner container. It is recommended to set this using the Kubernetes [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-container-fields-as-values-for-environment-variables). | false |
|
||||
|
||||
# Migrating Existing Envbox Templates
|
||||
|
||||
Due to the [deprecation and removal of legacy parameters](https://coder.com/docs/v2/latest/templates/parameters#legacy)
|
||||
it may be necessary to migrate existing envbox templates on newer versions of
|
||||
Coder. Consult the [migration](https://coder.com/docs/v2/latest/templates/parameters#migration)
|
||||
documentation for details on how to do so.
|
||||
|
||||
To supply values to existing existing Terraform variables you can specify the
|
||||
`--variable` flag. For example
|
||||
|
||||
```bash
|
||||
coder templates create envbox --variable namespace="mynamespace" --variable max_cpus=2 --variable min_cpus=1 --variable max_memory=4 --variable min_memory=1
|
||||
```
|
||||
|
||||
## Contributions
|
||||
|
||||
Contributions are welcome and can be made against the [envbox repo](https://github.com/coder/envbox).
|
||||
|
||||
@@ -27,6 +27,7 @@ data "coder_parameter" "home_disk" {
|
||||
variable "use_kubeconfig" {
|
||||
type = bool
|
||||
sensitive = true
|
||||
default = true
|
||||
description = <<-EOF
|
||||
Use host kubeconfig? (true/false)
|
||||
Set this to false if the Coder host is itself running as a Pod on the same
|
||||
@@ -36,6 +37,10 @@ variable "use_kubeconfig" {
|
||||
EOF
|
||||
}
|
||||
|
||||
provider "coder" {
|
||||
feature_use_managed_variables = "true"
|
||||
}
|
||||
|
||||
variable "namespace" {
|
||||
type = string
|
||||
sensitive = true
|
||||
@@ -46,12 +51,14 @@ variable "create_tun" {
|
||||
type = bool
|
||||
sensitive = true
|
||||
description = "Add a TUN device to the workspace."
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "create_fuse" {
|
||||
type = bool
|
||||
description = "Add a FUSE device to the workspace."
|
||||
sensitive = true
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "max_cpus" {
|
||||
@@ -138,11 +145,15 @@ resource "kubernetes_persistent_volume_claim" "home" {
|
||||
|
||||
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 = var.namespace
|
||||
}
|
||||
|
||||
spec {
|
||||
restart_policy = "Never"
|
||||
|
||||
container {
|
||||
name = "dev"
|
||||
image = "ghcr.io/coder/envbox:latest"
|
||||
|
||||
Reference in New Issue
Block a user