Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: dynamic operator yaml #693

Merged
merged 6 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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