You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// HostPlacement is the type that will be used to configure the placement of AWS instances.
152
+
// This can be configured for default placement (AnyAvailable) and dedicated hosts (DedicatedHost).
153
+
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.affinity == 'DedicatedHost' ? has(self.dedicatedHost) : !has(self.dedicatedHost)",message="dedicatedHost is required when affinity is DedicatedHost, and forbidden otherwise"
154
+
typeHostPlacementstruct {
155
+
// affinity specifies the affinity setting for the instance.
156
+
// Allowed values are AnyAvailable and DedicatedHost.
157
+
// When Affinity is set to DedicatedHost, an instance started onto a specific host always restarts on the same host if stopped. In this scenario, the `dedicatedHost` field must be set.
158
+
// When Affinity is set to AnyAvailable, and you stop and restart the instance, it can be restarted on any available host.
159
+
// +required
160
+
// +unionDiscriminator
161
+
Affinity*HostAffinity`json:"affinity,omitempty"`
162
+
163
+
// dedicatedHost specifies the exact host that an instance should be restarted on if stopped.
164
+
// dedicatedHost is required when 'affinity' is set to DedicatedHost, and forbidden otherwise.
// DedicatedHost represents the configuration for the usage of dedicated host.
183
+
typeDedicatedHoststruct {
184
+
// id identifies the AWS Dedicated Host on which the instance must run.
185
+
// The value must start with "h-" followed by 17 lowercase hexadecimal characters (0-9 and a-f).
186
+
// Must be exactly 19 characters in length.
187
+
// +kubebuilder:validation:XValidation:rule="self.matches('^h-[0-9a-f]{17}$')",message="hostID must start with 'h-' followed by 17 lowercase hexadecimal characters (0-9 and a-f)"
188
+
// +kubebuilder:validation:MinLength=19
189
+
// +kubebuilder:validation:MaxLength=19
190
+
// +required
191
+
IDstring`json:"id,omitempty"`
192
+
193
+
// zone is the availability zone that the dedicated host belongs to
allErrs=append(allErrs, field.Required(fldPath.Child("dedicatedHost"), "dedicatedHost is required when 'affinity' is set to DedicatedHost, and forbidden otherwise"))
76
+
}
77
+
caseaws.HostAffinityDedicatedHost:
78
+
ifp.HostPlacement.DedicatedHost==nil {
79
+
allErrs=append(allErrs, field.Required(fldPath.Child("dedicatedHost"), "dedicatedHost is required when 'affinity' is set to DedicatedHost, and forbidden otherwise"))
allErrs=append(allErrs, field.Invalid(hostPath.Child("id"), host.ID, "id must start with 'h-' followed by 17 lowercase hexadecimal characters (0-9 and a-f)"))
87
+
}
88
+
}
89
+
}
90
+
default:
91
+
allErrs=append(allErrs, field.Invalid(fldPath.Child("affinity"), p.HostPlacement.Affinity, "affinity must be either AnyAvailable or DedicatedHost"))
0 commit comments