Skip to content

Commit 5a1a40f

Browse files
Merge pull request #1138 from petr-muller/update-status-api-2025-01-24
OTA-1339: USC: Pull latest UpdateStatus API code
2 parents 81e4b97 + ed7ee58 commit 5a1a40f

9 files changed

+480
-249
lines changed

pkg/updatestatus/controlplaneinformer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ func (c *controlPlaneInformerController) sync(ctx context.Context, syncCtx facto
155155

156156
func makeInsightMsgForClusterOperator(coInsight *ClusterOperatorStatusInsight, acquiredAt metav1.Time) informerMsg {
157157
uid := fmt.Sprintf("usc-co-%s", coInsight.Name)
158-
insight := Insight{
158+
insight := ControlPlaneInsight{
159159
UID: uid,
160160
AcquiredAt: acquiredAt,
161-
InsightUnion: InsightUnion{
161+
ControlPlaneInsightUnion: ControlPlaneInsightUnion{
162162
Type: ClusterOperatorStatusInsightType,
163163
ClusterOperatorStatusInsight: coInsight,
164164
},
@@ -294,10 +294,10 @@ func getImagePullSpec(ctx context.Context, name string, appsClient appsv1client.
294294
// between controllers.
295295
func makeInsightMsgForClusterVersion(cvInsight *ClusterVersionStatusInsight, acquiredAt metav1.Time) informerMsg {
296296
uid := fmt.Sprintf("usc-cv-%s", cvInsight.Resource.Name)
297-
insight := Insight{
297+
insight := ControlPlaneInsight{
298298
UID: uid,
299299
AcquiredAt: acquiredAt,
300-
InsightUnion: InsightUnion{
300+
ControlPlaneInsightUnion: ControlPlaneInsightUnion{
301301
Type: ClusterVersionStatusInsightType,
302302
ClusterVersionStatusInsight: cvInsight,
303303
},

pkg/updatestatus/controlplaneinformer_test.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package updatestatus
33
import (
44
"context"
55
"errors"
6-
"github.com/openshift/library-go/pkg/controller/factory"
7-
kerrors "k8s.io/apimachinery/pkg/api/errors"
86
"testing"
97
"time"
108

9+
"github.com/openshift/library-go/pkg/controller/factory"
10+
kerrors "k8s.io/apimachinery/pkg/api/errors"
11+
1112
"github.com/google/go-cmp/cmp"
1213
"github.com/google/go-cmp/cmp/cmpopts"
1314
"gopkg.in/yaml.v3"
@@ -86,17 +87,17 @@ func Test_sync_with_cv(t *testing.T) {
8687
cvProgressing *configv1.ClusterOperatorStatusCondition
8788
cvHistory []configv1.UpdateHistory
8889

89-
expectedMsgs map[string]Insight
90+
expectedMsgs map[string]ControlPlaneInsight
9091
}{
9192
{
9293
name: "Cluster during installation",
9394
cvProgressing: &progressingTrue,
9495
cvHistory: []configv1.UpdateHistory{inProgress418},
95-
expectedMsgs: map[string]Insight{
96+
expectedMsgs: map[string]ControlPlaneInsight{
9697
"usc-cv-version": {
9798
UID: "usc-cv-version",
9899
AcquiredAt: now,
99-
InsightUnion: InsightUnion{
100+
ControlPlaneInsightUnion: ControlPlaneInsightUnion{
100101
Type: ClusterVersionStatusInsightType,
101102
ClusterVersionStatusInsight: &ClusterVersionStatusInsight{
102103
Resource: cvRef,
@@ -127,11 +128,11 @@ func Test_sync_with_cv(t *testing.T) {
127128
name: "Cluster after installation",
128129
cvProgressing: &progressingFalse,
129130
cvHistory: []configv1.UpdateHistory{completed418},
130-
expectedMsgs: map[string]Insight{
131+
expectedMsgs: map[string]ControlPlaneInsight{
131132
"usc-cv-version": {
132133
UID: "usc-cv-version",
133134
AcquiredAt: now,
134-
InsightUnion: InsightUnion{
135+
ControlPlaneInsightUnion: ControlPlaneInsightUnion{
135136
Type: ClusterVersionStatusInsightType,
136137
ClusterVersionStatusInsight: &ClusterVersionStatusInsight{
137138
Resource: cvRef,
@@ -163,11 +164,11 @@ func Test_sync_with_cv(t *testing.T) {
163164
name: "Cluster during a standard update",
164165
cvProgressing: &progressingTrue,
165166
cvHistory: []configv1.UpdateHistory{inProgress419, completed418},
166-
expectedMsgs: map[string]Insight{
167+
expectedMsgs: map[string]ControlPlaneInsight{
167168
"usc-cv-version": {
168169
UID: "usc-cv-version",
169170
AcquiredAt: now,
170-
InsightUnion: InsightUnion{
171+
ControlPlaneInsightUnion: ControlPlaneInsightUnion{
171172
Type: ClusterVersionStatusInsightType,
172173
ClusterVersionStatusInsight: &ClusterVersionStatusInsight{
173174
Resource: cvRef,
@@ -453,15 +454,15 @@ func Test_sync_with_co(t *testing.T) {
453454
testCases := []struct {
454455
name string
455456

456-
expectedMsgs map[string]Insight
457+
expectedMsgs map[string]ControlPlaneInsight
457458
}{
458459
{
459460
name: "Cluster during installation",
460-
expectedMsgs: map[string]Insight{
461+
expectedMsgs: map[string]ControlPlaneInsight{
461462
"usc-co-some-co": {
462463
UID: "usc-co-some-co",
463464
AcquiredAt: now,
464-
InsightUnion: InsightUnion{
465+
ControlPlaneInsightUnion: ControlPlaneInsightUnion{
465466
Type: ClusterOperatorStatusInsightType,
466467
ClusterOperatorStatusInsight: &ClusterOperatorStatusInsight{
467468
Name: "some-co",

pkg/updatestatus/nodeinformer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ func (c *nodeInformerController) sync(ctx context.Context, syncCtx factory.SyncC
142142

143143
func makeInsightMsgForNode(nodeInsight *NodeStatusInsight, acquiredAt metav1.Time) informerMsg {
144144
uid := fmt.Sprintf("usc-node-%s", nodeInsight.Resource.Name)
145-
insight := Insight{
145+
insight := WorkerPoolInsight{
146146
UID: uid,
147147
AcquiredAt: acquiredAt,
148-
InsightUnion: InsightUnion{
148+
WorkerPoolInsightUnion: WorkerPoolInsightUnion{
149149
Type: NodeStatusInsightType,
150150
NodeStatusInsight: nodeInsight,
151151
},

pkg/updatestatus/nodeinformer_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ func Test_sync_with_node(t *testing.T) {
897897
node *corev1.Node
898898

899899
expectedErr error
900-
expectedMsgs map[string]Insight
900+
expectedMsgs map[string]WorkerPoolInsight
901901
}{
902902
{
903903
name: "Node's update is pending",
@@ -914,11 +914,11 @@ func Test_sync_with_node(t *testing.T) {
914914
},
915915
},
916916
},
917-
expectedMsgs: map[string]Insight{
917+
expectedMsgs: map[string]WorkerPoolInsight{
918918
"usc-node-worker-1": {
919919
UID: "usc-node-worker-1",
920920
AcquiredAt: now,
921-
InsightUnion: InsightUnion{
921+
WorkerPoolInsightUnion: WorkerPoolInsightUnion{
922922
Type: NodeStatusInsightType,
923923
NodeStatusInsight: &NodeStatusInsight{
924924
Name: "worker-1",
@@ -956,11 +956,11 @@ func Test_sync_with_node(t *testing.T) {
956956
},
957957
},
958958
},
959-
expectedMsgs: map[string]Insight{
959+
expectedMsgs: map[string]WorkerPoolInsight{
960960
"usc-node-worker-1": {
961961
UID: "usc-node-worker-1",
962962
AcquiredAt: now,
963-
InsightUnion: InsightUnion{
963+
WorkerPoolInsightUnion: WorkerPoolInsightUnion{
964964
Type: NodeStatusInsightType,
965965
NodeStatusInsight: &NodeStatusInsight{
966966
Name: "worker-1",

0 commit comments

Comments
 (0)