cloudbase / garm-provider-gcp

Garm external provider for GCP
https://github.com/cloudbase/garm-provider-gcp
Apache License 2.0
1 stars 5 forks source link

Not necessarily issue, looking for advice/guidance on a couple topics #30

Open Hdom opened 1 month ago

Hdom commented 1 month ago
fabi200123 commented 3 weeks ago

Hello @Hdom, Regarding the first part, the answer is thatsysprep-specialize-script-ps1 runs just once, during the initial boot, which was done already when you created the custom image. This is the order of script execution On the other hand, windows-startup-script-ps1 runs First during each boot after the initial boot, which may cause problems, based on the script used.

Also, can youu describe more the issue regarding Windows startup script ran "too fast",?

gabriel-samfira commented 3 weeks ago

@fabi200123 I think networking comes up after the script runs, and the script simply fails because it has no network connectivity. This is a transient error and should be retried.

Here is an example of a commandlet that retries an operation:

https://github.com/cloudbase/juju-powershell-modules/blob/4874a6c65fb737bb8e2fc38e144762c1d50b444d/JujuUtils/JujuUtils.psm1#L298-L366

We could integrate something like that into the Windows userdata wherever it's needed. The curl command line has the retry flag, but the Windows equivalents do not. So they will most likely need to be wrapped.

Once Windows Server 2016 reaches EoL, we can use curl.exe on Windows as well, but until then, let's see how we can incorporate the above commandlet (or something similar).

Hdom commented 3 weeks ago

Hello @Hdom, Regarding the first part, the answer is thatsysprep-specialize-script-ps1 runs just once, during the initial boot, which was done already when you created the custom image. This is the order of script execution On the other hand, windows-startup-script-ps1 runs First during each boot after the initial boot, which may cause problems, based on the script used.

Also, can youu describe more the issue regarding Windows startup script ran "too fast",?

So would we need a feature to allow configuring custom images to run with windows-startup-script-ps1?

@fabi200123 I think networking comes up after the script runs, and the script simply fails because it has no network connectivity. This is a transient error and should be retried.

Here is an example of a commandlet that retries an operation:

https://github.com/cloudbase/juju-powershell-modules/blob/4874a6c65fb737bb8e2fc38e144762c1d50b444d/JujuUtils/JujuUtils.psm1#L298-L366

We could integrate something like that into the Windows userdata wherever it's needed. The curl command line has the retry flag, but the Windows equivalents do not. So they will most likely need to be wrapped.

Once Windows Server 2016 reaches EoL, we can use curl.exe on Windows as well, but until then, let's see how we can incorporate the above commandlet (or something similar).

Yes that is exactly right, most likely just need a retry a couple times and sleep between retries.

fabi200123 commented 3 weeks ago

Regarding the windows-startup-script-ps1, we should be able to add it as an extra-spec field and just add it to the instance's metadata. What do you think @gabriel-samfira?

gabriel-samfira commented 3 weeks ago

@Hdom when you created your custom image, did you run GCESysprep on it as described here:

https://cloud.google.com/compute/docs/instances/windows/creating-windows-os-image#prepare_server_image

This should generalize the image and set it in a state where it will run sysprep-specialize-script-ps1

Hdom commented 3 weeks ago

@gabriel-samfira that's probably what it is, no, I wasn't aware of the GCESysprep, I will give it a try, thank you.