From 91613df605b1c7a7b50e0b655d4e550c3b30fe92 Mon Sep 17 00:00:00 2001 From: Zhongcheng Lao Date: Mon, 29 Jul 2024 15:34:51 +0800 Subject: [PATCH] Set the system real clock to UTC in cloudbase-init --- images/capi/ansible/windows/example.vars.yml | 1 + .../windows/roles/cloudbase-init/templates/cloudbase-init.conf | 1 + images/capi/packer/config/windows/ansible-args-windows.json | 2 +- images/capi/packer/config/windows/cloudbase-init.json | 3 ++- images/capi/packer/ova/packer-windows.json | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/images/capi/ansible/windows/example.vars.yml b/images/capi/ansible/windows/example.vars.yml index 1fedb31967..b14c29b5b9 100644 --- a/images/capi/ansible/windows/example.vars.yml +++ b/images/capi/ansible/windows/example.vars.yml @@ -31,6 +31,7 @@ cloudbase_metadata_services: cloudbaseinit.metadata.services.azureservice.AzureS cloudbase_plugins: cloudbaseinit.plugins.common.ephemeraldisk.EphemeralDiskPlugin, cloudbaseinit.plugins.common.userdata.UserDataPlugin, cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin cloudbase_metadata_services_unattend: cloudbaseinit.metadata.services.azureservice.AzureService, cloudbaseinit.metadata.services.ovfservice.OvfService cloudbase_plugins_unattend: cloudbaseinit.plugins.common.mtu.MTUPlugin +cloudbase_real_time_clock_utc: true debug_tools: true additional_debug_files: https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/hack/DebugWindowsNode.ps1 diff --git a/images/capi/ansible/windows/roles/cloudbase-init/templates/cloudbase-init.conf b/images/capi/ansible/windows/roles/cloudbase-init/templates/cloudbase-init.conf index cc7d644f72..1608f9123f 100644 --- a/images/capi/ansible/windows/roles/cloudbase-init/templates/cloudbase-init.conf +++ b/images/capi/ansible/windows/roles/cloudbase-init/templates/cloudbase-init.conf @@ -7,6 +7,7 @@ inject_user_password=false user_password_length=123 first_logon_behaviour=no rename_admin_user=true +real_time_clock_utc={{ cloudbase_real_time_clock_utc }} config_drive_raw_hhd=true config_drive_cdrom=true diff --git a/images/capi/packer/config/windows/ansible-args-windows.json b/images/capi/packer/config/windows/ansible-args-windows.json index be86940af5..2954e9808a 100644 --- a/images/capi/packer/config/windows/ansible-args-windows.json +++ b/images/capi/packer/config/windows/ansible-args-windows.json @@ -1,3 +1,3 @@ { - "ansible_common_vars": "runtime={{user `runtime`}} containerd_url={{user `containerd_url`}} containerd_sha256={{user `containerd_sha256_windows`}} pause_image={{user `pause_image`}} additional_debug_files=\"{{user `additional_debug_files`}}\" containerd_additional_settings={{user `containerd_additional_settings`}} custom_role_names=\"{{user `custom_role_names`}}\" http_proxy={{user `http_proxy`}} https_proxy={{user `https_proxy`}} no_proxy={{user `no_proxy`}} kubernetes_base_url={{user `kubernetes_base_url`}} kubernetes_semver={{user `kubernetes_semver`}} kubernetes_install_path={{user `kubernetes_install_path`}} cloudbase_init_url=\"{{user `cloudbase_init_url`}}\" cloudbase_plugins=\"{{user `cloudbase_plugins`}}\" cloudbase_metadata_services=\"{{user `cloudbase_metadata_services`}}\" cloudbase_plugins_unattend=\"{{user `cloudbase_plugins_unattend`}}\" cloudbase_metadata_services_unattend=\"{{user `cloudbase_metadata_services_unattend`}}\" prepull={{user `prepull`}} windows_updates_kbs=\"{{user `windows_updates_kbs`}}\" windows_updates_categories=\"{{user `windows_updates_categories`}}\" windows_service_manager={{user `windows_service_manager`}} nssm_url={{user `nssm_url`}} distribution_version={{user `distribution_version`}} netbios_host_name_compatibility={{user `netbios_host_name_compatibility`}} disable_hypervisor={{ user `disable_hypervisor` }} cloudbase_logging_serial_port={{ user `cloudbase_logging_serial_port` }} load_additional_components={{ user `load_additional_components`}} additional_registry_images={{ user `additional_registry_images`}} additional_registry_images_list={{ user `additional_registry_images_list`}} additional_url_images={{ user `additional_url_images`}} additional_url_images_list={{ user `additional_url_images_list`}} additional_executables={{ user `additional_executables`}} additional_executables_list={{ user `additional_executables_list`}} additional_executables_destination_path={{ user `additional_executables_destination_path`}} ssh_source_url={{user `ssh_source_url` }} debug_tools={{user `debug_tools`}}" + "ansible_common_vars": "runtime={{user `runtime`}} containerd_url={{user `containerd_url`}} containerd_sha256={{user `containerd_sha256_windows`}} pause_image={{user `pause_image`}} additional_debug_files=\"{{user `additional_debug_files`}}\" containerd_additional_settings={{user `containerd_additional_settings`}} custom_role_names=\"{{user `custom_role_names`}}\" http_proxy={{user `http_proxy`}} https_proxy={{user `https_proxy`}} no_proxy={{user `no_proxy`}} kubernetes_base_url={{user `kubernetes_base_url`}} kubernetes_semver={{user `kubernetes_semver`}} kubernetes_install_path={{user `kubernetes_install_path`}} cloudbase_init_url=\"{{user `cloudbase_init_url`}}\" cloudbase_plugins=\"{{user `cloudbase_plugins`}}\" cloudbase_metadata_services=\"{{user `cloudbase_metadata_services`}}\" cloudbase_plugins_unattend=\"{{user `cloudbase_plugins_unattend`}}\" cloudbase_metadata_services_unattend=\"{{user `cloudbase_metadata_services_unattend`}}\" prepull={{user `prepull`}} windows_updates_kbs=\"{{user `windows_updates_kbs`}}\" windows_updates_categories=\"{{user `windows_updates_categories`}}\" windows_service_manager={{user `windows_service_manager`}} nssm_url={{user `nssm_url`}} distribution_version={{user `distribution_version`}} netbios_host_name_compatibility={{user `netbios_host_name_compatibility`}} disable_hypervisor={{ user `disable_hypervisor` }} cloudbase_logging_serial_port={{ user `cloudbase_logging_serial_port` }} cloudbase_real_time_clock_utc={{ user `cloudbase_real_time_clock_utc` }} load_additional_components={{ user `load_additional_components`}} additional_registry_images={{ user `additional_registry_images`}} additional_registry_images_list={{ user `additional_registry_images_list`}} additional_url_images={{ user `additional_url_images`}} additional_url_images_list={{ user `additional_url_images_list`}} additional_executables={{ user `additional_executables`}} additional_executables_list={{ user `additional_executables_list`}} additional_executables_destination_path={{ user `additional_executables_destination_path`}} ssh_source_url={{user `ssh_source_url` }} debug_tools={{user `debug_tools`}}" } diff --git a/images/capi/packer/config/windows/cloudbase-init.json b/images/capi/packer/config/windows/cloudbase-init.json index 81402494e7..9604c3700b 100644 --- a/images/capi/packer/config/windows/cloudbase-init.json +++ b/images/capi/packer/config/windows/cloudbase-init.json @@ -1,3 +1,4 @@ { - "cloudbase_init_version": "1.1.4" + "cloudbase_init_version": "1.1.4", + "cloudbase_real_time_clock_utc": "false" } diff --git a/images/capi/packer/ova/packer-windows.json b/images/capi/packer/ova/packer-windows.json index 3502960ee3..35bce6c9b4 100644 --- a/images/capi/packer/ova/packer-windows.json +++ b/images/capi/packer/ova/packer-windows.json @@ -243,6 +243,7 @@ "cloudbase_metadata_services_unattend": "cloudbaseinit.metadata.services.vmwareguestinfoservice.VMwareGuestInfoService", "cloudbase_plugins": "cloudbaseinit.plugins.windows.createuser.CreateUserPlugin, cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin, cloudbaseinit.plugins.common.mtu.MTUPlugin, cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin, cloudbaseinit.plugins.common.networkconfig.NetworkConfigPlugin, cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin, cloudbaseinit.plugins.common.ephemeraldisk.EphemeralDiskPlugin, cloudbaseinit.plugins.common.sshpublickeys.SetUserSSHPublicKeysPlugin, cloudbaseinit.plugins.common.userdata.UserDataPlugin, cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin, cloudbaseinit.plugins.windows.createuser.CreateUserPlugin, cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin", "cloudbase_plugins_unattend": "cloudbaseinit.plugins.common.mtu.MTUPlugin", + "cloudbase_real_time_clock_utc": "true", "containerd_sha256": null, "containerd_url": "", "containerd_version": null,