Skip to content

Commit

Permalink
feat!: dynamic operator yaml (#693)
Browse files Browse the repository at this point in the history
* feat: dynamic operator yaml

* typo

* add ACM submodule to upgrade guide

* fmt
  • Loading branch information
bharathkkb committed Jan 12, 2021
1 parent 0abbf41 commit b1cce30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 7 additions & 0 deletions docs/upgrading_to_v13.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@ module. This release adapts to this requirement.
+ version = "~> 13.0"
}
```

### ACM submodule `local_file` removed

[ACM submodule](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/master/modules/acm) no longer creates a local file called `operator_cr.yaml`.
The yaml contents are rendered dynamically and passed via STDIN which fixes errors due to `operator_cr.yaml` file not being present between ephemeral pipeline runs.

This is destructive and will result in deletion and recreation of the ACM operator.
11 changes: 3 additions & 8 deletions modules/k8s-operator-crd-support/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,18 @@ data "template_file" "k8sop_config" {
}
}

resource "local_file" "operator_cr" {
content = data.template_file.k8sop_config.rendered
filename = "${path.module}/${var.project_id}-${var.cluster_name}/operator_cr.yaml"
}

module "k8sop_config" {
source = "terraform-google-modules/gcloud/google//modules/kubectl-wrapper"
version = "~> 2.0.2"
module_depends_on = [module.k8s_operator.wait, module.k8sop_creds_secret.wait]
cluster_name = var.cluster_name
cluster_location = var.location
project_id = var.project_id
create_cmd_triggers = { configmanagement = local_file.operator_cr.content }
create_cmd_triggers = { configmanagement = data.template_file.k8sop_config.rendered }
service_account_key_file = var.service_account_key_file

kubectl_create_command = "kubectl apply -f ${local_file.operator_cr.filename}"
kubectl_destroy_command = "kubectl delete -f ${local_file.operator_cr.filename}"
kubectl_create_command = "kubectl apply -f - <<EOF\n${data.template_file.k8sop_config.rendered}EOF"
kubectl_destroy_command = "kubectl delete -f - <<EOF\n${data.template_file.k8sop_config.rendered}EOF"
}

module "wait_for_gatekeeper" {
Expand Down

0 comments on commit b1cce30

Please sign in to comment.