Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dp-server): simplify by removing dataplane_callbacks #12890

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/generic/insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func GetSubscription[S Subscription, T interface{ GetSubscriptions() []S }](t T,
type Insight interface {
proto.Message
IsOnline() bool
// GetLastSubscription returns that last subscription or nil if there are no subscriptions
GetLastSubscription() Subscription
GetSubscription(id string) Subscription
AllSubscriptions() []Subscription
Expand Down
16 changes: 15 additions & 1 deletion pkg/core/resources/apis/mesh/proxy_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ func ProxyTypeFromResourceType(t core_model.ResourceType) (mesh_proto.ProxyType,
return mesh_proto.IngressProxyType, nil
case ZoneEgressType:
return mesh_proto.EgressProxyType, nil
default:
return "", errors.Errorf("%s does not have a corresponding proxy type", t)
}
}

func ResourceTypeDescriptorFromProxyType(proxyType mesh_proto.ProxyType) (core_model.ResourceTypeDescriptor, error) {
switch proxyType {
case mesh_proto.DataplaneProxyType:
return DataplaneResourceTypeDescriptor, nil
case mesh_proto.IngressProxyType:
return ZoneIngressResourceTypeDescriptor, nil
case mesh_proto.EgressProxyType:
return ZoneEgressResourceTypeDescriptor, nil
default:
return core_model.ResourceTypeDescriptor{}, errors.Errorf("%s does not have a corresponding resource type", proxyType)
}
return "", errors.Errorf("%s does not have a corresponding proxy type", t)
}
8 changes: 4 additions & 4 deletions pkg/core/resources/model/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,28 +253,28 @@ func (d ResourceTypeDescriptor) HasInsights() bool {

func (d ResourceTypeDescriptor) NewInsight() Resource {
if !d.HasInsights() {
panic("No insight type precondition broken")
panic(fmt.Sprintf("No insight for type %s precondition broken", d.Name))
}
return newObject(d.Insight)
}

func (d ResourceTypeDescriptor) NewInsightList() ResourceList {
if !d.HasInsights() {
panic("No insight type precondition broken")
panic(fmt.Sprintf("No insight for type %s precondition broken", d.Name))
}
return d.Insight.Descriptor().NewList()
}

func (d ResourceTypeDescriptor) NewOverview() Resource {
if !d.HasInsights() {
panic("No insight type precondition broken")
panic(fmt.Sprintf("No insight for type %s precondition broken", d.Name))
}
return newObject(d.Overview)
}

func (d ResourceTypeDescriptor) NewOverviewList() ResourceList {
if !d.HasInsights() {
panic("No insight type precondition broken")
panic(fmt.Sprintf("No insight for type %s precondition broken", d.Name))
}
return d.Overview.Descriptor().NewList()
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/util/xds/v3/watchdog_callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ type Watchdog interface {
Start(ctx context.Context)
}

type WatchdogFunc func(ctx context.Context)

func (f WatchdogFunc) Start(ctx context.Context) {
f(ctx)
}

type NewNodeWatchdogFunc func(ctx context.Context, node *envoy_core.Node, streamId int64) (Watchdog, error)

func NewWatchdogCallbacks(newNodeWatchdog NewNodeWatchdogFunc) envoy_xds.Callbacks {
Expand Down
156 changes: 0 additions & 156 deletions pkg/xds/server/callbacks/dataplane_callbacks.go

This file was deleted.

107 changes: 0 additions & 107 deletions pkg/xds/server/callbacks/dataplane_callbacks_test.go

This file was deleted.

Loading
Loading