api icon indicating copy to clipboard operation
api copied to clipboard

Enhance TrafficPolicy and PortTrafficPolicy

Open hzxuzhonghu opened this issue 2 years ago • 2 comments

From the definition, seems TrafficPolicy and PortTrafficPolicy can be reused

type TrafficPolicy struct {
	LoadBalancer *LoadBalancerSettings `protobuf:"bytes,1,opt,name=load_balancer,json=loadBalancer,proto3" json:"load_balancer,omitempty"`

	ConnectionPool *ConnectionPoolSettings `protobuf:"bytes,2,opt,name=connection_pool,json=connectionPool,proto3" json:"connection_pool,omitempty"`

	OutlierDetection *OutlierDetection `protobuf:"bytes,3,opt,name=outlier_detection,json=outlierDetection,proto3" json:"outlier_detection,omitempty"`

	Tls *ClientTLSSettings `protobuf:"bytes,4,opt,name=tls,proto3" json:"tls,omitempty"`

	PortLevelSettings []*TrafficPolicy_PortTrafficPolicy `protobuf:"bytes,5,rep,name=port_level_settings,json=portLevelSettings,proto3" json:"port_level_settings,omitempty"`


	Tunnel *TrafficPolicy_TunnelSettings `protobuf:"bytes,6,opt,name=tunnel,proto3" json:"tunnel,omitempty"`
}

TrafficPolicy_PortTrafficPolicy has an additional portSelector.

seems we change PortLevelSettings,

PortLevelSettings map[portNumber]TrafficPolicy 

hzxuzhonghu avatar Jun 24 '22 08:06 hzxuzhonghu

Kubernetes API guidance is to not reuse structs where possible, as it leads to bugs like accidentally modifying fields in resources you didn't intend to. I also don't think its backwards compatible from a protobuf perspective?

howardjohn avatar Jun 24 '22 14:06 howardjohn

Yes, if we want to do resue the struct, simplest way is to deprecate PortLevelSettings with a new PortLevelXXX map[uint32]TrafficPolicy. Or move the PortLevelXXX out of TrafficPolicy and in parralell with DR level TrafficPolicy

hzxuzhonghu avatar Jun 25 '22 01:06 hzxuzhonghu

🚧 This issue or pull request has been closed due to not having had activity from an Istio team member since 2022-06-25. If you feel this issue or pull request deserves attention, please reopen the issue. Please see this wiki page for more information. Thank you for your contributions.

Created by the issue and PR lifecycle manager.

istio-policy-bot avatar May 14 '24 23:05 istio-policy-bot