@@ -5,11 +5,15 @@ This Terraform module enables CAST AI Omni functionality for a Kubernetes cluste
55## Features
66
77- Enables CAST AI Omni functionality for existing clusters
8- - Installs and configures Liqo for multi-cluster networking
8+ - ** Support for GKE and EKS** (AKS coming soon)
9+ - Installs and configures Liqo for multi-cluster networking with cloud-specific optimizations
910- Deploys CAST AI Omni Agent for cluster management
10- - Automatic extraction of network configuration from GKE clusters (including external CIDR from Liqo)
11+ - Automatic extraction of network configuration from clusters (including external CIDR from Liqo)
1112- Support for both zonal and regional GKE clusters
1213- Automatic synchronization with Liqo IPAM for external CIDR allocation
14+ - Cloud-specific configurations:
15+ - ** GKE:** Uses default Liqo network fabric settings
16+ - ** EKS:** Configures AWS Network Load Balancer (NLB) and full masquerade for pod traffic
1317
1418## Prerequisites
1519
@@ -22,6 +26,7 @@ This Terraform module enables CAST AI Omni functionality for a Kubernetes cluste
2226- Null provider >= 3.2.4
2327- External provider >= 2.3.5
2428- Google provider >= 4.0 (for GKE clusters)
29+ - AWS provider >= 5.0 (for EKS clusters)
2530
2631## What This Module Installs
2732
@@ -63,6 +68,7 @@ data "google_compute_subnetwork" "gke_subnet" {
6368module "castai-omni-cluster" {
6469 source = "../.."
6570
71+ k8s_provider = "gke" # Specify cloud provider: "gke" or "eks"
6672 api_url = var.castai_api_url
6773 api_token = var.castai_api_token
6874 organization_id = var.organization_id
@@ -95,6 +101,51 @@ module "castai_gcp_edge_location" {
95101}
96102```
97103
104+ ### Complete EKS Example
105+
106+ ``` hcl
107+ data "aws_eks_cluster" "eks" {
108+ name = var.eks_cluster_name
109+ }
110+
111+ data "aws_vpc" "eks_vpc" {
112+ id = data.aws_eks_cluster.eks.vpc_config[0].vpc_id
113+ }
114+
115+ data "aws_subnets" "eks_subnets" {
116+ filter {
117+ name = "vpc-id"
118+ values = [data.aws_vpc.eks_vpc.id]
119+ }
120+ }
121+
122+ data "aws_subnet" "eks_subnet" {
123+ for_each = toset(data.aws_subnets.eks_subnets.ids)
124+ id = each.value
125+ }
126+
127+ locals {
128+ subnet_cidrs = [for s in data.aws_subnet.eks_subnet : s.cidr_block]
129+ }
130+
131+ module "castai_omni_cluster" {
132+ source = "github.com/castai/terraform-castai-omni-cluster"
133+
134+ k8s_provider = "eks" # Specify cloud provider: "gke" or "eks"
135+ api_url = var.castai_api_url
136+ api_token = var.castai_api_token
137+ organization_id = var.organization_id
138+ cluster_id = var.cluster_id
139+ cluster_name = var.eks_cluster_name
140+ cluster_region = var.eks_cluster_region
141+
142+ api_server_address = data.aws_eks_cluster.eks.endpoint
143+ pod_cidr = data.aws_eks_cluster.eks.kubernetes_network_config[0].service_ipv4_cidr
144+ service_cidr = data.aws_eks_cluster.eks.kubernetes_network_config[0].service_ipv4_cidr
145+ reserved_subnet_cidrs = local.subnet_cidrs
146+ }
147+ ```
148+
98149### Required Providers
99150
100151``` hcl
@@ -155,12 +206,13 @@ provider "castai" {
155206
156207| Name | Description | Type | Default | Required |
157208| ------| -------------| ------| ---------| :--------:|
209+ | k8s_provider | Kubernetes cloud provider (gke, eks) | ` string ` | - | yes |
158210| api_token | CAST AI API token for authentication | ` string ` | - | yes |
159211| organization_id | CAST AI organization ID | ` string ` | - | yes |
160212| cluster_id | CAST AI cluster ID | ` string ` | - | yes |
161213| cluster_name | Cluster name | ` string ` | - | yes |
162214| cluster_region | Kubernetes cluster region | ` string ` | - | yes |
163- | cluster_zone | Kubernetes cluster zone | ` string ` | - | yes |
215+ | cluster_zone | Kubernetes cluster zone (optional for EKS) | ` string ` | ` "" ` | no |
164216| api_server_address | Kubernetes API server address | ` string ` | - | yes |
165217| pod_cidr | Pod CIDR for network configuration | ` string ` | - | yes |
166218| service_cidr | Service CIDR for network configuration | ` string ` | - | yes |
@@ -178,22 +230,40 @@ provider "castai" {
178230
179231## Network Configuration
180232
181- The module automatically extracts network configuration from your GKE cluster:
233+ The module automatically extracts network configuration from your cluster:
182234
235+ ### GKE Clusters
183236- ** Subnet CIDR** : Retrieved from the cluster's subnetwork
184237- ** Pod CIDR** : Retrieved from ` cluster_ipv4_cidr `
185238- ** Service CIDR** : Retrieved from ` services_ipv4_cidr `
186239- ** External CIDR** : Automatically extracted from Liqo network resources after IPAM initialization
187240- ** Region/Zone** : Automatically determined from cluster location
188241
242+ ### EKS Clusters
243+ - ** Subnet CIDRs** : Retrieved from all VPC subnets
244+ - ** Pod CIDR** : Retrieved from ` kubernetes_network_config `
245+ - ** Service CIDR** : Retrieved from ` kubernetes_network_config `
246+ - ** External CIDR** : Automatically extracted from Liqo network resources after IPAM initialization
247+ - ** Region** : From cluster configuration
248+
189249## Liqo Configuration
190250
191- The module includes a GKE-specific submodule that:
251+ The module includes cloud-specific submodules for optimal Liqo configuration:
252+
253+ ### GKE Configuration
192254- Installs Liqo for multi-cluster networking
193255- Configures IPAM with pod, service, and reserved subnet CIDRs
194256- Sets up topology labels for GKE region and zone
195257- Enables virtual node capabilities for edge locations
196- - Uses Liqo chart's default configurations for network fabric settings (health probes, metrics)
258+ - Uses Liqo chart's default configurations for network fabric settings
259+
260+ ### EKS Configuration
261+ - Installs Liqo with AWS-optimized settings
262+ - Configures IPAM with pod, service, and reserved subnet CIDRs
263+ - Sets up topology labels for EKS region
264+ - Enables full masquerade for pod traffic (required for EKS networking)
265+ - Configures AWS Network Load Balancer (NLB) for gateway service
266+ - Enables virtual node capabilities for edge locations
197267
198268## Installation Order and Dependencies
199269
@@ -211,12 +281,15 @@ This ordering ensures that Liqo's IPAM system is fully initialized and the exter
211281
212282## Examples
213283
214- See the [ examples/onboarding-with-existing-gke-cluster] ( ./examples/onboarding-with-existing-gke-cluster ) directory for a complete working example.
284+ Complete working examples are available for both cloud providers:
285+ - ** GKE** : [ examples/onboarding-with-existing-gke-cluster] ( ./examples/onboarding-with-existing-gke-cluster )
286+ - ** EKS** : [ examples/onboarding-with-existing-eks-cluster] ( ./examples/onboarding-with-existing-eks-cluster )
215287
216288## Related Modules
217289
218290- [ terraform-castai-omni-edge-location] ( https://github.com/castai/terraform-castai-omni-edge-location ) - Create and manage edge locations for Omni clusters
219- - [ terraform-castai-gke-cluster] ( https://github.com/castai/gke-cluster ) - Onboard GKE clusters to CAST AI
291+ - [ terraform-castai-gke-cluster] ( https://github.com/castai/terraform-castai-gke-cluster ) - Onboard GKE clusters to CAST AI
292+ - [ terraform-castai-eks-cluster] ( https://github.com/castai/terraform-castai-eks-cluster ) - Onboard EKS clusters to CAST AI
220293
221294## License
222295
245318
246319| Name | Source | Version |
247320| ------| --------| ---------|
248- | <a name =" module_liqo_helm_values " ></a > [ liqo\_ helm\_ values] ( #module\_ liqo\_ helm\_ values ) | ./modules/gke | n/a |
321+ | <a name =" module_liqo_helm_values_eks " ></a > [ liqo\_ helm\_ values\_ eks] ( #module\_ liqo\_ helm\_ values\_ eks ) | ./modules/eks | n/a |
322+ | <a name =" module_liqo_helm_values_gke " ></a > [ liqo\_ helm\_ values\_ gke] ( #module\_ liqo\_ helm\_ values\_ gke ) | ./modules/gke | n/a |
249323
250324## Resources
251325
267341| <a name =" input_cluster_id " ></a > [ cluster\_ id] ( #input\_ cluster\_ id ) | CAST AI cluster ID to enable Omni functionality for | ` string ` | n/a | yes |
268342| <a name =" input_cluster_name " ></a > [ cluster\_ name] ( #input\_ cluster\_ name ) | CAST AI cluster name | ` string ` | n/a | yes |
269343| <a name =" input_cluster_region " ></a > [ cluster\_ region] ( #input\_ cluster\_ region ) | K8s cluster region | ` string ` | n/a | yes |
270- | <a name =" input_cluster_zone " ></a > [ cluster\_ zone] ( #input\_ cluster\_ zone ) | K8s cluster zone | ` string ` | n/a | yes |
344+ | <a name =" input_cluster_zone " ></a > [ cluster\_ zone] ( #input\_ cluster\_ zone ) | K8s cluster zone | ` string ` | ` "" ` | no |
345+ | <a name =" input_k8s_provider " ></a > [ k8s\_ provider] ( #input\_ k8s\_ provider ) | Kubernetes cloud provider (gke, eks) | ` string ` | n/a | yes |
271346| <a name =" input_liqo_chart_version " ></a > [ liqo\_ chart\_ version] ( #input\_ liqo\_ chart\_ version ) | Liqo helm chart version | ` string ` | ` "v1.0.1-5" ` | no |
272347| <a name =" input_organization_id " ></a > [ organization\_ id] ( #input\_ organization\_ id ) | CAST AI organization ID | ` string ` | n/a | yes |
273348| <a name =" input_pod_cidr " ></a > [ pod\_ cidr] ( #input\_ pod\_ cidr ) | Pod CIDR for network configuration | ` string ` | n/a | yes |
0 commit comments