Skip to content
This repository was archived by the owner on Dec 16, 2020. It is now read-only.

Commit 1bd61be

Browse files
authored
Merge pull request #41 from bhegazy/tiller-listen-localhost
Add option tiller_listen_localhost to to disable listen localhost
2 parents 2e27da0 + d9ab2f5 commit 1bd61be

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defaults: &defaults
88
KUBERGRUNT_VERSION: v0.5.1
99
HELM_VERSION: v2.12.2
1010
MODULE_CI_VERSION: v0.14.1
11-
TERRAFORM_VERSION: 0.12.1
11+
TERRAFORM_VERSION: 0.12.9
1212
TERRAGRUNT_VERSION: NONE
1313
PACKER_VERSION: NONE
1414
GOLANG_VERSION: 1.11.2

examples/k8s-tiller-kubergrunt-minikube/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ resource "null_resource" "wait_for_tiller" {
110110
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111111

112112
resource "null_resource" "grant_helm_access" {
113-
count = var.configure_helm ? 1 : 0
113+
count = var.configure_helm ? 1 : 0
114114
depends_on = [null_resource.wait_for_tiller]
115115

116116
provisioner "local-exec" {

modules/k8s-tiller/main.tf

+8-7
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,12 @@ resource "kubernetes_deployment" "tiller" {
8787
image_pull_policy = var.tiller_image_pull_policy
8888
command = ["/tiller"]
8989

90-
args = [
90+
args = concat([
9191
"--storage=secret",
92-
"--listen=localhost:44134",
9392
"--tls-key=${local.tls_certs_mount_path}/${var.tiller_tls_key_file_name}",
9493
"--tls-cert=${local.tls_certs_mount_path}/${var.tiller_tls_cert_file_name}",
9594
"--tls-ca-cert=${local.tls_certs_mount_path}/${var.tiller_tls_cacert_file_name}",
96-
]
95+
], local.tiller_listen_localhost_arg)
9796

9897
env {
9998
name = "TILLER_NAMESPACE"
@@ -264,8 +263,8 @@ resource "null_resource" "tiller_tls_ca_certs" {
264263
# Use environment variables for Kubernetes credentials to avoid leaking into the logs
265264
environment = {
266265
KUBECTL_SERVER_ENDPOINT = var.kubectl_server_endpoint
267-
KUBECTL_CA_DATA = var.kubectl_ca_b64_data
268-
KUBECTL_TOKEN = var.kubectl_token
266+
KUBECTL_CA_DATA = var.kubectl_ca_b64_data
267+
KUBECTL_TOKEN = var.kubectl_token
269268
}
270269
}
271270

@@ -318,8 +317,8 @@ resource "null_resource" "tiller_tls_certs" {
318317
# Use environment variables for Kubernetes credentials to avoid leaking into the logs
319318
environment = {
320319
KUBECTL_SERVER_ENDPOINT = var.kubectl_server_endpoint
321-
KUBECTL_CA_DATA = var.kubectl_ca_b64_data
322-
KUBECTL_TOKEN = var.kubectl_token
320+
KUBECTL_CA_DATA = var.kubectl_ca_b64_data
321+
KUBECTL_TOKEN = var.kubectl_token
323322
}
324323
}
325324

@@ -430,6 +429,8 @@ locals {
430429
tiller_tls_ca_certs_secret_name = "${var.namespace}-namespace-tiller-ca-certs"
431430
tiller_tls_certs_secret_name = "${var.namespace}-namespace-tiller-certs"
432431

432+
tiller_listen_localhost_arg = var.tiller_listen_localhost ? ["--listen=localhost:44134"] : []
433+
433434
tls_algorithm_config = var.private_key_algorithm == "ECDSA" ? "--tls-private-key-ecdsa-curve ${var.private_key_ecdsa_curve}" : "--tls-private-key-rsa-bits ${var.private_key_rsa_bits}"
434435

435436
kubergrunt_auth_params = <<-EOF

modules/k8s-tiller/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ variable "tiller_image_pull_policy" {
8888
default = "IfNotPresent"
8989
}
9090

91+
variable "tiller_listen_localhost" {
92+
description = "If Enabled, Tiller will only listen on localhost within the container."
93+
type = bool
94+
default = true
95+
}
96+
9197
variable "tiller_history_max" {
9298
description = "The maximum number of revisions saved per release. Use 0 for no limit."
9399
type = number

0 commit comments

Comments
 (0)