Created
November 27, 2019 10:40
-
-
Save d-baranowski/0f727f1426df438f69e8c906adacc060 to your computer and use it in GitHub Desktop.
cluster autoscaler taint tags logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_autoscaling_group" "node_monitoring_asg_az1" { | |
launch_configuration = aws_launch_configuration.node_monitoring_node.id | |
max_size = var.monitoring_node_max_count | |
min_size = var.monitoring_node_min_count | |
name = "${var.product}-${var.environment}-asg-monitoring-az1-${var.app}" | |
vpc_zone_identifier = [element(var.cluster_subnet_ids, 0)] | |
enabled_metrics = [ | |
"GroupMinSize", | |
"GroupMaxSize", | |
"GroupDesiredCapacity", | |
"GroupInServiceInstances", | |
"GroupPendingInstances", | |
"GroupStandbyInstances", | |
"GroupTerminatingInstances", | |
"GroupTotalInstances", | |
] | |
tags = flatten([ | |
concat( | |
[ | |
{ | |
"key" = "k8s.io/cluster-autoscaler/node-template/taint/monitoring" | |
"value" = "true:NoSchedule" | |
"propagate_at_launch" = true | |
}, | |
{ | |
"key" = "k8s.io/cluster-autoscaler/node-template/label/restrict" | |
"value" = "monitoring-only" | |
"propagate_at_launch" = true | |
}, | |
{ | |
"key" = "Name" | |
"value" = "${var.product}-${var.environment}-asg-monitoring-az1-${var.app}" | |
"propagate_at_launch" = true | |
}, | |
{ | |
"key" = "kubernetes.io/cluster/${local.cluster_name}" | |
"value" = "owned" | |
"propagate_at_launch" = true | |
}, | |
{ | |
"key" = "k8s.io/cluster-autoscaler/enabled" | |
"value" = "true" | |
"propagate_at_launch" = true | |
}, | |
], | |
local.asg_tags, | |
), | |
]) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cluster-autoscaler/git branch [10:24:57] | |
* (HEAD detached from cluster-autoscaler-1.13.8) | |
diff --git a/cluster-autoscaler/cloudprovider/aws/aws_manager.go b/cluster-autoscaler/cloudprovider/aws/aws_manager.go | |
index 212e657dd..e27b34c29 100644 | |
--- a/cluster-autoscaler/cloudprovider/aws/aws_manager.go | |
+++ b/cluster-autoscaler/cloudprovider/aws/aws_manager.go | |
@@ -263,6 +263,9 @@ func (m *AwsManager) buildNodeFromTemplate(asg *asg, template *asgTemplate) (*ap | |
node.Spec.Taints = extractTaintsFromAsg(template.Tags) | |
node.Status.Conditions = cloudprovider.BuildReadyConditions() | |
+ | |
+ println("RESULTING NODE SPEC TAINTS buildNodeFromTemplate") | |
+ fmt.Printf("%v\n", node.Spec.Taints) | |
return &node, nil | |
} | |
@@ -297,6 +300,8 @@ func extractLabelsFromAsg(tags []*autoscaling.TagDescription) map[string]string | |
} | |
} | |
} | |
+ println("HELLO DANIEL") | |
+ fmt.Printf("%v\n", result) | |
return result | |
} | |
@@ -310,18 +315,40 @@ func extractTaintsFromAsg(tags []*autoscaling.TagDescription) []apiv1.Taint { | |
// The tag value must be in the format <tag>:NoSchedule | |
r, _ := regexp.Compile("(.*):(?:NoSchedule|NoExecute|PreferNoSchedule)") | |
if r.MatchString(v) { | |
+ println("IT MATCHES") | |
+ println(k) | |
+ println(v) | |
splits := strings.Split(k, "k8s.io/cluster-autoscaler/node-template/taint/") | |
if len(splits) > 1 { | |
values := strings.SplitN(v, ":", 2) | |
+ println("IT GOT A VALUE") | |
+ println(k) | |
+ println(v) | |
if len(values) > 1 { | |
+ println("IT GOT A APPENDED") | |
+ println(k) | |
+ println(v) | |
+ | |
+ newKey := splits[1] | |
+ newValue := values[0] | |
+ newEffect := apiv1.TaintEffect(values[1]) | |
+ fmt.Printf("\nNEWKEY\n%v", newKey) | |
+ fmt.Printf("\nNEWVALUE\n%v", newValue) | |
+ fmt.Printf("\nNEWEFFECT\n%v", newEffect) | |
+ fmt.Printf("\nNEWEFFECTVALUE\n%v", values[1]) | |
+ | |
+ | |
taints = append(taints, apiv1.Taint{ | |
- Key: splits[1], | |
- Value: values[0], | |
- Effect: apiv1.TaintEffect(values[1]), | |
+ Key: newKey, | |
+ Value: newValue, | |
+ Effect: newEffect, | |
}) | |
} | |
} | |
} | |
} | |
+ | |
+ println("HELLO DANIEL") | |
+ fmt.Printf("%v\n", taints) | |
return taints | |
} | |
diff --git a/cluster-autoscaler/core/utils.go b/cluster-autoscaler/core/utils.go | |
index 83006745f..07e849e37 100644 | |
--- a/cluster-autoscaler/core/utils.go | |
+++ b/cluster-autoscaler/core/utils.go | |
@@ -340,6 +340,11 @@ func GetNodeInfoFromTemplate(nodeGroup cloudprovider.NodeGroup, daemonsets []*ex | |
if typedErr != nil { | |
return nil, typedErr | |
} | |
+ | |
+ println("SANITIZED NODE INFO TAINTS GetNodeInfoFromTemplate") | |
+ logtaints, err := sanitizedNodeInfo.Taints() | |
+ fmt.Printf("%v\n", logtaints) | |
+ fmt.Printf("%v\n", err) | |
return sanitizedNodeInfo, nil | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment