terraform-provider-rancher2: eks-config-operator fails during eks node group provisioning and node template is empty
During creation of new node_group with launch template, rancher does not see launch template in the UI and the eks-operator fails.
When I edit cluster and manually point new node group to use specific launch_template then it works.
Otherwise it is empty.
I define environment using terraform provider 1.15.1
Plan also shows that launch_template will be created and used within eks node_group.
This is the code i use:
`resource “rancher2_cluster” “EKS-custom” { depends_on = [var.rancher_dns, var.rancher_route_record_depends, var.rancher2_token, aws_security_group.eks_sg_allowall, aws_launch_template.eks_launch_template] name = var.cluster-name description = “EKS Kubernetes cluster”
eks_config_v2 { cloud_credential_id = rancher2_cloud_credential.eks_credential.id kubernetes_version = var.kubernetes_version region = var.region
dynamic node_groups {
for_each = var.node_groups
content {
name = node_groups.value.name
instance_type = try(node_groups.value.spot, false) ? "" : node_groups.value.instance_type
desired_size = node_groups.value.desired_size
max_size = node_groups.value.max_size
min_size = node_groups.value.min_size
ec2_ssh_key = aws_key_pair.eks_key_pair.key_name
request_spot_instances = try(node_groups.value.spot, "false")
spot_instance_types = [try(node_groups.value.spot, false) ? node_groups.value.instance_type : ""]
gpu = try(node_groups.value.gpu, "false")
disk_size = (try(node_groups.value.disk_size, 0) > 0) ? node_groups.value.disk_size : "60"
dynamic launch_template {
for_each = (try(node_groups.value.longhorn_disk_size, 0) > 0) ? [1] : []
content {
id = aws_launch_template.eks_launch_template[node_groups.value.name].id
version = aws_launch_template.eks_launch_template[node_groups.value.name].latest_version
name = aws_launch_template.eks_launch_template[node_groups.value.name].name
}
}
resource_tags = merge(
{
Creator = "Rancher-Terraform"
},
var.tags,
)
tags = merge(
{
Name = "${var.cluster-name}-node"
Creator = "Terraform"
},
var.tags,
)
}
}
public_access = false
private_access = true
security_groups = [aws_security_group.eks_sg_allowall.id]
subnets = var.subnets
tags = merge(
{
Name = "${var.cluster-name}"
Creator = "Terraform"
},
var.tags,
)
}
lifecycle {
ignore_changes = [
eks_config_v2[0].public_access_sources,
]
}
} E0624 08:47:16.789014 1 runtime.go:78] Observed a panic: “invalid memory address or nil pointer dereference” (runtime error: invalid memory address or nil pointer dereference)
goroutine 296 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic(0x142c380, 0x1ffc440)
/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/runtime/runtime.go:74 +0xa6
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/runtime/runtime.go:48 +0x86
panic(0x142c380, 0x1ffc440)
/usr/local/go/src/runtime/panic.go:965 +0x1b9
github.com/rancher/eks-operator/controller.createNodeGroup(0xc000c76580, 0xc000712a6b, 0xc0003b44a0, 0xc0003b4520, 0xc000712a60, 0xc0003b44e0, 0xc000c08180, 0xc0003b4460, 0xc000712a50, 0xc000712ad0, …)
/go/src/github.com/rancher/eks-operator/controller/nodegroup.go:267 +0x758
github.com/rancher/eks-operator/controller.(*Handler).updateUpstreamClusterState(0xc000422340, 0xc0002ce000, 0xc000c76580, 0xc000b0aff0, 0x42, 0xc000521700, 0xc0000b2750, 0xc0000b2790, 0xc0000b27a8, 0x1, …)
/go/src/github.com/rancher/eks-operator/controller/eks-cluster-config-handler.go:1071 +0x28e8
github.com/rancher/eks-operator/controller.(*Handler).checkAndUpdate(0xc000422340, 0xc00037a2c0, 0xc0000b2750, 0xc0000b2790, 0xc0000b27a8, 0xc0000b27a8, 0xc000712ba0, 0xc)
/go/src/github.com/rancher/eks-operator/controller/eks-cluster-config-handler.go:312 +0xcfb
github.com/rancher/eks-operator/controller.(*Handler).OnEksConfigChanged(0xc000422340, 0xc000bbe3c0, 0x1a, 0xc00037a2c0, 0x0, 0x44842c, 0xc000432058)
/go/src/github.com/rancher/eks-operator/controller/eks-cluster-config-handler.go:93 +0x211
github.com/rancher/eks-operator/controller.(*Handler).recordError.func1(0xc000bbe3c0, 0x1a, 0xc00037a2c0, 0xc0003d4000, 0xc000339a4e, 0x0)
/go/src/github.com/rancher/eks-operator/controller/eks-cluster-config-handler.go:105 +0x67
m/rancher/eks-operator/pkg/generated/controllers/eks.cattle.io/v1.FromEKSClusterConfigHandlerToHandler.func1(0xc000bbe3c0, 0x1a, 0x17c9250, 0xc00037a2c0, 0x104e, 0x403bcb, 0xc0003b4840, 0x413c5d)
/go/src/github.com/rancher/eks-operator/pkg/generated/controllers/eks.cattle.io/v1/eksclusterconfig.go:105 +0x6b
github.com/rancher/lasso/pkg/controller.SharedControllerHandlerFunc.OnChange(0xc00003a780, 0xc000bbe3c0, 0x1a, 0x17c9250, 0xc00037a2c0, 0x2, 0xc00036f468, 0x40409a, 0xc00036f440)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/sharedcontroller.go:29 +0x4e
github.com/rancher/lasso/pkg/controller.(*sharedHandler).OnChange(0xc000409680, 0xc000bbe3c0, 0x1a, 0x17c9250, 0xc00037a2c0, 0xc000d7b201, 0x0)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/sharedhandler.go:65 +0x115
github.com/rancher/lasso/pkg/controller.(*controller).syncHandler(0xc0004380b0, 0xc000bbe3c0, 0x1a, 0xc000d7b318, 0x0)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:210 +0xd1
github.com/rancher/lasso/pkg/controller.(*controller).processSingleItem(0xc0004380b0, 0x13da240, 0xc0003b4840, 0x0, 0x0)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:192 +0xe7
github.com/rancher/lasso/pkg/controller.(*controller).processNextWorkItem(0xc0004380b0, 0x203001)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:169 +0x54
github.com/rancher/lasso/pkg/controller.(*controller).runWorker(…)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:158
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000d4c0f0)
/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/wait/wait.go:155 +0x5f
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc000d4c0f0, 0x17c2f00, 0xc0004a5bf0, 0x1, 0xc0004321e0)
/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/wait/wait.go:156 +0x9b
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc000d4c0f0, 0x3b9aca00, 0x0, 0xc000b0e801, 0xc0004321e0)
/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/wait/wait.go:133 +0x98
k8s.io/apimachinery/pkg/util/wait.Until(0xc000d4c0f0, 0x3b9aca00, 0xc0004321e0)
/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/wait/wait.go:90 +0x4d
created by github.com/rancher/lasso/pkg/controller.(*controller).run
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:129 +0x33b
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1300478]
goroutine 296 [running]:
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/runtime/runtime.go:55 +0x109
panic(0x142c380, 0x1ffc440)
/usr/local/go/src/runtime/panic.go:965 +0x1b9
github.com/rancher/eks-operator/controller.createNodeGroup(0xc000c76580, 0xc000712a6b, 0xc0003b44a0, 0xc0003b4520, 0xc000712a60, 0xc0003b44e0, 0xc000c08180, 0xc0003b4460, 0xc000712a50, 0xc000712ad0, …)
/go/src/github.com/rancher/eks-operator/controller/nodegroup.go:267 +0x758
github.com/rancher/eks-operator/controller.(*Handler).updateUpstreamClusterState(0xc000422340, 0xc0002ce000, 0xc000c76580, 0xc000b0aff0, 0x42, 0xc000521700, 0xc0000b2750, 0xc0000b2790, 0xc0000b27a8, 0x1, …)
/go/src/github.com/rancher/eks-operator/controller/eks-cluster-config-handler.go:1071 +0x28e8
github.com/rancher/eks-operator/controller.(*Handler).checkAndUpdate(0xc000422340, 0xc00037a2c0, 0xc0000b2750, 0xc0000b2790, 0xc0000b27a8, 0xc0000b27a8, 0xc000712ba0, 0xc)
/go/src/github.com/rancher/eks-operator/controller/eks-cluster-config-handler.go:312 +0xcfb
github.com/rancher/eks-operator/controller.(*Handler).OnEksConfigChanged(0xc000422340, 0xc000bbe3c0, 0x1a, 0xc00037a2c0, 0x0, 0x44842c, 0xc000432058)
/go/src/github.com/rancher/eks-operator/controller/eks-cluster-config-handler.go:93 +0x211
github.com/rancher/eks-operator/controller.(*Handler).recordError.func1(0xc000bbe3c0, 0x1a, 0xc00037a2c0, 0xc0003d4000, 0xc000339a4e, 0x0)
/go/src/github.com/rancher/eks-operator/controller/eks-cluster-config-handler.go:105 +0x67
github.com/rancher/eks-operator/pkg/generated/controllers/eks.cattle.io/v1.FromEKSClusterConfigHandlerToHandler.func1(0xc000bbe3c0, 0x1a, 0x17c9250, 0xc00037a2c0, 0x104e, 0x403bcb, 0xc0003b4840, 0x413c5d)
/go/src/github.com/rancher/eks-operator/pkg/generated/controllers/eks.cattle.io/v1/eksclusterconfig.go:105 +0x6b
github.com/rancher/lasso/pkg/controller.SharedControllerHandlerFunc.OnChange(0xc00003a780, 0xc000bbe3c0, 0x1a, 0x17c9250, 0xc00037a2c0, 0x2, 0xc00036f468, 0x40409a, 0xc00036f440)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/sharedcontroller.go:29 +0x4e
github.com/rancher/lasso/pkg/controller.(*sharedHandler).OnChange(0xc000409680, 0xc000bbe3c0, 0x1a, 0x17c9250, 0xc00037a2c0, 0xc000d7b201, 0x0)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/sharedhandler.go:65 +0x115
github.com/rancher/lasso/pkg/controller.(*controller).syncHandler(0xc0004380b0, 0xc000bbe3c0, 0x1a, 0xc000d7b318, 0x0)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:210 +0xd1
github.com/rancher/lasso/pkg/controller.(*controller).processSingleItem(0xc0004380b0, 0x13da240, 0xc0003b4840, 0x0, 0x0)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:192 +0xe7
github.com/rancher/lasso/pkg/controller.(*controller).processNextWorkItem(0xc0004380b0, 0x203001)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:169 +0x54
github.com/rancher/lasso/pkg/controller.(*controller).runWorker(…)
/go/pkg/mod/github.com/rancher/lasso@v0.0.0-20200905045615-7fcb07d6a20b/pkg/controller/controller.go:158
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000d4c0f0)`
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 40 (15 by maintainers)
Is there any progress?
Having same issue… something new @rawmind0 ???
Submitted PR https://github.com/rancher/terraform-provider-rancher2/pull/819 to fix this issue.
I was able to reproduce the issue. The use
launch_templateis not working properly. The operator is not full filling node groupimage_id,instance_type, etc… Working on a fix.@ahmedfourti and @dcardellino, thanks for the feedback!
Closing the issue. Please, reopen if required.
Same here, any update please ?
I am having this same issue. Any update ?