Skip to content

Commit 27b9001

Browse files
refactor(oapi): remove GlobalInsight schema alias (backport of #16345) (#16349)
Automatic cherry-pick of #16345 for branch release-2.12 Generated by [action](https://github.com/kumahq/kuma/actions/runs/24779221852) cherry-picked commit 84ada43 Signed-off-by: Bart Smykla <bartek@smykla.com> Co-authored-by: Bart Smykla <bartek@smykla.com>
1 parent 365c8cd commit 27b9001

5 files changed

Lines changed: 16 additions & 25 deletions

File tree

api/openapi/specs/api.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,9 +664,6 @@ components:
664664
additionalProperties:
665665
$ref: '#/components/schemas/ResourceStats'
666666
description: A map of resource names to their corresponding statistics
667-
GlobalInsight:
668-
allOf:
669-
- $ref: '#/components/schemas/GlobalInsightBase'
670667
InspectHostnames:
671668
type: object
672669
title: InspectHostnames
@@ -747,7 +744,7 @@ components:
747744
content:
748745
application/json:
749746
schema:
750-
$ref: '#/components/schemas/GlobalInsight'
747+
$ref: '#/components/schemas/GlobalInsightBase'
751748
examples:
752749
Single control plane response:
753750
$ref: '#/components/examples/GlobalInsightExample'

api/openapi/types/zz_generated.api.go

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/generated/openapi.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4087,9 +4087,6 @@ components:
40874087
additionalProperties:
40884088
$ref: '#/components/schemas/ResourceStats'
40894089
description: A map of resource names to their corresponding statistics
4090-
GlobalInsight:
4091-
allOf:
4092-
- $ref: '#/components/schemas/GlobalInsightBase'
40934090
InspectHostnames:
40944091
type: object
40954092
title: InspectHostnames
@@ -18229,7 +18226,7 @@ components:
1822918226
content:
1823018227
application/json:
1823118228
schema:
18232-
$ref: '#/components/schemas/GlobalInsight'
18229+
$ref: '#/components/schemas/GlobalInsightBase'
1823318230
examples:
1823418231
Single control plane response:
1823518232
$ref: '#/components/examples/GlobalInsightExample'

pkg/insights/globalinsight/cached_global_insight_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func NewCachedGlobalInsightService(globalInsightService GlobalInsightService, te
2626
}
2727
}
2828

