Add oke and nlb to managed cluster

This commit is contained in:
2024-03-03 16:28:04 +01:00
parent 114f0ce3d5
commit 0ca08d2ac3
15 changed files with 231 additions and 9 deletions

8
oci-managed/nlb/data.tf Normal file
View File

@@ -0,0 +1,8 @@
data "oci_containerengine_cluster_kube_config" "cluster_kube_config" {
#Required
cluster_id = var.cluster_ocid
#Optional
endpoint = var.cluster_public_endpoint
token_version = "2.0.0"
}

View File

View File

@@ -0,0 +1,5 @@
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
}
}

View File

@@ -0,0 +1,20 @@
resource "helm_release" "traefik" {
namespace = "traefik-loadbalancer"
create_namespace = true
name = "traefik"
repository = "https://traefik.github.io/charts"
chart = "traefik"
version = var.traefik_chart_version
# Helm chart deployment can sometimes take longer than the default 5 minutes
timeout = var.timeout_seconds
# If values file specified by the var.values_file input variable exists then apply the values from this file
# else apply the default values from the chart
values = [fileexists("${path.root}/${var.values_file}") == true ? file("${path.root}/${var.values_file}") : ""]
set {
name = "deployment.replicas"
value = var.replica_count
}
}

View File

@@ -0,0 +1,41 @@
variable "compartment_ocid" {}
variable "environment" {
default = "prod"
}
variable "cluster_ocid" {
type = string
}
variable "cluster_public_endpoint" {
type = string
}
variable "namespace" {
description = "Namespace to install traefik chart into"
type = string
default = "traefik"
}
variable "traefik_chart_version" {
description = "Version of Traefik chart to install"
type = string
default = "21.1.0" # See https://artifacthub.io/packages/helm/traefik/traefik for latest version(s)
}
# Helm chart deployment can sometimes take longer than the default 5 minutes
variable "timeout_seconds" {
type = number
description = "Helm chart deployment can sometimes take longer than the default 5 minutes. Set a custom timeout here."
default = 800 # 10 minutes
}
variable "replica_count" {
description = "Number of replica pods to create"
type = number
default = 1
}
variable "values_file" {
description = "The name of the traefik helmchart values file to use"
type = string
default = "values.yaml"
}