-
Notifications
You must be signed in to change notification settings - Fork 0
fix local exec error with docs #106
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
base: main
Are you sure you want to change the base?
Conversation
alex-hunt-materialize
left a comment
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.
I don't see much point in writing the file. How does this fix things?
We should document that they need kubectl, though.
| kubeconfig_file=$(mktemp) | ||
| echo "$${KUBECONFIG_DATA}" > "$${kubeconfig_file}" | ||
| trap "rm -f $${kubeconfig_file}" EXIT |
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.
This trap line should happen before the write on the line above.
The file name should also be quoted inside the trap command.
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.
yeah, i kinda guessed if doing everything in one line is causing the issue. I will wait for @jubrad to reply, incase he knows exact steps to repro this. Otherwise i would just get rid of this file change.
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.
It seems that Kay can't reproduce it on this branch. I suspect that your initial thoughts were correct, and the process substitution isn't working the same on all machines.
Lets just fix the order of operations and quoting here, and then we can merge this.
|
I was able to reproduce again today off of the main branch (not with this branch though). As an FYI, I am running the examples/simple.
module.database.aws_security_group.database: Destroying... [id=sg-03547e532217e4cb6]
module.database.aws_security_group.database: Destruction complete after 0s
╷
│ Warning: Helm uninstall returned an information message
│
│ These resources were kept due to the resource policy:
│ [CustomResourceDefinition] certificaterequests.cert-manager.io
│ [CustomResourceDefinition] certificates.cert-manager.io
│ [CustomResourceDefinition] challenges.acme.cert-manager.io
│ [CustomResourceDefinition] clusterissuers.cert-manager.io
│ [CustomResourceDefinition] issuers.cert-manager.io
│ [CustomResourceDefinition] orders.acme.cert-manager.io
│
╵
╷
│ Error: local-exec provisioner error
│
│ with module.nodepool_materialize.terraform_data.destroyer,
│ on ../../modules/karpenter-nodepool/main.tf line 13, in resource "terraform_data" "destroyer":
│ 13: provisioner "local-exec" {
│
│ Error running command 'set -euo pipefail
│ nodeclaims=$(kubectl --kubeconfig <(echo "${KUBECONFIG_DATA}") get nodeclaims -l "karpenter.sh/nodepool=${NODEPOOL_NAME}" -o name)
│ if [ -n "${nodeclaims}" ]; then
│ echo "${nodeclaims}" | xargs kubectl --kubeconfig <(echo "${KUBECONFIG_DATA}") delete --wait=true
│ fi
│ ': exit status 1. Output: E1205 09:37:24.943357 14318 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1205 09:37:24.945197 14318 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1205 09:37:24.946903 14318 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1205 09:37:24.948603 14318 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1205 09:37:24.950221 14318 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ The connection to the server localhost:8080 was refused - did you specify the right host or port?
│
╵
╷
│ Error: local-exec provisioner error
│
│ with module.nodepool_generic.terraform_data.destroyer,
│ on ../../modules/karpenter-nodepool/main.tf line 13, in resource "terraform_data" "destroyer":
│ 13: provisioner "local-exec" {
│
│ Error running command 'set -euo pipefail
│ nodeclaims=$(kubectl --kubeconfig <(echo "${KUBECONFIG_DATA}") get nodeclaims -l "karpenter.sh/nodepool=${NODEPOOL_NAME}" -o name)
│ if [ -n "${nodeclaims}" ]; then
│ echo "${nodeclaims}" | xargs kubectl --kubeconfig <(echo "${KUBECONFIG_DATA}") delete --wait=true
│ fi
│ ': exit status 1. Output: E1205 09:37:38.421980 14369 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1205 09:37:38.423914 14369 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1205 09:37:38.425586 14369 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1205 09:37:38.427157 14369 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1205 09:37:38.428754 14369 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get
│ \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ The connection to the server localhost:8080 was refused - did you specify the right host or port?
│
╵ |
|
This doesn't look like an issue with the command, but likely an issue with setting the |
Yeah, I'm not sure what would be pointing at localhost unless it's local setup? |
|
terraform will always point to the |
|
And is this issue deterministic? Does it happen on every destroy? |
|
I cannot reproduce the issue either. My {
"apiVersion": "v1",
"clusters": [
{
"cluster": {
"certificate-authority-data": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJRXovb2xnZEVCVVF3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TlRFeU1Ea3hNREl6TVRCYUZ3MHpOVEV5TURjeE1ESTRNVEJhTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQ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pJVVhQYW1QUWJLcXdZdTRobWJzd01nU0gzbGRJZ2FNTW85Sm5TSUxtS1NXaFBibGJNbmRuTmNNSnRVeHkKUzJHWXpENlAxWUNkCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K",
"server": "https://ED76BE4472A3EADBEC948C8F57060394.gr7.us-east-1.eks.amazonaws.com"
},
"name": "alexhunt-eks"
}
],
"contexts": [
{
"context": {
"cluster": "alexhunt-eks",
"user": "alexhunt-eks"
},
"name": "alexhunt-eks"
}
],
"current-context": "alexhunt-eks",
"kind": "Config",
"users": [
{
"name": "alexhunt-eks",
"user": {
"exec": {
"apiVersion": "client.authentication.k8s.io/v1beta1",
"args": [
"eks",
"get-token",
"--cluster-name",
"alexhunt-eks",
"--region",
"us-east-1",
"--profile",
"mz-scratch-admin"
],
"command": "aws"
}
}
}
]
}@kay-kim Could you reproduce this and share the contents of your diff --git a/aws/modules/karpenter-nodepool/main.tf b/aws/modules/karpenter-nodepool/main.tf
index be1c8c6..8b727bf 100644
--- a/aws/modules/karpenter-nodepool/main.tf
+++ b/aws/modules/karpenter-nodepool/main.tf
@@ -15,6 +15,7 @@ resource "terraform_data" "destroyer" {
command = <<-EOF
set -euo pipefail
+ echo "$${KUBECONFIG_DATA}" > /tmp/kubeconfig
nodeclaims=$(kubectl --kubeconfig <(echo "$${KUBECONFIG_DATA}") get nodeclaims -l "karpenter.sh/nodepool=$${NODEPOOL_NAME}" -o name)
if [ -n "$${nodeclaims}" ]; then
echo "$${nodeclaims}" | xargs kubectl --kubeconfig <(echo "$${KUBECONFIG_DATA}") delete --wait=true |
|
Will do.
So, will try the deploy -> upgrade -> destroy on AWS this morning. (Before, I didn't do the upgrade, just deploy -> destroy .. but want to double check the upgrade steps while I have the deployment up) |
|
@jshiwamV --- we think we tracked it down to the fact that I'm on a mac and so, using |
|
As an FYI -- this branch does indeed fix the local-exec; However, locally rebasing this branch with main, I hit an error with 38 objects remaining The offending item seems to be an ENI returns |

Pre-requisites.