@@ -46,7 +46,33 @@ type HCloudMachineSpec struct {
4646 // ImageName is the reference to the Machine Image from which to create the machine instance.
4747 // It can reference an image uploaded to Hetzner API in two ways: either directly as the name of an image or as the label of an image.
4848 // +kubebuilder:validation:MinLength=1
49- ImageName string `json:"imageName"`
49+ // +kubebuilder:validation:Optional
50+ // +optional
51+ ImageName string `json:"imageName,omitempty"`
52+
53+ // ImageURL gets used for installing custom node images. If that field is set, the controller
54+ // boots a new HCloud machine into rescue mode. Then the script provided by
55+ // --hcloud-image-url-command (which you need to provide to the controller binary) will be
56+ // copied into the rescue system and executed.
57+ //
58+ // The controller uses url.ParseRequestURI (Go function) to validate the URL.
59+ //
60+ // It is up to the script to provision the disk of the hcloud machine accordingly. The process
61+ // is considered successful if the last line in the output contains
62+ // IMAGE_URL_DONE. If the script terminates with a different last line, then
63+ // the process is considered to have failed.
64+ //
65+ // A Kubernetes event will be created in both (success, failure) cases containing the output
66+ // (stdout and stderr) of the script. If the script takes longer than 7 minutes, the
67+ // controller cancels the provisioning.
68+ //
69+ // Docs: https://syself.com/docs/caph/developers/image-url-command
70+ //
71+ // ImageURL is mutually exclusive to "ImageName".
72+ // +kubebuilder:validation:MinLength=1
73+ // +kubebuilder:validation:Optional
74+ // +optional
75+ ImageURL string `json:"imageURL,omitempty"`
5076
5177 // SSHKeys define machine-specific SSH keys and override cluster-wide SSH keys.
5278 // +optional
@@ -99,16 +125,35 @@ type HCloudMachineStatus struct {
99125
100126 // BootState indicates the current state during provisioning.
101127 //
102- // The states will be:
103- // "" -> BootToRealOS -> OperatingSystemRunning
128+ // If Spec.ImageName is set the states will be:
129+ // 1. BootingToRealOS
130+ // 2. OperatingSystemRunning
104131 //
132+ // If Spec.ImageURL is set the states will be:
133+ // 1. Initializing
134+ // 2. EnablingRescue
135+ // 3. BootingToRescue
136+ // 4. RunningImageCommand
137+ // 5. BootingToRealOS
138+ // 6. OperatingSystemRunning
139+
105140 // +optional
106141 BootState HCloudBootState `json:"bootState"`
107142
108143 // BootStateSince is the timestamp of the last change to BootState. It is used to timeout
109144 // provisioning if a state takes too long.
110145 // +optional
111146 BootStateSince metav1.Time `json:"bootStateSince,omitzero"`
147+
148+ // ExternalIDs contains temporary data during the provisioning process
149+ ExternalIDs HCloudMachineStatusExternalIDs `json:"externalIDs,omitempty"`
150+ }
151+
152+ // HCloudMachineStatusExternalIDs holds temporary data during the provisioning process.
153+ type HCloudMachineStatusExternalIDs struct {
154+ // ActionIDEnableRescueSystem is the hcloud API Action result of EnableRescueSystem.
155+ // +optional
156+ ActionIDEnableRescueSystem int64 `json:"actionIdEnableRescueSystem,omitzero"`
112157}
113158
114159// HCloudMachine is the Schema for the hcloudmachines API.
0 commit comments