From 08e041ad6dad4a40e0776b07a0a983b22ec2f6bd Mon Sep 17 00:00:00 2001 From: Vargha Csongor Date: Sun, 7 Apr 2024 21:10:32 +0200 Subject: [PATCH] set longhorn as default storageclass --- oci-managed/oke/longhorn.tf | 17 ++++++++++++++++- oci-managed/oke/provider.tf | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/oci-managed/oke/longhorn.tf b/oci-managed/oke/longhorn.tf index 3ab0d55..5623d66 100644 --- a/oci-managed/oke/longhorn.tf +++ b/oci-managed/oke/longhorn.tf @@ -1,5 +1,5 @@ resource "helm_release" "longhorn" { - count = var.install_longhorn ? 1 : 0 + count = var.install_longhorn ? 1 : 0 namespace = "longhorn-system" create_namespace = true name = "longhorn" @@ -11,3 +11,18 @@ resource "helm_release" "longhorn" { # Helm chart deployment can sometimes take longer than the default 5 minutes timeout = var.timeout_seconds } + +resource "kubernetes_annotations" "patch_oci-bv" { + count = var.install_longhorn ? 1 : 0 + depends_on = [helm_release.longhorn] + api_version = "storage.k8s.io/v1" + kind = "StorageClass" + + metadata { + name = "oci-bv" + } + + annotations = { + "storageclass.kubernetes.io/is-default-class" = "false" + } +} diff --git a/oci-managed/oke/provider.tf b/oci-managed/oke/provider.tf index 213fa54..70212bf 100644 --- a/oci-managed/oke/provider.tf +++ b/oci-managed/oke/provider.tf @@ -8,5 +8,9 @@ terraform { source = "hashicorp/helm" version = ">= 2.12.1" } + kubectl = { + source = "gavinbunney/kubectl" + version = ">= 1.14.0" + } } }