Skip to content

Commit

Permalink
remove redundant spec.label from linodevpc and linodemachine resources (
Browse files Browse the repository at this point in the history
  • Loading branch information
eljohnson92 authored Mar 14, 2024
1 parent 3982494 commit 9fbfbc2
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ docs:

.PHONY: test
test: generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -race -timeout 60s ./... -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(CACHE_BIN) -p path)" go test -race -timeout 60s ./... -coverprofile cover.out

.PHONY: e2etest
e2etest: generate local-deploy chainsaw
Expand Down
7 changes: 1 addition & 6 deletions api/v1alpha1/linodemachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ type LinodeMachineSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
Type string `json:"type"`
// +kubebuilder:validation:MinLength=3
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
// +optional
Label string `json:"label,omitempty"`
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
Group string `json:"group,omitempty"`
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
Expand Down Expand Up @@ -198,7 +193,7 @@ func (lm *LinodeMachine) SetConditions(conditions clusterv1.Conditions) {
lm.Status.Conditions = conditions
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// LinodeMachineList contains a list of LinodeMachine
type LinodeMachineList struct {
Expand Down
12 changes: 3 additions & 9 deletions api/v1alpha1/linodevpc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ import (
type LinodeVPCSpec struct {
// +optional
VPCID *int `json:"vpcID,omitempty"`

// +kubebuilder:validation:MinLength=3
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
// +optional
Label string `json:"label,omitempty"`
// +optional
Description string `json:"description,omitempty"`
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
Expand Down Expand Up @@ -109,8 +103,8 @@ type LinodeVPCStatus struct {
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// LinodeVPC is the Schema for the linodemachines API
type LinodeVPC struct {
Expand All @@ -129,7 +123,7 @@ func (lm *LinodeVPC) SetConditions(conditions clusterv1.Conditions) {
lm.Status.Conditions = conditions
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// LinodeVPCList contains a list of LinodeVPC
type LinodeVPCList struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,6 @@ spec:
x-kubernetes-validations:
- message: Value is immutable
rule: self == oldSelf
label:
maxLength: 63
minLength: 3
type: string
x-kubernetes-validations:
- message: Value is immutable
rule: self == oldSelf
metadata:
description: InstanceMetadataOptions defines metadata of instance
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@ spec:
x-kubernetes-validations:
- message: Value is immutable
rule: self == oldSelf
label:
maxLength: 63
minLength: 3
type: string
x-kubernetes-validations:
- message: Value is immutable
rule: self == oldSelf
metadata:
description: InstanceMetadataOptions defines metadata of instance
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ spec:
x-kubernetes-map-type: atomic
description:
type: string
label:
maxLength: 63
minLength: 3
type: string
x-kubernetes-validations:
- message: Value is immutable
rule: self == oldSelf
region:
type: string
x-kubernetes-validations:
Expand Down
1 change: 0 additions & 1 deletion controller/linodemachine_controller_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func TestLinodeMachineSpecToCreateInstanceConfig(t *testing.T) {
machineSpec := infrav1alpha1.LinodeMachineSpec{
Region: "region",
Type: "type",
Label: "label",
Group: "group",
RootPass: "rootPass",
AuthorizedKeys: []string{"key"},
Expand Down
6 changes: 1 addition & 5 deletions controller/linodevpc_controller_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ func (r *LinodeVPCReconciler) reconcileVPC(ctx context.Context, vpcScope *scope.

return err
}
if createConfig.Label == "" {
createConfig.Label = vpcScope.LinodeVPC.Name
}

createConfig.Label = vpcScope.LinodeVPC.Name
listFilter := util.Filter{
ID: vpcScope.LinodeVPC.Spec.VPCID,
Label: createConfig.Label,
Expand All @@ -55,7 +53,6 @@ func (r *LinodeVPCReconciler) reconcileVPC(ctx context.Context, vpcScope *scope.
} else if len(vpcs) != 0 {
// Labels are unique
vpcScope.LinodeVPC.Spec.VPCID = &vpcs[0].ID
vpcScope.LinodeVPC.Spec.Label = vpcs[0].Label

return nil
}
Expand All @@ -73,7 +70,6 @@ func (r *LinodeVPCReconciler) reconcileVPC(ctx context.Context, vpcScope *scope.
return err
}

vpcScope.LinodeVPC.Spec.Label = vpc.Label
vpcScope.LinodeVPC.Spec.VPCID = &vpc.ID

return nil
Expand Down
1 change: 0 additions & 1 deletion controller/linodevpc_controller_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func TestLinodeVPCSpecToCreateVPCConfig(t *testing.T) {
t.Parallel()

vpcSpec := infrav1alpha1.LinodeVPCSpec{
Label: "label",
Description: "description",
Region: "region",
Subnets: []infrav1alpha1.VPCSubnetCreateOptions{
Expand Down

0 comments on commit 9fbfbc2

Please sign in to comment.