Skip to content

Commit

Permalink
Merge pull request #958 from jacobweinstock/remove-default-hw-state
Browse files Browse the repository at this point in the history
Remove default value for Hardware.Spec.Metadata.State:

## Description

<!--- Please describe what this PR is going to change -->
This default value doesn't make sense from a holistic point of view. Apply a Hardware object to a cluster doesn't by default indicate the hardware is in a provisioning state and we should not assume this with a default value. It was added as part of some CAPT refactoring. #669 If CAPT needs this state then the responsibility is on CAPT to set this. Also, this field is no longer used by Smee or CAPT.

## Why is this needed

<!--- Link to issue you have raised -->

Fixes: #

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->


## How are existing users impacted? What migration steps/scripts do we need?

<!--- Fixes a bug, unblocks installation, removes a component of the stack etc -->
<!--- Requires a DB migration script, etc. -->


## Checklist:

I have:

- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
  • Loading branch information
jacobweinstock authored Jul 5, 2024
2 parents 81fcfe6 + 45f163e commit 376c9ae
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PROTOC_GEN_GO_GRPC := $(TOOLS_DIR)/protoc-gen-go-grpc
PROTOC_GEN_GO_VER := v1.28
PROTOC_GEN_GO := $(TOOLS_DIR)/protoc-gen-go

CONTROLLER_GEN_VER := v0.14
CONTROLLER_GEN_VER := v0.15
CONTROLLER_GEN := $(TOOLS_DIR)/controller-gen-$(CONTROLLER_GEN_VER)

KUSTOMIZE_VER := v4.5
Expand Down
1 change: 0 additions & 1 deletion api/v1alpha1/hardware_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ type IP struct {
}

type HardwareMetadata struct {
// +kubebuilder:default:=provisioning
State string `json:"state,omitempty"`
BondingMode int64 `json:"bonding_mode,omitempty"`
Manufacturer *MetadataManufacturer `json:"manufacturer,omitempty"`
Expand Down
17 changes: 13 additions & 4 deletions config/crd/bases/tinkerbell.org_hardware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
name: hardware.tinkerbell.org
spec:
group: tinkerbell.org
Expand Down Expand Up @@ -343,7 +343,6 @@ spec:
type: string
type: object
state:
default: provisioning
type: string
type: object
resources:
Expand Down Expand Up @@ -416,10 +415,15 @@ spec:
description: BMCRef references a Rufio Machine object.
properties:
name:
default: ""
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
TODO: Add other useful fields. apiVersion, kind, uid?
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
type: string
type: object
x-kubernetes-map-type: atomic
Expand Down Expand Up @@ -520,10 +524,15 @@ spec:
description: OSIE describes the Operating System Installation Environment to be netbooted.
properties:
name:
default: ""
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
TODO: Add other useful fields. apiVersion, kind, uid?
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
type: string
type: object
x-kubernetes-map-type: atomic
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/tinkerbell.org_osies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
name: osies.tinkerbell.org
spec:
group: tinkerbell.org
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/tinkerbell.org_templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
name: templates.tinkerbell.org
spec:
group: tinkerbell.org
Expand Down
16 changes: 13 additions & 3 deletions config/crd/bases/tinkerbell.org_workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
name: workflows.tinkerbell.org
spec:
group: tinkerbell.org
Expand Down Expand Up @@ -180,10 +180,15 @@ spec:
description: HardwareRef is a reference to a Hardware resource this workflow will execute on.
properties:
name:
default: ""
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
TODO: Add other useful fields. apiVersion, kind, uid?
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
type: string
type: object
x-kubernetes-map-type: atomic
Expand All @@ -201,10 +206,15 @@ spec:
description: TemplateRef is a reference to a Template resource used to render workflow actions.
properties:
name:
default: ""
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
TODO: Add other useful fields. apiVersion, kind, uid?
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
type: string
type: object
x-kubernetes-map-type: atomic
Expand Down

0 comments on commit 376c9ae

Please sign in to comment.