Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions api/v1alpha1/applyconfiguration/api/v1alpha1/serverclaimspec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions api/v1alpha1/applyconfiguration/api/v1alpha1/serverspec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions api/v1alpha1/applyconfiguration/api/v1alpha1/taint.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions api/v1alpha1/applyconfiguration/api/v1alpha1/toleration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/v1alpha1/applyconfiguration/utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,71 @@ func PtrToIPPrefix(prefix IPPrefix) *IPPrefix {
func EqualIPPrefixes(a, b IPPrefix) bool {
return a == b
}

// TaintEffect defines the effect of a taint on a ServerClaim.
// +kubebuilder:validation:Enum=NoBind;Evict
type TaintEffect string

const (
// TaintEffectNoBind prevents new ServerClaims from binding to the server
// unless they have a matching toleration.
TaintEffectNoBind TaintEffect = "NoBind"

// TaintEffectEvict is reserved for future use. It does not currently trigger
// eviction of existing ServerClaims bound to the server.
TaintEffectEvict TaintEffect = "Evict"
)

// Taint represents a taint applied to a Server that restricts which
// ServerClaims can be bound to it.
type Taint struct {
// Key is the taint key to be applied to a server.
// +kubebuilder:validation:MinLength=1
// +required
Key string `json:"key"`

// Value is the taint value corresponding to the taint key.
// +optional
Value string `json:"value,omitempty"`

// Effect indicates the effect of the taint on ServerClaims that do not
// tolerate the taint.
// +kubebuilder:default=NoBind
// +optional
Effect TaintEffect `json:"effect,omitempty"`
}

// TolerationOperator represents a key's relationship to a value in a Toleration.
// +kubebuilder:validation:Enum=Equal;Exists
type TolerationOperator string

const (
// TolerationOperatorEqual requires that the key and value of the toleration
// match those of the taint exactly.
TolerationOperatorEqual TolerationOperator = "Equal"

// TolerationOperatorExists matches any taint with the specified key,
// regardless of value.
TolerationOperatorExists TolerationOperator = "Exists"
)

// Toleration allows a ServerClaim to tolerate taints on a Server so that
// the claim can be bound to a server that would otherwise be restricted.
type Toleration struct {
// Key is the taint key that the toleration applies to.
// +kubebuilder:validation:MinLength=1
// +required
Key string `json:"key"`

// Operator represents the key's relationship to the value.
// +optional
Operator TolerationOperator `json:"operator,omitempty"`

// Value is the taint value the toleration matches to.
// +optional
Value string `json:"value,omitempty"`

// Effect indicates the taint effect to tolerate.
// +optional
Effect TaintEffect `json:"effect,omitempty"`
}
4 changes: 4 additions & 0 deletions api/v1alpha1/server_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ type ServerSpec struct {
// the BIOS configuration for this server.
// +optional
BIOSSettingsRef *v1.LocalObjectReference `json:"biosSettingsRef,omitempty"`

// Taints control which ServerClaims can be bound to this server.
// +optional
Taints []Taint `json:"taints,omitempty"`
}

// ServerState defines the possible states of a server.
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/serverclaim_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ type ServerClaimSpec struct {
// Image specifies the boot image to be used for the server.
// +required
Image string `json:"image"`

// Tolerations allow a ServerClaim to bind to a Server with matching taints.
// +optional
Tolerations []Toleration `json:"tolerations,omitempty"`
}

// Phase defines the possible phases of a ServerClaim.
Expand Down
40 changes: 40 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions config/crd/bases/metal.ironcore.dev_serverclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,40 @@ spec:
x-kubernetes-validations:
- message: serverSelector is immutable
rule: self == oldSelf
tolerations:
description: Tolerations allow a ServerClaim to bind to a Server with
matching taints.
items:
description: |-
Toleration allows a ServerClaim to tolerate taints on a Server so that
the claim can be bound to a server that would otherwise be restricted.
properties:
effect:
description: Effect indicates the taint effect to tolerate.
enum:
- NoBind
- Evict
type: string
key:
description: Key is the taint key that the toleration applies
to.
minLength: 1
type: string
operator:
description: Operator represents the key's relationship to the
value.
enum:
- Equal
- Exists
type: string
value:
description: Value is the taint value the toleration matches
to.
type: string
required:
- key
type: object
type: array
required:
- image
- power
Expand Down
Loading
Loading