Skip to content

Commit

Permalink
馃尡 Update hetznerbaremetalhost_types.go (#1171)
Browse files Browse the repository at this point in the history
Update hetznerbaremetalhost_types.go
  • Loading branch information
Sayanta66 committed Feb 29, 2024
1 parent 6146bc3 commit e106cc5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 25 deletions.
13 changes: 10 additions & 3 deletions api/v1beta1/hetznerbaremetalhost_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ const (

// RootDeviceHints holds the hints for specifying the storage location
// for the root filesystem for the image. Need to specify either WWN or raid
// to provision host machine successfully.
// to provision the host machine successfully. It is important to find the correct root device.
// If none are specified, the host will stop provisioning in between to wait for
// the details to be specified. HardwareDetails in the host's status can be used to find the correct device.
// Currently, you can specify one disk or a raid setup.
type RootDeviceHints struct {
// Unique storage identifier. The hint must match the actual value
// exactly.
Expand Down Expand Up @@ -172,6 +175,7 @@ type RebootAnnotationArguments struct {
// HetznerBareMetalHostSpec defines the desired state of HetznerBareMetalHost.
type HetznerBareMetalHostSpec struct {
// ServerID defines the ID of the server provided by Hetzner.
// Find it on your Hetzner robot dashboard.
ServerID int `json:"serverID"`

// Provide guidance about how to choose the device for the image
Expand All @@ -188,11 +192,14 @@ type HetznerBareMetalHostSpec struct {
// and won't be selected by any Hetzner bare metal machine.
MaintenanceMode *bool `json:"maintenanceMode,omitempty"`

// Description is a human-entered text used to help identify the host
// Description is a human-entered text used to help identify the host.
// It can be used to store some valuable information about the host.
// +optional
Description string `json:"description,omitempty"`

// Status contains all status information. DO NOT EDIT!!!
// Status contains all status information. The controller writes this status.
// As some cannot be regenerated during any reconcilement, the status
// is in the specs of the object - not the actual status. DO NOT EDIT!!!
// +optional
Status ControllerGeneratedStatus `json:"status,omitempty"`
}
Expand Down
61 changes: 39 additions & 22 deletions api/v1beta1/hetznerbaremetalmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ const (

// HetznerBareMetalMachineSpec defines the desired state of HetznerBareMetalMachine.
type HetznerBareMetalMachineSpec struct {
// ProviderID will be the hetznerbaremetalmachine in ProviderID format
// (hcloud://<server-id>)
// ProviderID will be the hetznerbaremetalmachine which is set by the controller

Check failure on line 65 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)
// in the `hcloud://<server-id>` format.
// +optional
ProviderID *string `json:"providerID,omitempty"`

// InstallImage is the configuration which is used for the autosetup configuration for installing an OS via InstallImage.
// InstallImage is the configuration that is used for the autosetup configuration for installing an OS via InstallImage.
InstallImage InstallImage `json:"installImage"`

// HostSelector specifies matching criteria for labels on HetznerBareMetalHosts.
Expand All @@ -76,85 +76,102 @@ type HetznerBareMetalMachineSpec struct {
// +optional
HostSelector HostSelector `json:"hostSelector,omitempty"`

// SSHSpec gives a reference on the secret where SSH details are specified as well as ports for ssh.
// SSHSpec gives a reference on the secret where SSH details are specified as well as ports for SSH.
SSHSpec SSHSpec `json:"sshSpec,omitempty"`
}

// HostSelector specifies matching criteria for labels on BareMetalHosts.
// This is used to limit the set of BareMetalHost objects considered for
// claiming for a Machine.
type HostSelector struct {
// Key/value pairs of labels that must exist on a chosen BareMetalHost
// MatchLabels defines the key/value pairs of labels that must exist on a chosen BareMetalHost.
// +optional
MatchLabels map[string]string `json:"matchLabels,omitempty"`

// Label match expressions that must be true on a chosen BareMetalHost
// MatchExpressions defines the label match expressions that must be true on a chosen BareMetalHost.
// +optional
MatchExpressions []HostSelectorRequirement `json:"matchExpressions,omitempty"`
}

// HostSelectorRequirement defines a requirement used for MatchExpressions to select host machines.
type HostSelectorRequirement struct {
// Key defines the key of the label that should be matched in the host object.
Key string `json:"key"`

Check failure on line 99 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)

// Operator defines the [selection operator](https://pkg.go.dev/k8s.io/apimachinery@v0.23.4/pkg/selection?utm_source=gopls#Operator).
Operator selection.Operator `json:"operator"`

Check failure on line 103 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)
// Values define the values whose relation to the label value in the host machine is defined by the selection operator.
Values []string `json:"values"`

Check failure on line 105 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)
}

// SSHSpec defines specs for SSH.
type SSHSpec struct {
// SecretRef gives reference to the secret.
// SecretRef gives reference to the secret where the SSH key is stored.
SecretRef SSHSecretRef `json:"secretRef"`

// PortAfterInstallImage specifies the port that has to be used to connect to the machine after install image.
// PortAfterInstallImage specifies the port that has to be used to connect to the machine

Check failure on line 113 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)
// by reaching the server via SSH after installing the image successfully.
// +kubebuilder:default=22
// +optional
PortAfterInstallImage int `json:"portAfterInstallImage"`

// PortAfterCloudInit specifies the port that has to be used to connect to the machine after cloud init.
// PortAfterCloudInit specifies the port that has to be used to connect to the machine

Check failure on line 119 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)
// by reaching the server via SSH after the successful completion of cloud init.
// +optional
PortAfterCloudInit int `json:"portAfterCloudInit"`
}

// SSHSecretRef defines the secret containing all information of the SSH key used for Hetzner robot.
// SSHSecretRef defines the secret containing all information of the SSH key used for the Hetzner robot.
type SSHSecretRef struct {
// Name is the name of the secret.
Name string `json:"name"`

Check failure on line 128 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)

// Key contains details about the keys used in the data of the secret.
Key SSHSecretKeyRef `json:"key"`

Check failure on line 131 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)
}

