Skip to content

Commit 64dbda2

Browse files
authored
remove redundant spec.label from linodevpc and linodemachine resources (#192)
1 parent 6cfe528 commit 64dbda2

9 files changed

+6
-44
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ docs:
140140

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

145145
.PHONY: e2etest
146146
e2etest: generate local-deploy chainsaw

api/v1alpha1/linodemachine_types.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ type LinodeMachineSpec struct {
4242
// +kubebuilder:validation:Required
4343
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
4444
Type string `json:"type"`
45-
// +kubebuilder:validation:MinLength=3
46-
// +kubebuilder:validation:MaxLength=63
47-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
48-
// +optional
49-
Label string `json:"label,omitempty"`
5045
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
5146
Group string `json:"group,omitempty"`
5247
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
@@ -198,7 +193,7 @@ func (lm *LinodeMachine) SetConditions(conditions clusterv1.Conditions) {
198193
lm.Status.Conditions = conditions
199194
}
200195

201-
//+kubebuilder:object:root=true
196+
// +kubebuilder:object:root=true
202197

203198
// LinodeMachineList contains a list of LinodeMachine
204199
type LinodeMachineList struct {

api/v1alpha1/linodevpc_types.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ import (
2929
type LinodeVPCSpec struct {
3030
// +optional
3131
VPCID *int `json:"vpcID,omitempty"`
32-
33-
// +kubebuilder:validation:MinLength=3
34-
// +kubebuilder:validation:MaxLength=63
35-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
36-
// +optional
37-
Label string `json:"label,omitempty"`
3832
// +optional
3933
Description string `json:"description,omitempty"`
4034
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
@@ -109,8 +103,8 @@ type LinodeVPCStatus struct {
109103
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
110104
}
111105

112-
//+kubebuilder:object:root=true
113-
//+kubebuilder:subresource:status
106+
// +kubebuilder:object:root=true
107+
// +kubebuilder:subresource:status
114108

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

132-
//+kubebuilder:object:root=true
126+
// +kubebuilder:object:root=true
133127

134128
// LinodeVPCList contains a list of LinodeVPC
135129
type LinodeVPCList struct {

config/crd/bases/infrastructure.cluster.x-k8s.io_linodemachines.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,6 @@ spec:
161161
x-kubernetes-validations:
162162
- message: Value is immutable
163163
rule: self == oldSelf
164-
label:
165-
maxLength: 63
166-
minLength: 3
167-
type: string
168-
x-kubernetes-validations:
169-
- message: Value is immutable
170-
rule: self == oldSelf
171164
metadata:
172165
description: InstanceMetadataOptions defines metadata of instance
173166
properties:

config/crd/bases/infrastructure.cluster.x-k8s.io_linodemachinetemplates.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,6 @@ spec:
150150
x-kubernetes-validations:
151151
- message: Value is immutable
152152
rule: self == oldSelf
153-
label:
154-
maxLength: 63
155-
minLength: 3
156-
type: string
157-
x-kubernetes-validations:
158-
- message: Value is immutable
159-
rule: self == oldSelf
160153
metadata:
161154
description: InstanceMetadataOptions defines metadata of instance
162155
properties:

config/crd/bases/infrastructure.cluster.x-k8s.io_linodevpcs.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ spec:
5656
x-kubernetes-map-type: atomic
5757
description:
5858
type: string
59-
label:
60-
maxLength: 63
61-
minLength: 3
62-
type: string
63-
x-kubernetes-validations:
64-
- message: Value is immutable
65-
rule: self == oldSelf
6659
region:
6760
type: string
6861
x-kubernetes-validations:

controller/linodemachine_controller_helpers_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ func TestLinodeMachineSpecToCreateInstanceConfig(t *testing.T) {
2020
machineSpec := infrav1alpha1.LinodeMachineSpec{
2121
Region: "region",
2222
Type: "type",
23-
Label: "label",
2423
Group: "group",
2524
RootPass: "rootPass",
2625
AuthorizedKeys: []string{"key"},

controller/linodevpc_controller_helpers.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ func (r *LinodeVPCReconciler) reconcileVPC(ctx context.Context, vpcScope *scope.
3939

4040
return err
4141
}
42-
if createConfig.Label == "" {
43-
createConfig.Label = vpcScope.LinodeVPC.Name
44-
}
4542

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

6057
return nil
6158
}
@@ -73,7 +70,6 @@ func (r *LinodeVPCReconciler) reconcileVPC(ctx context.Context, vpcScope *scope.
7370
return err
7471
}
7572

76-
vpcScope.LinodeVPC.Spec.Label = vpc.Label
7773
vpcScope.LinodeVPC.Spec.VPCID = &vpc.ID
7874

7975
return nil

controller/linodevpc_controller_helpers_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ func TestLinodeVPCSpecToCreateVPCConfig(t *testing.T) {
1515
t.Parallel()
1616

1717
vpcSpec := infrav1alpha1.LinodeVPCSpec{
18-
Label: "label",
1918
Description: "description",
2019
Region: "region",
2120
Subnets: []infrav1alpha1.VPCSubnetCreateOptions{

0 commit comments

Comments
 (0)