This commit is contained in:
parent
a84551d34d
commit
335edaab18
@ -12,7 +12,7 @@ steps:
|
||||
CODER_TEMPLATE_VERSION: $${DRONE_COMMIT_SHA}
|
||||
commands:
|
||||
- apk add git
|
||||
- wget -O- https://github.com/coder/coder/releases/download/v0.11.0/coder_0.11.0_linux_amd64.tar.gz | tar -xzf - -C /usr/local/bin ./coder
|
||||
- wget -q -O- https://github.com/coder/coder/releases/download/v0.11.0/coder_0.11.0_linux_amd64.tar.gz | tar -xzf - -C /usr/local/bin ./coder
|
||||
- |
|
||||
for template in * ; do
|
||||
[ -e "$template/main.tf" ] || continue
|
||||
|
||||
@ -11,39 +11,13 @@ terraform {
|
||||
}
|
||||
}
|
||||
|
||||
variable "use_kubeconfig" {
|
||||
type = bool
|
||||
sensitive = 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
|
||||
Kubernetes cluster as you are deploying workspaces to.
|
||||
|
||||
Set this to true if the Coder host is running outside the Kubernetes cluster
|
||||
for workspaces. A valid "~/.kube/config" must be present on the Coder host.
|
||||
EOF
|
||||
}
|
||||
|
||||
variable "namespace" {
|
||||
type = string
|
||||
sensitive = true
|
||||
description = "The namespace to create workspaces in (must exist prior to creating workspaces)"
|
||||
}
|
||||
|
||||
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."
|
||||
}
|
||||
}
|
||||
|
||||
provider "kubernetes" {
|
||||
# Authenticate via ~/.kube/config or a Coder-specific ServiceAccount, depending on admin preferences
|
||||
config_path = var.use_kubeconfig == true ? "~/.kube/config" : null
|
||||
config_path = null
|
||||
}
|
||||
|
||||
provider "coder" {
|
||||
url = "http://coder.coder.svc.cluster.local"
|
||||
}
|
||||
|
||||
data "coder_workspace" "me" {}
|
||||
@ -87,14 +61,14 @@ resource "coder_app" "code-server" {
|
||||
resource "kubernetes_persistent_volume_claim" "home" {
|
||||
metadata {
|
||||
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}-home"
|
||||
namespace = var.namespace
|
||||
namespace = "coder"
|
||||
}
|
||||
wait_until_bound = false
|
||||
spec {
|
||||
access_modes = ["ReadWriteOnce"]
|
||||
resources {
|
||||
requests = {
|
||||
storage = "${var.home_disk_size}Gi"
|
||||
storage = "10Gi"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -104,7 +78,7 @@ 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
|
||||
namespace = "coder"
|
||||
}
|
||||
spec {
|
||||
security_context {
|
||||
|
||||
@ -11,39 +11,13 @@ terraform {
|
||||
}
|
||||
}
|
||||
|
||||
variable "use_kubeconfig" {
|
||||
type = bool
|
||||
sensitive = 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
|
||||
Kubernetes cluster as you are deploying workspaces to.
|
||||
|
||||
Set this to true if the Coder host is running outside the Kubernetes cluster
|
||||
for workspaces. A valid "~/.kube/config" must be present on the Coder host.
|
||||
EOF
|
||||
}
|
||||
|
||||
variable "namespace" {
|
||||
type = string
|
||||
sensitive = true
|
||||
description = "The namespace to create workspaces in (must exist prior to creating workspaces)"
|
||||
}
|
||||
|
||||
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."
|
||||
}
|
||||
}
|
||||
|
||||
provider "kubernetes" {
|
||||
# Authenticate via ~/.kube/config or a Coder-specific ServiceAccount, depending on admin preferences
|
||||
config_path = var.use_kubeconfig == true ? "~/.kube/config" : null
|
||||
config_path = null
|
||||
}
|
||||
|
||||
provider "coder" {
|
||||
url = "http://coder.coder.svc.cluster.local"
|
||||
}
|
||||
|
||||
data "coder_workspace" "me" {}
|
||||
@ -87,14 +61,14 @@ resource "coder_app" "code-server" {
|
||||
resource "kubernetes_persistent_volume_claim" "home" {
|
||||
metadata {
|
||||
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}-home"
|
||||
namespace = var.namespace
|
||||
namespace = "coder"
|
||||
}
|
||||
wait_until_bound = false
|
||||
spec {
|
||||
access_modes = ["ReadWriteOnce"]
|
||||
resources {
|
||||
requests = {
|
||||
storage = "${var.home_disk_size}Gi"
|
||||
storage = "10Gi"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -104,7 +78,7 @@ 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
|
||||
namespace = "coder"
|
||||
}
|
||||
spec {
|
||||
security_context {
|
||||
|
||||
Reference in New Issue
Block a user