29-
func (gis *cachedGlobalInsightService) GetGlobalInsight(ctx context.Context) (*api_types.GlobalInsight, error) {
29+
func (gis *cachedGlobalInsightService) GetGlobalInsight(ctx context.Context) (*api_types.GlobalInsightBase, error) {
3030
tenantID, err := gis.tenants.GetID(ctx)
3131
if err != nil {
3232
return nil, err
@@ -42,5 +42,5 @@ func (gis *cachedGlobalInsightService) GetGlobalInsight(ctx context.Context) (*a
4242
return insight, nil
4343
}
4444

45-
return obj.(*api_types.GlobalInsight), nil
45+
return obj.(*api_types.GlobalInsightBase), nil
4646
}

pkg/insights/globalinsight/global_insight_service.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
type GlobalInsightService interface {
16-
GetGlobalInsight(ctx context.Context) (*api_types.GlobalInsight, error)
16+
GetGlobalInsight(ctx context.Context) (*api_types.GlobalInsightBase, error)
1717
}
1818

1919
type defaultGlobalInsightService struct {
@@ -26,8 +26,8 @@ func NewDefaultGlobalInsightService(resourceStore core_store.ResourceStore) Glob
2626
return &defaultGlobalInsightService{resourceStore: resourceStore}
2727
}
2828

29-
func (gis *defaultGlobalInsightService) GetGlobalInsight(ctx context.Context) (*api_types.GlobalInsight, error) {
30-
globalInsights := &api_types.GlobalInsight{CreatedAt: core.Now()}
29+
func (gis *defaultGlobalInsightService) GetGlobalInsight(ctx context.Context) (*api_types.GlobalInsightBase, error) {
30+
globalInsights := &api_types.GlobalInsightBase{CreatedAt: core.Now()}
3131

3232
meshInsights := &mesh.MeshInsightResourceList{}
3333
if err := gis.resourceStore.List(ctx, meshInsights); err != nil {
@@ -61,7 +61,7 @@ func (gis *defaultGlobalInsightService) GetGlobalInsight(ctx context.Context) (*
6161

6262
func (gis *defaultGlobalInsightService) aggregateDataplanes(
6363
meshInsights *mesh.MeshInsightResourceList,
64-
globalInsight *api_types.GlobalInsight,
64+
globalInsight *api_types.GlobalInsightBase,
6565
) {
6666
for _, meshInsight := range meshInsights.GetItems() {
6767
dataplanesByType := meshInsight.GetSpec().(*mesh_proto.MeshInsight).GetDataplanesByType()
@@ -88,7 +88,7 @@ func (gis *defaultGlobalInsightService) aggregateDataplanes(
8888

8989
func (gis *defaultGlobalInsightService) aggregatePolicies(
9090
meshInsights *mesh.MeshInsightResourceList,
91-
globalInsight *api_types.GlobalInsight,
91+
globalInsight *api_types.GlobalInsightBase,
9292
) {
9393
for _, meshInsight := range meshInsights.GetItems() {
9494
policies := meshInsight.GetSpec().(*mesh_proto.MeshInsight).GetPolicies()
@@ -101,7 +101,7 @@ func (gis *defaultGlobalInsightService) aggregatePolicies(
101101

102102
func (gis *defaultGlobalInsightService) aggregateResources(
103103
meshInsights *mesh.MeshInsightResourceList,
104-
globalInsight *api_types.GlobalInsight,
104+
globalInsight *api_types.GlobalInsightBase,
105105
) {
106106
globalInsight.Resources = map[string]api_types.ResourceStats{}
107107
for _, meshInsight := range meshInsights.GetItems() {
@@ -118,7 +118,7 @@ func (gis *defaultGlobalInsightService) aggregateResources(
118118

119119
func (gis *defaultGlobalInsightService) aggregateServices(
120120
ctx context.Context,
121-
globalInsight *api_types.GlobalInsight,
121+
globalInsight *api_types.GlobalInsightBase,
122122
) error {
123123
serviceInsights := &mesh.ServiceInsightResourceList{}
124124
if err := gis.resourceStore.List(ctx, serviceInsights); err != nil {
@@ -161,7 +161,7 @@ func updateServiceStatus(serviceStatus mesh_proto.ServiceInsight_Service_Status,
161161

162162
func (gis *defaultGlobalInsightService) aggregateZoneControlPlanes(
163163
ctx context.Context,
164-
globalInsight *api_types.GlobalInsight,
164+
globalInsight *api_types.GlobalInsightBase,
165165
) error {
166166
zoneInsights := &system.ZoneInsightResourceList{}
167167
if err := gis.resourceStore.List(ctx, zoneInsights); err != nil {
@@ -180,7 +180,7 @@ func (gis *defaultGlobalInsightService) aggregateZoneControlPlanes(
180180

181181
func (gis *defaultGlobalInsightService) aggregateZoneIngresses(
182182
ctx context.Context,
183-
globalInsight *api_types.GlobalInsight,
183+
globalInsight *api_types.GlobalInsightBase,
184184
) error {
185185
zoneIngressInsights := &mesh.ZoneIngressInsightResourceList{}
186186
if err := gis.resourceStore.List(ctx, zoneIngressInsights); err != nil {
@@ -199,7 +199,7 @@ func (gis *defaultGlobalInsightService) aggregateZoneIngresses(
199199

200200
func (gis *defaultGlobalInsightService) aggregateZoneEgresses(
201201
ctx context.Context,
202-
globalInsight *api_types.GlobalInsight,
202+
globalInsight *api_types.GlobalInsightBase,
203203
) error {
204204
zoneEgressInsights := &mesh.ZoneEgressInsightResourceList{}
205205
if err := gis.resourceStore.List(ctx, zoneEgressInsights); err != nil {

0 commit comments

Comments
 (0)