Skip to content
Open
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
4 changes: 4 additions & 0 deletions apis/metal3.io/v1alpha1/baremetalhost_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ const (
type DetachedAnnotationArguments struct {
// DeleteAction indicates the desired delete logic when the detached annotation is present
DeleteAction DetachedDeleteAction `json:"deleteAction,omitempty"`
// Manager is an informal flag that tells that the annotation was set by an administrator.
// HostClaim controller will always set it to false and will never delete an annotation with
// manager set to true.
Manager bool `json:"manager,omitempty"`
}

// Match compares the saved status information with the name and
Expand Down
3 changes: 3 additions & 0 deletions apis/metal3.io/v1alpha1/hostdeploypolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type HostDeployPolicySpec struct {
// HostClaimNamespaces constrains the namespaces of the HostClaims allowed
// to bind the BareMetalHosts in the same namespace as the HostDeployPolicy
HostClaimNamespaces *HostClaimNamespaces `json:"hostClaimNamespaces,omitempty"`
// AllowsDetachedMode is a boolean flag specifying if the hostClaim can set the
// detached annotation of the BareMetalHost.
AllowsDetachedMode bool `json:"allowsDetachedMode,omitempty"`
}

type HostClaimNamespaces struct {
Expand Down
5 changes: 5 additions & 0 deletions config/base/crds/bases/metal3.io_hostdeploypolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ spec:
spec:
description: HostDeployPolicySpec defines the desired state of HostDeployPolicy.
properties:
allowsDetachedMode:
description: |-
AllowsDetachedMode is a boolean flag specifying if the hostClaim can set the
detached annotation of the BareMetalHost.
type: boolean
hostClaimNamespaces:
description: |-
HostClaimNamespaces constrains the namespaces of the HostClaims allowed
Expand Down
5 changes: 5 additions & 0 deletions config/render/capm3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,11 @@ spec:
spec:
description: HostDeployPolicySpec defines the desired state of HostDeployPolicy.
properties:
allowsDetachedMode:
description: |-
AllowsDetachedMode is a boolean flag specifying if the hostClaim can set the
detached annotation of the BareMetalHost.
type: boolean
hostClaimNamespaces:
description: |-
HostClaimNamespaces constrains the namespaces of the HostClaims allowed
Expand Down
7 changes: 6 additions & 1 deletion internal/testutil/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (hb *HostClaimBuilder) SetMetaData(mdata string) *HostClaimBuilder {
return hb
}

func (hb *HostClaimBuilder) SetNetworData(ndata string) *HostClaimBuilder {
func (hb *HostClaimBuilder) SetNetworkData(ndata string) *HostClaimBuilder {
hb.hostClaim.Spec.NetworkData = &corev1.SecretReference{Name: ndata}
return hb
}
Expand Down Expand Up @@ -360,3 +360,8 @@ func (hb *HostDeployPolicyBuilder) AcceptRegexp(re string) *HostDeployPolicyBuil
spec.HostClaimNamespaces.NameMatches = re
return hb
}

func (hb *HostDeployPolicyBuilder) AllowsDetachedMode() *HostDeployPolicyBuilder {
hb.hostDeployPolicy.Spec.AllowsDetachedMode = true
return hb
}
Loading