Skip to content

Commit 7b3b941

Browse files
committed
[single-cluster/aws] Install Calico as the CNI
Fixes #12953 This PR updates the EKS single cluster reference guides to install calico as the CNI. This is important for the network policies to work. For GKE and AKS, There are already options to do the same which we use already instead of doing it manually. Signed-off-by: Tarun Pothulapati <[email protected]>
1 parent 8b94c54 commit 7b3b941

File tree

5 files changed

+52
-8
lines changed

5 files changed

+52
-8
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
variable "kubeconfig" {
2+
description = "Path to the KUBECONFIG file to connect to the cluster"
3+
default = "./kubeconfig"
4+
}
5+
6+
provider "helm" {
7+
kubernetes {
8+
config_path = var.kubeconfig
9+
}
10+
}
11+
12+
resource "helm_release" "calico" {
13+
name = "tigera-operator"
14+
repository = "https://projectcalico.docs.tigera.io/charts"
15+
chart = "tigera-operator"
16+
namespace = "tigera-operator"
17+
version = "v3.24.1"
18+
create_namespace = true
19+
20+
values = [
21+
jsonencode({
22+
installation = {
23+
kubernetesProvider = "EKS"
24+
}
25+
})
26+
]
27+
}

install/infra/modules/tools/azure-external-dns/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
variable settings {}
2-
variable domain_name { default = "test"}
3-
variable kubeconfig { default = "conf"}
4-
variable txt_owner_id { default = "nightly-test"}
1+
variable "settings" {}
2+
variable "domain_name" { default = "test" }
3+
variable "kubeconfig" { default = "conf" }
4+
variable "txt_owner_id" { default = "nightly-test" }
55

66
provider "helm" {
77
kubernetes {

install/infra/single-cluster/aws/Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ plan-cluster:
2626
@terraform plan -target=module.eks
2727

2828
.PHONY: plan-tools
29-
plan-tools: plan-cm-edns plan-cluster-issuer plan-cluster-autoscaler
29+
plan-tools: plan-calico plan-cm-edns plan-cluster-issuer plan-cluster-autoscaler
3030

3131
.PHONY: plan-cluster-autoscaler
3232
plan-cluster-autoscaler:
3333
@terraform plan -target=module.cluster-autoscaler
3434

35+
.PHONY: plan-calico
36+
plan-calico:
37+
@terraform plan -target=module.calico
38+
3539
.PHONY: plan-cm-edns
3640
plan-cm-edns:
3741
@terraform plan -target=module.certmanager -target=module.externaldns
@@ -45,7 +49,11 @@ apply-cluster:
4549
@terraform apply -target=module.eks --auto-approve
4650

4751
.PHONY: apply-tools
48-
apply-tools: install-cm-edns install-cluster-issuer install-cluster-autoscaler
52+
apply-tools: install-calico install-cm-edns install-cluster-issuer install-cluster-autoscaler
53+
54+
.PHONY: install-calico
55+
install-calico:
56+
@terraform apply -target=module.calico --auto-approve
4957

5058
.PHONY: install-cluster-autoscaler
5159
install-cluster-autoscaler:
@@ -64,7 +72,11 @@ destroy-cluster:
6472
@terraform destroy -target=module.eks --auto-approve
6573

6674
.PHONY: destroy-tools
67-
destroy-tools: destroy-cluster-issuer destroy-cm-edns destroy-cluster-autoscaler
75+
destroy-tools: destroy-calico destroy-cluster-issuer destroy-cm-edns destroy-cluster-autoscaler
76+
77+
.PHONY: destroy-calico
78+
destroy-calico:
79+
@terraform destroy -target=module.calico --auto-approve
6880

6981
.PHONY: destroy-cluster-autoscaler
7082
destroy-cluster-autoscaler:

install/infra/single-cluster/aws/output.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ output "url" {
33
}
44

55
output "cluster_name" {
6-
value = var.cluster_name
6+
value = var.cluster_name
77
}
88

99
output "registry_backend" {

install/infra/single-cluster/aws/tools.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ module "cluster-autoscaler" {
2929
cluster_id = module.eks.cluster_id
3030
oidc_provider_arn = module.eks.oidc_provider_arn
3131
}
32+
33+
module "calico" {
34+
source = "../../modules/tools/aws-calico"
35+
kubeconfig = var.kubeconfig
36+
}

0 commit comments

Comments
 (0)