Skip to content

Commit

Permalink
Fix output_kubernetes_config
Browse files Browse the repository at this point in the history
  • Loading branch information
powellchristoph authored and remche committed Mar 2, 2022
1 parent ca2f4b0 commit 1920131
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
14 changes: 7 additions & 7 deletions examples/jupyterhub-gpu/main.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module "controlplane" {
source = "remche/rke2/openstack"
write_kubeconfig = true
image_name = "fg-services-ubuntu-20.04-x86_64.raw"
flavor_name = "m1.large-2d"
public_net_name = "public"
rke2_config = file("server.yaml")
manifests_path = "./manifests"
source = "remche/rke2/openstack"
write_kubeconfig = true
image_name = "fg-services-ubuntu-20.04-x86_64.raw"
flavor_name = "m1.large-2d"
public_net_name = "public"
rke2_config = file("server.yaml")
manifests_path = "./manifests"
# Fix for https://github.com/rancher/rke2/issues/1113
additional_san = ["kubernetes.default.svc"]
}
Expand Down
12 changes: 12 additions & 0 deletions kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,37 @@ module "host" {
version = "1.5.0"
count = var.output_kubernetes_config ? 1 : 0
command = "${local.ssh} ${var.system_user}@${module.server.floating_ip[0]} sudo KUBECONFIG=/etc/rancher/rke2/rke2-remote.yaml /var/lib/rancher/rke2/bin/kubectl config view --raw=true -o jsonpath='{.clusters[0].cluster.server}'"
depends_on = [
null_resource.write_kubeconfig
]
}

module "client_certificate" {
source = "matti/resource/shell"
version = "1.5.0"
count = var.output_kubernetes_config ? 1 : 0
command = "${local.ssh} ${var.system_user}@${module.server.floating_ip[0]} sudo KUBECONFIG=/etc/rancher/rke2/rke2-remote.yaml /var/lib/rancher/rke2/bin/kubectl config view --raw=true -o jsonpath='{.users[0].user.client-certificate-data}'"
depends_on = [
null_resource.write_kubeconfig
]
}

module "client_key" {
source = "matti/resource/shell"
version = "1.5.0"
count = var.output_kubernetes_config ? 1 : 0
command = "${local.ssh} ${var.system_user}@${module.server.floating_ip[0]} sudo KUBECONFIG=/etc/rancher/rke2/rke2-remote.yaml /var/lib/rancher/rke2/bin/kubectl config view --raw=true -o jsonpath='{.users[0].user.client-key-data}'"
depends_on = [
null_resource.write_kubeconfig
]
}

module "cluster_ca_certificate" {
source = "matti/resource/shell"
version = "1.5.0"
count = var.output_kubernetes_config ? 1 : 0
command = "${local.ssh} ${var.system_user}@${module.server.floating_ip[0]} sudo KUBECONFIG=/etc/rancher/rke2/rke2-remote.yaml /var/lib/rancher/rke2/bin/kubectl config view --raw=true -o jsonpath='{.clusters[0].cluster.certificate-authority-data}'"
depends_on = [
null_resource.write_kubeconfig
]
}
5 changes: 3 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ locals {
registries_conf = var.registries_conf
}
tmpdir = "${path.root}/.terraform/tmp/rke2"
ssh = "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
scp = "scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
ssh_key_arg = var.use_ssh_agent ? "" : "-i ${var.ssh_key_file}"
ssh = "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${local.ssh_key_arg}"
scp = "scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${local.ssh_key_arg}"
remote_rke2_yaml = "${var.system_user}@${module.server.floating_ip[0]}:/etc/rancher/rke2/rke2-remote.yaml"
}

Expand Down
8 changes: 4 additions & 4 deletions modules/agent/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ variable "do_upgrade" {
}

variable "boot_from_volume" {
type = bool
type = bool
default = false
}

variable "boot_volume_size" {
type = number
type = number
default = 20
}

variable "boot_volume_type" {
type = string
default= ""
type = string
default = ""
}

0 comments on commit 1920131

Please sign in to comment.