Skip to content

Commit a487d9c

Browse files
Add dedicated parameter to skip Helm chart installation
1 parent e7a47ab commit a487d9c

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

main.tf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ locals {
2626
EOT
2727

2828
# Select the appropriate set_values based on k8s_provider
29-
provider_specific_liqo_values = var.k8s_provider == "gke" ? module.liqo_helm_values_gke[0].set_values : module.liqo_helm_values_eks[0].set_values
29+
provider_specific_liqo_values = var.skip_helm ? [] : (var.k8s_provider == "gke" ? module.liqo_helm_values_gke[0].set_values : module.liqo_helm_values_eks[0].set_values)
3030
}
3131

3232
# GKE-specific Liqo Helm chart configuration
3333
module "liqo_helm_values_gke" {
34-
count = var.k8s_provider == "gke" ? 1 : 0
34+
count = !var.skip_helm && var.k8s_provider == "gke" ? 1 : 0
3535
source = "./modules/gke"
3636

3737
image_tag = local.liqo_image_tag
@@ -46,7 +46,7 @@ module "liqo_helm_values_gke" {
4646

4747
# EKS-specific Liqo Helm chart configuration
4848
module "liqo_helm_values_eks" {
49-
count = var.k8s_provider == "eks" ? 1 : 0
49+
count = !var.skip_helm && var.k8s_provider == "eks" ? 1 : 0
5050
source = "./modules/eks"
5151

5252
image_tag = local.liqo_image_tag
@@ -59,6 +59,8 @@ module "liqo_helm_values_eks" {
5959

6060
# Liqo Helm Release
6161
resource "helm_release" "liqo" {
62+
count = var.skip_helm ? 0 : 1
63+
6264
name = local.liqo_release_name
6365
repository = local.liqo_chart_repo
6466
chart = local.liqo_chart_name
@@ -74,6 +76,8 @@ resource "helm_release" "liqo" {
7476

7577
# Wait for Liqo network resources to be ready before proceeding
7678
resource "null_resource" "wait_for_liqo_network" {
79+
count = var.skip_helm ? 0 : 1
80+
7781
provisioner "local-exec" {
7882
command = <<-EOT
7983
set -e
@@ -111,6 +115,8 @@ resource "null_resource" "wait_for_liqo_network" {
111115

112116
# Extract the external CIDR value from Liqo network resource
113117
data "external" "liqo_external_cidr" {
118+
count = var.skip_helm ? 0 : 1
119+
114120
program = ["bash", "-c", <<-EOT
115121
CIDR=$(kubectl get networks.ipam.liqo.io -n ${local.omni_namespace} \
116122
-l ipam.liqo.io/network-type=external-cidr \
@@ -129,6 +135,8 @@ data "external" "liqo_external_cidr" {
129135

130136
# CAST AI Omni Agent Helm Release
131137
resource "helm_release" "omni_agent" {
138+
count = var.skip_helm ? 0 : 1
139+
132140
name = local.omni_agent_release
133141
repository = local.castai_helm_repository
134142
chart = local.omni_agent_chart
@@ -140,7 +148,7 @@ resource "helm_release" "omni_agent" {
140148
set = [
141149
{
142150
name = "network.externalCIDR"
143-
value = data.external.liqo_external_cidr.result.cidr
151+
value = data.external.liqo_external_cidr[0].result.cidr
144152
},
145153
{
146154
name = "network.podCIDR"

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@ variable "reserved_subnet_cidrs" {
7171
type = list(string)
7272
default = []
7373
}
74+
75+
variable "skip_helm" {
76+
description = "Skip installing any helm release; allows managing helm releases in GitOps"
77+
type = bool
78+
default = false
79+
}

0 commit comments

Comments
 (0)