diff --git a/existing/terraform/azure/externaldns.tf b/existing/terraform/azure/externaldns.tf new file mode 100644 index 0000000..e69de29 diff --git a/existing/terraform/azure/variables.tf b/existing/terraform/azure/variables.tf new file mode 100644 index 0000000..93969dc --- /dev/null +++ b/existing/terraform/azure/variables.tf @@ -0,0 +1,7 @@ +variable "cluster_name" { + type = string +} + +variable "resource_group" { + type = string +} \ No newline at end of file diff --git a/existing/terraform/azure/versions.tf b/existing/terraform/azure/versions.tf new file mode 100644 index 0000000..0151ed6 --- /dev/null +++ b/existing/terraform/azure/versions.tf @@ -0,0 +1,55 @@ +terraform { + required_version = ">=1.3" + +# backend "azurerm" { +# storage_account_name = "{{ .Context.StorageAccount }}" +# resource_group_name = "{{ .Project }}" +# container_name = "{{ .Bucket }}" +# key = "{{ .Cluster }}/bootstrap/terraform.tfstate" +# } + + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = ">=3.51.0, < 4.0" + } + kubernetes = { + source = "hashicorp/kubernetes" + version = ">= 2.10" + } + helm = { + source = "hashicorp/helm" + version = "2.12.1" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +data "azurerm_kubernetes_cluster" "cluster" { + name = var.cluster_name + resource_group_name = var.resource_group +} + +provider "kubernetes" { + host = data.azurerm_kubernetes_cluster.cluster.kube_config[0].host + client_certificate = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].client_certificate) + client_key = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].client_key) + cluster_ca_certificate = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].cluster_ca_certificate) +} + + +provider "helm" { + kubernetes { + host = data.azurerm_kubernetes_cluster.cluster.kube_config[0].host + client_certificate = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].client_certificate) + client_key = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].client_key) + cluster_ca_certificate = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].cluster_ca_certificate) + } +} \ No newline at end of file diff --git a/resources/datadog/cluster.yaml b/resources/datadog/cluster.yaml new file mode 100644 index 0000000..550deec --- /dev/null +++ b/resources/datadog/cluster.yaml @@ -0,0 +1,7 @@ +apiVersion: deployments.plural.sh/v1alpha1 +kind: Cluster +metadata: + name: mgmt + namespace: datadog +spec: + handle: mgmt \ No newline at end of file diff --git a/resources/datadog/helmrepository.yaml b/resources/datadog/helmrepository.yaml new file mode 100644 index 0000000..3c0cd0f --- /dev/null +++ b/resources/datadog/helmrepository.yaml @@ -0,0 +1,7 @@ +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: HelmRepository +metadata: + name: datadog +spec: + interval: 5m0s + url: https://helm.datadoghq.com diff --git a/resources/datadog/secret.yaml b/resources/datadog/secret.yaml new file mode 100644 index 0000000..c3ade79 --- /dev/null +++ b/resources/datadog/secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: datadog-api-key + namespace: datadog +stringData: + api-key: "{{ configuration.apiKey }}" \ No newline at end of file diff --git a/resources/datadog/servicedeployment.yaml b/resources/datadog/servicedeployment.yaml new file mode 100644 index 0000000..aea2492 --- /dev/null +++ b/resources/datadog/servicedeployment.yaml @@ -0,0 +1,20 @@ +apiVersion: deployments.plural.sh/v1alpha1 +kind: ServiceDeployment +metadata: + name: datadog + namespace: datadog +spec: + namespace: datadog + helm: + version: 3.x.x + chart: datadog + values: + datadog: + apiKeyExistingSecret: datadog-api-key + repository: + name: datadog + namespace: datadog + clusterRef: + kind: Cluster + name: mgmt + namespace: datadog \ No newline at end of file