// SSHSecretKeyRef defines the key name of the SSHSecret.
type SSHSecretKeyRef struct {
// Name is the key in the secret's data where the SSH key's name is stored.
Name string `json:"name"`

Check failure on line 137 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)

// PublicKey is the key in the secret's data where the SSH key's public key is stored.
PublicKey string `json:"publicKey"`

Check failure on line 140 in api/v1beta1/hetznerbaremetalmachine_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/syself/cluster-api-provider-hetzner) (gci)

// PrivateKey is the key in the secret's data where the SSH key's private key is stored.
PrivateKey string `json:"privateKey"`
}

// InstallImage defines the configuration for InstallImage.
type InstallImage struct {
// Image is the image to be provisioned.
// Image is the image to be provisioned. It defines the image
// for baremetal machine. Find more details on the image [here](https://github.com/syself/cluster-api-provider-hetzner/blob/main/docs/reference/hetzner-bare-metal-machine-template.md#installimageimage).
Image Image `json:"image"`

// PostInstallScript is used for configuring commands which should be executed after installimage.
// PostInstallScript is used for configuring commands that should be executed after installimage.
// It is passed along with the installimage command.
PostInstallScript string `json:"postInstallScript,omitempty"`

// Partitions defines the additional Partitions to be created.
// Partitions define the additional Partitions to be created in installimage.
Partitions []Partition `json:"partitions"`

// LVMDefinitions defines the logical volume definitions to be created.
// +optional
LVMDefinitions []LVMDefinition `json:"logicalVolumeDefinitions,omitempty"`

// BTRFSDefinitions defines the btrfs subvolume definitions to be created.
// BTRFSDefinitions define the btrfs subvolume definitions to be created.
// +optional
BTRFSDefinitions []BTRFSDefinition `json:"btrfsDefinitions,omitempty"`

// Swraid defines the SWRAID in InstallImage.
// Swraid defines the SWRAID in InstallImage. It enables or disables raids. Set 1 to enable.
// +optional
// +kubebuilder:default=0
// +kubebuilder:validation:Enum=0;1;
Swraid int `json:"swraid"`

// SwraidLevel defines the SWRAIDLEVEL in InstallImage. Ignored if Swraid=0.
// SwraidLevel defines the SWRAIDLEVEL in InstallImage. Only relevant if the raid is enabled.
// Pick one of 0,1,5,6,10. Ignored if Swraid=0.
// +optional
// +kubebuilder:default=1
// +kubebuilder:validation:Enum=0;1;5;6;10;
Expand Down Expand Up @@ -197,18 +214,18 @@ func (image Image) GetDetails() (imagePath string, needsDownload bool, errorMess
// Partition defines the additional Partitions to be created.
type Partition struct {
// Mount defines the mount path for this filesystem.
// or keyword 'lvm' to use this PART as volume group (VG) for LVM
// identifier 'btrfs.X' to use this PART as volume for
// Keyword 'lvm' to use this PART as volume group (VG) for LVM.
// Identifier 'btrfs.X' to use this PART as volume for
// btrfs subvolumes. X can be replaced with a unique
// alphanumeric keyword. NOTE: no support btrfs multi-device volumes
// alphanumeric keyword. NOTE: no support for btrfs multi-device volumes.
Mount string `json:"mount"`

// FileSystem can be ext2, ext3, ext4, btrfs, reiserfs, xfs, swap
// or name of the LVM volume group (VG), if this PART is a VG.
FileSystem string `json:"fileSystem"`

// Size can use the keyword 'all' to assign all the remaining space of the drive to the last partition.
// can use M/G/T for unit specification in MiB/GiB/TiB
// You can use M/G/T for unit specification in MiB/GiB/TiB.
Size string `json:"size"`
}

Expand Down Expand Up @@ -266,11 +283,11 @@ type HetznerBareMetalMachineStatus struct {
Ready bool `json:"ready"`

// Phase represents the current phase of HetznerBareMetalMachineStatus actuation.
// E.g. Pending, Running, Terminating, Failed etc.
// E.g. Pending, Running, Terminating, Failed, etc.
// +optional
Phase clusterv1.MachinePhase `json:"phase,omitempty"`

// Conditions defines current service state of the HetznerBareMetalMachine.
// Conditions define the current service state of the HetznerBareMetalMachine.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}
Expand Down

0 comments on commit e106cc5

Please sign in to comment.