
locals {
  common-labels = {
    "vynil.solidite.fr/owner-name" = var.instance
    "vynil.solidite.fr/owner-namespace" = var.namespace
    "vynil.solidite.fr/owner-category" = var.category
    "vynil.solidite.fr/owner-component" = var.component
    "app.kubernetes.io/managed-by" = "vynil"
    "app.kubernetes.io/name" = var.component
    "app.kubernetes.io/instance" = var.instance
  }
}

data "kustomization_overlay" "data" {
  common_labels = local.common-labels
  resources = [for file in fileset(path.module, "*.yaml"): file if file != "index.yaml"]
  images {
    name = "quay.io/kubevirt/cdi-apiserver"
    new_name = "${var.images.apiserver.registry}/${var.images.apiserver.repository}"
    new_tag = "${var.images.apiserver.tag}"
  }
  images {
    name = "quay.io/kubevirt/cdi-controller"
    new_name = "${var.images.controller.registry}/${var.images.controller.repository}"
    new_tag = "${var.images.controller.tag}"
  }
  images {
    name = "quay.io/kubevirt/cdi-uploadproxy"
    new_name = "${var.images.uploadproxy.registry}/${var.images.uploadproxy.repository}"
    new_tag = "${var.images.uploadproxy.tag}"
  }
}
