Skip to content

Commit

Permalink
on bharathkkb's good suggestion, now observe a skip_gcloud_download f…
Browse files Browse the repository at this point in the history
…rom the modules
  • Loading branch information
linde committed Apr 27, 2020
1 parent 3c4ea7e commit 418f9ae
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 14 deletions.
1 change: 1 addition & 0 deletions modules/acm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module "acm_operator" {
ssh_auth_key = var.ssh_auth_key
enable_policy_controller = var.enable_policy_controller
install_template_library = var.install_template_library
skip_gcloud_download = var.skip_gcloud_download

operator_latest_manifest_url = "gs://config-management-release/released/latest/config-management-operator.yaml"
operator_cr_template_path = "${path.module}/templates/acm-config.yml.tpl"
Expand Down
6 changes: 6 additions & 0 deletions modules/acm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ variable "install_template_library" {
type = bool
default = true
}

variable "skip_gcloud_download" {
description = "Whether to skip downloading gcloud (assumes gcloud and kubectl already available outside the module)"
type = bool
default = false
}
23 changes: 12 additions & 11 deletions modules/config-sync/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ module "configsync_operator" {

source = "../k8s-operator-crd-support"

cluster_name = var.cluster_name
project_id = var.project_id
location = var.location
operator_path = var.operator_path
sync_repo = var.sync_repo
sync_branch = var.sync_branch
policy_dir = var.policy_dir
cluster_endpoint = var.cluster_endpoint
create_ssh_key = var.create_ssh_key
secret_type = var.secret_type
ssh_auth_key = var.ssh_auth_key
cluster_name = var.cluster_name
project_id = var.project_id
location = var.location
operator_path = var.operator_path
sync_repo = var.sync_repo
sync_branch = var.sync_branch
policy_dir = var.policy_dir
cluster_endpoint = var.cluster_endpoint
create_ssh_key = var.create_ssh_key
secret_type = var.secret_type
ssh_auth_key = var.ssh_auth_key
skip_gcloud_download = var.skip_gcloud_download

operator_latest_manifest_url = "gs://config-management-release/released/latest/config-sync-operator.yaml"
operator_cr_template_path = "${path.module}/templates/config-sync-config.yml.tpl"
Expand Down
6 changes: 6 additions & 0 deletions modules/config-sync/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ variable "ssh_auth_key" {
type = string
default = null
}

variable "skip_gcloud_download" {
description = "Whether to skip downloading gcloud (assumes gcloud and kubectl already available outside the module)"
type = bool
default = false
}
10 changes: 7 additions & 3 deletions modules/k8s-operator-crd-support/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ data "google_client_config" "default" {
}

module "k8sop_manifest" {
source = "terraform-google-modules/gcloud/google"
version = "~> 0.5"
enabled = local.should_download_manifest
source = "terraform-google-modules/gcloud/google"
version = "~> 0.5"
enabled = local.should_download_manifest
skip_download = var.skip_gcloud_download

create_cmd_entrypoint = "gsutil"
create_cmd_body = "cp ${var.operator_latest_manifest_url} ${local.manifest_path}"
Expand All @@ -51,6 +52,7 @@ module "k8s_operator" {
version = "~> 0.5"
module_depends_on = [module.k8sop_manifest.wait, data.google_client_config.default.project, data.google_container_cluster.primary.name]
additional_components = ["kubectl"]
skip_download = var.skip_gcloud_download

create_cmd_entrypoint = "${path.module}/scripts/kubectl_wrapper.sh"
create_cmd_body = "${local.cluster_endpoint} ${local.token} ${local.cluster_ca_certificate} kubectl apply -f ${local.manifest_path}"
Expand All @@ -70,6 +72,7 @@ module "k8sop_creds_secret" {
version = "~> 0.5"
module_depends_on = [module.k8s_operator.wait]
additional_components = ["kubectl"]
skip_download = var.skip_gcloud_download

create_cmd_entrypoint = "${path.module}/scripts/kubectl_wrapper.sh"
create_cmd_body = "${local.cluster_endpoint} ${local.token} ${local.cluster_ca_certificate} kubectl create secret generic ${var.operator_credential_name} -n=${var.operator_credential_namespace} --from-literal=${local.k8sop_creds_secret_key}='${local.private_key}'"
Expand Down Expand Up @@ -97,6 +100,7 @@ module "k8sop_config" {
version = "~> 0.5"
module_depends_on = [module.k8s_operator.wait, module.k8sop_creds_secret.wait]
additional_components = ["kubectl"]
skip_download = var.skip_gcloud_download

create_cmd_entrypoint = "echo"
create_cmd_body = "'${data.template_file.k8sop_config.rendered}' | ${path.module}/scripts/kubectl_wrapper.sh ${local.cluster_endpoint} ${local.token} ${local.cluster_ca_certificate} kubectl apply -f -"
Expand Down
7 changes: 7 additions & 0 deletions modules/k8s-operator-crd-support/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,10 @@ variable "operator_cr_template_path" {
description = "path to template file to use for the operator"
type = string
}

variable "skip_gcloud_download" {
description = "Whether to skip downloading gcloud (assumes gcloud and kubectl already available outside the module)"
type = bool
default = false
}

0 comments on commit 418f9ae

Please sign in to comment.