Skip to content
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

Not working on Windows #680

Closed
maganuk opened this issue Jan 13, 2020 · 8 comments
Closed

Not working on Windows #680

maganuk opened this issue Jan 13, 2020 · 8 comments

Comments

@maganuk
Copy link

maganuk commented Jan 13, 2020

Hi,

I saw that there was a PR added for Windows Compatibility, however in cluster.tf even this line should have the ability to specify a custom interpretor

provisioner "local-exec" {
    command = <<EOT
    until curl -k -s ${aws_eks_cluster.this[0].endpoint}/healthz >/dev/null; do sleep 4; done
  EOT
}

Without that, its not possible to create a cluster

@barryib
Copy link
Member

barryib commented Jan 13, 2020

@maganuk Thanks for opening this issue. There was a long discussion about this on #639 and we called for help to windows users to help is test this. But no luck.

Could you please take a time on this issue and open a PR to fix this ? I can help you with this.

Do you have a working curl (or equivalent) command on Windows to do a HTTP GET on the healthz endpoint ?

@maganuk
Copy link
Author

maganuk commented Jan 13, 2020

I need a day or two to figure this out. Curl is not installed by default on Windows and it would be odd to require the user to install any third party packages. Lets try and figure out if we can do this using terraform. Usually the delay will not be more that 8-10 seconds. Can we not delay the execution of the next step by a few seconds, instead of pinging the url to see if its alive?

@barryib
Copy link
Member

barryib commented Jan 13, 2020

Actually, there is Invoke-RestMethod in powershell https://discoposse.com/2012/06/30/powershell-invoke-restmethod-putting-the-curl-in-your-shell/. Maybe we can use that ?

Usually the delay will not be more that 8-10 seconds.

I think we don't really know how long it'll take. So I'll really prefer pinging until it's alive rather than waiting and hoping that it'll take less than 10 seconds.

@sanjeevgiri
Copy link
Contributor

sanjeevgiri commented Jan 19, 2020

@barryib @maganuk @RothAndrew

I believe Roth had some original changes that were geared for resolving windows issues. That code has now evolved and moved to cluster.tf. The ability to use user defined interpreter is not being used in the code base anymore. I also feel like letting terraform determine the interpreter to use is more ideal paired with my solution to give users the ability to define custom local exec command.

I have a potential fix for this, however I am not able to create a branch for pull request. Is there anyway something I need to do to be able to create a branch?

variables.tf

variable "local_exec_wait_for_cluster_op" {
  type = object({
    wait_for_cluster_cmd = string
    cluster_health_endpoint_placeholder = string
  })
  default = {
    wait_for_cluster_cmd = "until curl -k -s %CLUSTER_HEALTH_ENDPOINT% >/dev/null; do sleep 4; done"
    cluster_health_endpoint_placeholder = "%CLUSTER_HEALTH_ENDPOINT%"
  }
  description = "Custom local-exec command to execute for determining if the eks cluster is healthy"
}

For windows, I'd have to override this variable to

local_exec_wait_for_cluster_op = {
    wait_for_cluster_cmd = "C:/Git/bin/sh.exe -c 'until curl -k -s %CLUSTER_HEALTH_ENDPOINT% >/dev/null; do sleep 4; done'"
  }

cluster.tf

...
provisioner "local-exec" {
    command = replace(
      var.local_exec_wait_for_cluster_op.wait_for_cluster_cmd,
      var.local_exec_wait_for_cluster_op.cluster_health_endpoint_placeholder,
      "${aws_eks_cluster.this[0].endpoint}/healthz"
    )
  }
...

@dpiddockcmp
Copy link
Contributor

@sanjeevgiri

I have a potential fix for this, however I am not able to create a branch for pull request. Is there anyway something I need to do to be able to create a branch?

You need to Fork the repo to your own account using the buttons in the github interface, push your changes there and then open a PR. See github's docs for the full details

@barryib
Copy link
Member

barryib commented Mar 10, 2020

Closing this as the wait command is now configurable.

@barryib barryib closed this as completed Mar 10, 2020
@avoidik
Copy link
Contributor

avoidik commented Mar 14, 2020

wouldn't it be better to make interpreter item configurable?

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants