Skip to content

Commit

Permalink
PLAT-7889 move config to vpc-cni install (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelhar authored Jan 30, 2024
1 parent 1670fc0 commit a19b8fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 11 additions & 4 deletions modules/eks/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,24 @@ data "aws_eks_addon_version" "default_vpc_cni" {
kubernetes_version = aws_eks_cluster.this.version
}

locals {
is_pod_sb = length(var.network_info.subnets.pod) > 0
vpc_cni_env = merge({
ENABLE_PREFIX_DELEGATION = tostring(try(var.eks.vpc_cni.prefix_delegation, false))
ANNOTATE_POD_IP = tostring(try(var.eks.vpc_cni.annotate_pod_ip, true))
}, local.is_pod_sb ? {
AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG = "true"
ENI_CONFIG_LABEL_DEF = "topology.kubernetes.io/zone" } : {})
}

resource "aws_eks_addon" "vpc_cni" {
cluster_name = aws_eks_cluster.this.name
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.default_vpc_cni.version
resolve_conflicts_on_create = "OVERWRITE"
resolve_conflicts_on_update = "OVERWRITE"
configuration_values = jsonencode({
env = {
ENABLE_PREFIX_DELEGATION = tostring(try(var.eks.vpc_cni.prefix_delegation, false))
ANNOTATE_POD_IP = tostring(try(var.eks.vpc_cni.annotate_pod_ip, true))
}
env = local.vpc_cni_env
})
}

Expand Down
2 changes: 0 additions & 2 deletions modules/eks/submodules/k8s/templates/k8s-functions.sh.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ set_eniconfig() {
else
printf "$RED $ENICONFIG_YAML does not exist. $EC \n" && exit 1
fi
echo
kubectl_cmd -n kube-system set env daemonset aws-node AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG=true ENI_CONFIG_LABEL_DEF=topology.kubernetes.io/zone
}

remove_calico_cr() {
Expand Down

0 comments on commit a19b8fb

Please sign in to comment.