Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
refacto(cilium): deploy everything, gw api crd as well using tf
Browse files Browse the repository at this point in the history
  • Loading branch information
Smana committed Aug 10, 2023
1 parent 58c34b9 commit 840930c
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 77 deletions.
7 changes: 0 additions & 7 deletions infrastructure/base/cilium/kustomization.yaml

This file was deleted.

58 changes: 0 additions & 58 deletions infrastructure/base/cilium/release.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions infrastructure/base/cilium/source.yaml

This file was deleted.

1 change: 0 additions & 1 deletion infrastructure/mycluster-0/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ kind: Kustomization

resources:
- ../base/aws-load-balancer-controller
- ../base/cilium
- ../base/external-dns
- ../base/gateway-api
5 changes: 5 additions & 0 deletions terraform/eks/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ data "aws_ecrpublic_authorization_token" "token" {
data "aws_eks_cluster_auth" "cluster_auth" {
name = module.eks.cluster_name
}

data "http" "gateway_api_crds" {
count = length(local.gateway_api_crds_urls)
url = local.gateway_api_crds_urls[count.index]
}
5 changes: 4 additions & 1 deletion terraform/eks/helm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ resource "helm_release" "cilium" {
file("${path.module}/helm_values/cilium.yaml")
]

depends_on = [kubernetes_job.delete_aws_cni_ds]
depends_on = [
kubectl_manifest.gateway_api_crds,
kubernetes_job.delete_aws_cni_ds
]
}
5 changes: 2 additions & 3 deletions terraform/eks/helm_values/cilium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ envoy:
requests:
cpu: 200m
memory:
# Deployed using Flux as we need to deploy the Gateway API CRDs first
# gatewayAPI:
# enabled: true
gatewayAPI:
enabled: true
9 changes: 9 additions & 0 deletions terraform/eks/kubernetes.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Install Gateway API CRD's. Requirement to be installed before Cilium is running
resource "kubectl_manifest" "gateway_api_crds" {
count = length(local.gateway_api_crds_urls)
yaml_body = data.http.gateway_api_crds[count.index].body
depends_on = [module.eks]
}

# EKS post install kubernetes job with these changes
resource "kubernetes_service_account" "eks_init" {
metadata {
Expand Down Expand Up @@ -81,3 +88,5 @@ resource "kubernetes_job" "delete_aws_cni_ds" {
module.eks
]
}


10 changes: 10 additions & 0 deletions terraform/eks/locals.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
locals {
azs = slice(data.aws_availability_zones.available.names, 0, 3)

gateway_api_crds_urls = [
"https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/${var.gateway_api_version}/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml",
"https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/${var.gateway_api_version}/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml",
"https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/${var.gateway_api_version}/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml",
"https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/${var.gateway_api_version}/config/crd/experimental/gateway.networking.k8s.io_referencegrants.yaml",
"https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/${var.gateway_api_version}/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml",
"https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/${var.gateway_api_version}/config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml",
"https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/${var.gateway_api_version}/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml"
]
}
6 changes: 6 additions & 0 deletions terraform/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ variable "cilium_version" {
type = string
}

variable "gateway_api_version" {
description = "Gateway API CRDs version"
default = "v0.7.1"
type = string
}

# Flux
variable "github_owner" {
type = string
Expand Down

0 comments on commit 840930c

Please sign in to comment.