From 335edaab183e5104b3a4e511f5af724b6db058a8 Mon Sep 17 00:00:00 2001 From: Steve McMaster Date: Sat, 5 Nov 2022 12:32:24 -0400 Subject: [PATCH] updates --- .drone.yml | 2 +- android/main.tf | 42 ++++++++---------------------------------- python/main.tf | 42 ++++++++---------------------------------- 3 files changed, 17 insertions(+), 69 deletions(-) diff --git a/.drone.yml b/.drone.yml index f738b7b..8bc05e9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 diff --git a/android/main.tf b/android/main.tf index e1d3044..2acb2fb 100644 --- a/android/main.tf +++ b/android/main.tf @@ -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 { diff --git a/python/main.tf b/python/main.tf index a9ba62a..f7f69ca 100644 --- a/python/main.tf +++ b/python/main.tf @@ -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 {