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

Add Kubernetes Metrics Server #17

Open
lesha1201 opened this issue Mar 14, 2024 · 0 comments
Open

Add Kubernetes Metrics Server #17

lesha1201 opened this issue Mar 14, 2024 · 0 comments

Comments

@lesha1201
Copy link

lesha1201 commented Mar 14, 2024

We need to add ability to enable Kubernetes Metrics server if needed.

Example of the code:

data "http" "metrics_server_manifest" {
  url = "https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml"

  lifecycle {
    postcondition {
      condition     = contains([200, 201, 204], self.status_code)
      error_message = "Invalid status code for ${self.url}."
    }
  }
}

locals {
  metrics_server_resources_raw = split("\n---\n", data.http.metrics_server_manifest.response_body)
  metrics_server_resources = [
    for rawContent in local.metrics_server_resources_raw : yamldecode(rawContent)
  ]
}

resource "kubernetes_manifest" "metrics_server" {
  for_each = { for item in local.metrics_server_resources : item.metadata.name => item }

  manifest = each.value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant