Skip to content

Commit 87ed0eb

Browse files
committed
bump k8s 1.34: fix typemeta being removed from fake client
1 parent aa05c41 commit 87ed0eb

File tree

2 files changed

+1
-56
lines changed

2 files changed

+1
-56
lines changed

pkg/controller/machinehealthcheck/machinehealthcheck_controller_test.go

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
11581158
machines: []*machinev1.Machine{
11591159
machine1,
11601160
{
1161-
TypeMeta: metav1.TypeMeta{Kind: "Machine"},
11621161
ObjectMeta: metav1.ObjectMeta{
11631162
Annotations: make(map[string]string),
11641163
Name: "noMatch",
@@ -1179,10 +1178,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
11791178
},
11801179
Labels: map[string]string{},
11811180
},
1182-
TypeMeta: metav1.TypeMeta{
1183-
Kind: "Node",
1184-
APIVersion: "v1",
1185-
},
11861181
Status: corev1.NodeStatus{
11871182
Conditions: []corev1.NodeCondition{},
11881183
},
@@ -1196,9 +1191,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
11961191
},
11971192
Labels: map[string]string{},
11981193
},
1199-
TypeMeta: metav1.TypeMeta{
1200-
Kind: "Node",
1201-
},
12021194
Status: corev1.NodeStatus{
12031195
Conditions: []corev1.NodeCondition{},
12041196
},
@@ -1219,10 +1211,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
12191211
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
12201212
ResourceVersion: "999",
12211213
},
1222-
TypeMeta: metav1.TypeMeta{
1223-
Kind: "Node",
1224-
APIVersion: "v1",
1225-
},
12261214
Status: corev1.NodeStatus{
12271215
Conditions: []corev1.NodeCondition{},
12281216
},
@@ -1247,10 +1235,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
12471235
},
12481236
Labels: map[string]string{},
12491237
},
1250-
TypeMeta: metav1.TypeMeta{
1251-
Kind: "Node",
1252-
APIVersion: "v1",
1253-
},
12541238
Status: corev1.NodeStatus{
12551239
Conditions: []corev1.NodeCondition{},
12561240
},
@@ -1264,10 +1248,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
12641248
},
12651249
Labels: map[string]string{},
12661250
},
1267-
TypeMeta: metav1.TypeMeta{
1268-
Kind: "Node",
1269-
APIVersion: "v1",
1270-
},
12711251
Status: corev1.NodeStatus{
12721252
Conditions: []corev1.NodeCondition{},
12731253
},
@@ -1288,10 +1268,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
12881268
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
12891269
ResourceVersion: "999",
12901270
},
1291-
TypeMeta: metav1.TypeMeta{
1292-
Kind: "Node",
1293-
APIVersion: "v1",
1294-
},
12951271
Status: corev1.NodeStatus{
12961272
Conditions: []corev1.NodeCondition{},
12971273
},
@@ -1311,10 +1287,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
13111287
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
13121288
ResourceVersion: "999",
13131289
},
1314-
TypeMeta: metav1.TypeMeta{
1315-
Kind: "Node",
1316-
APIVersion: "v1",
1317-
},
13181290
Status: corev1.NodeStatus{
13191291
Conditions: []corev1.NodeCondition{},
13201292
},
@@ -1327,7 +1299,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
13271299
mhc: mhc,
13281300
machines: []*machinev1.Machine{
13291301
{
1330-
TypeMeta: metav1.TypeMeta{Kind: "Machine"},
13311302
ObjectMeta: metav1.ObjectMeta{
13321303
Annotations: make(map[string]string),
13331304
Name: "noNodeRef",
@@ -1344,7 +1315,6 @@ func TestGetTargetsFromMHC(t *testing.T) {
13441315
{
13451316
MHC: *mhc,
13461317
Machine: machinev1.Machine{
1347-
TypeMeta: metav1.TypeMeta{Kind: "Machine"},
13481318
ObjectMeta: metav1.ObjectMeta{
13491319
Annotations: make(map[string]string),
13501320
Name: "noNodeRef",
@@ -1415,7 +1385,6 @@ func TestGetNodeFromMachine(t *testing.T) {
14151385
{
14161386
testCase: "match",
14171387
machine: &machinev1.Machine{
1418-
TypeMeta: metav1.TypeMeta{Kind: "Machine"},
14191388
ObjectMeta: metav1.ObjectMeta{
14201389
Annotations: make(map[string]string),
14211390
Name: "machine",
@@ -1440,10 +1409,6 @@ func TestGetNodeFromMachine(t *testing.T) {
14401409
},
14411410
Labels: map[string]string{},
14421411
},
1443-
TypeMeta: metav1.TypeMeta{
1444-
Kind: "Node",
1445-
APIVersion: "v1",
1446-
},
14471412
Status: corev1.NodeStatus{
14481413
Conditions: []corev1.NodeCondition{},
14491414
},
@@ -1459,10 +1424,6 @@ func TestGetNodeFromMachine(t *testing.T) {
14591424
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
14601425
ResourceVersion: "999",
14611426
},
1462-
TypeMeta: metav1.TypeMeta{
1463-
Kind: "Node",
1464-
APIVersion: "v1",
1465-
},
14661427
Status: corev1.NodeStatus{
14671428
Conditions: []corev1.NodeCondition{},
14681429
},
@@ -1472,7 +1433,6 @@ func TestGetNodeFromMachine(t *testing.T) {
14721433
{
14731434
testCase: "no nodeRef",
14741435
machine: &machinev1.Machine{
1475-
TypeMeta: metav1.TypeMeta{Kind: "Machine"},
14761436
ObjectMeta: metav1.ObjectMeta{
14771437
Annotations: make(map[string]string),
14781438
Name: "machine",
@@ -1492,9 +1452,6 @@ func TestGetNodeFromMachine(t *testing.T) {
14921452
},
14931453
Labels: map[string]string{},
14941454
},
1495-
TypeMeta: metav1.TypeMeta{
1496-
Kind: "Node",
1497-
},
14981455
Status: corev1.NodeStatus{
14991456
Conditions: []corev1.NodeCondition{},
15001457
},
@@ -1505,7 +1462,6 @@ func TestGetNodeFromMachine(t *testing.T) {
15051462
{
15061463
testCase: "node not found",
15071464
machine: &machinev1.Machine{
1508-
TypeMeta: metav1.TypeMeta{Kind: "Machine"},
15091465
ObjectMeta: metav1.ObjectMeta{
15101466
Annotations: make(map[string]string),
15111467
Name: "machine",

pkg/util/testing/testing.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ func NewNode(name string, ready bool) *corev1.Node {
9595
Labels: map[string]string{},
9696
UID: uuid.NewUUID(),
9797
},
98-
TypeMeta: metav1.TypeMeta{
99-
Kind: "Node",
100-
},
10198
Status: corev1.NodeStatus{
10299
Conditions: []corev1.NodeCondition{
103100
{
@@ -113,14 +110,10 @@ func NewNode(name string, ready bool) *corev1.Node {
113110
// NewMachine returns new machine object that can be used for testing
114111
func NewMachine(name string, nodeName string) *machinev1.Machine {
115112
m := &machinev1.Machine{
116-
TypeMeta: metav1.TypeMeta{
117-
APIVersion: "machine.openshift.io/v1beta1",
118-
Kind: "Machine",
119-
},
120113
ObjectMeta: metav1.ObjectMeta{
121-
Annotations: make(map[string]string),
122114
Name: name,
123115
Namespace: Namespace,
116+
Annotations: map[string]string{},
124117
Labels: FooBar(),
125118
UID: uuid.NewUUID(),
126119
OwnerReferences: []metav1.OwnerReference{
@@ -154,10 +147,6 @@ func NewMachineHealthCheck(name string) *machinev1.MachineHealthCheck {
154147
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
155148
ResourceVersion: "999",
156149
},
157-
TypeMeta: metav1.TypeMeta{
158-
APIVersion: "machine.openshift.io/v1beta1",
159-
Kind: "MachineHealthCheck",
160-
},
161150
Spec: machinev1.MachineHealthCheckSpec{
162151
Selector: *NewSelectorFooBar(),
163152
UnhealthyConditions: []machinev1.UnhealthyCondition{

0 commit comments

Comments
 (0)