-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set node affinity for more pods to ensure they run on general node pool #2353
Changes from 8 commits
4af0329
5b806fd
b9ef453
1e7ede8
e2a49c5
f10141f
72cc493
92d2c66
c39d13f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,6 @@ resource "aws_eks_node_group" "main" { | |
] | ||
|
||
tags = merge({ | ||
# "kubernetes.io/cluster/${var.name}" = "shared" | ||
"k8s.io/cluster-autoscaler/node-template/label/dedicated" = var.node_groups[count.index].name | ||
propagate_at_launch = true | ||
}, var.tags) | ||
|
@@ -69,9 +68,36 @@ data "aws_eks_cluster_auth" "main" { | |
|
||
resource "aws_eks_addon" "aws-ebs-csi-driver" { | ||
# required for Kubernetes v1.23+ on AWS | ||
addon_name = "aws-ebs-csi-driver" | ||
cluster_name = aws_eks_cluster.main.name | ||
resolve_conflicts = "OVERWRITE" | ||
addon_name = "aws-ebs-csi-driver" | ||
cluster_name = aws_eks_cluster.main.name | ||
resolve_conflicts_on_create = "OVERWRITE" | ||
resolve_conflicts_on_update = "OVERWRITE" | ||
|
||
configuration_values = jsonencode({ | ||
controller = { | ||
nodeSelector = { | ||
"eks.amazonaws.com/nodegroup" = "general" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to pass this is as a variable rather than hard code it (as in src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually don't think we support renaming node pools so I'm fine adding this as is. |
||
} | ||
} | ||
}) | ||
|
||
# Ensure cluster and node groups are created | ||
depends_on = [ | ||
aws_eks_cluster.main, | ||
aws_eks_node_group.main, | ||
] | ||
} | ||
|
||
resource "aws_eks_addon" "coredns" { | ||
addon_name = "coredns" | ||
cluster_name = aws_eks_cluster.main.name | ||
|
||
configuration_values = jsonencode({ | ||
nodeSelector = { | ||
"eks.amazonaws.com/nodegroup" = "general" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually don't think we support renaming node pools so I'm fine adding this as is. |
||
} | ||
}) | ||
|
||
# Ensure cluster and node groups are created | ||
depends_on = [ | ||
aws_eks_cluster.main, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,24 @@ resource "helm_release" "autoscaler" { | |
clusterName = var.cluster-name | ||
enabled = true | ||
} | ||
|
||
affinity = { | ||
nodeAffinity = { | ||
requiredDuringSchedulingIgnoredDuringExecution = { | ||
nodeSelectorTerms = [ | ||
{ | ||
matchExpressions = [ | ||
{ | ||
key = "eks.amazonaws.com/nodegroup" | ||
operator = "In" | ||
values = ["general"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually don't think we support renaming node pools so I'm fine adding this as is. |
||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}) | ||
], var.overrides) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -557,6 +557,23 @@ resource "kubernetes_manifest" "deployment_admission_controller" { | |
} | ||
}, | ||
] | ||
affinity = { | ||
nodeAffinity = { | ||
requiredDuringSchedulingIgnoredDuringExecution = { | ||
nodeSelectorTerms = [ | ||
{ | ||
matchExpressions = [ | ||
{ | ||
key = var.node-group.key | ||
operator = "In" | ||
values = [var.node-group.value] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
Comment on lines
+560
to
+576
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks good |
||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fly by, removing commented out code