Documentation ¶
Overview ¶
Copyright 2020 SunJun <i@sjis.me>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 SunJun <i@sjis.me>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 SunJun <i@sjis.me>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 SunJun <i@sjis.me>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 SunJun <i@sjis.me>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func HandleEnvoyClusterLoadAssignment(client *ADSClient, resp *envoy_api_v2.DiscoveryResponse) error
- func HandleTypeURL(url string, client *ADSClient, resp *envoy_api_v2.DiscoveryResponse) error
- func RegisterTypeURLHandleFunc(url string, f TypeURLHandleFunc)
- type ADSClient
- type ADSConfig
- type ClientV2
- type StreamClient
- type TypeURLHandleFunc
Constants ¶
const ( EnvoyListener = "type.googleapis.com/envoy.api.v2.Listener" EnvoyCluster = "type.googleapis.com/envoy.api.v2.Cluster" EnvoyClusterLoadAssignment = "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment" EnvoyRouteConfiguration = "type.googleapis.com/envoy.api.v2.RouteConfiguration" )
默认
Variables ¶
This section is empty.
Functions ¶
func HandleEnvoyClusterLoadAssignment ¶
func HandleEnvoyClusterLoadAssignment(client *ADSClient, resp *envoy_api_v2.DiscoveryResponse) error
HandleEnvoyClusterLoadAssignment parse envoy data to mosn endpoint config
func HandleTypeURL ¶
func HandleTypeURL(url string, client *ADSClient, resp *envoy_api_v2.DiscoveryResponse) error
HandleTypeURL ads 回调执行
func RegisterTypeURLHandleFunc ¶
func RegisterTypeURLHandleFunc(url string, f TypeURLHandleFunc)
RegisterTypeURLHandleFunc 注册 ads 回调
Types ¶
type ADSClient ¶
type ADSClient struct {
// contains filtered or unexported fields
}
ADSClient communicated with pilot
func NewADSClient ¶
func NewADSClient(adsConfig ADSConfig, onEndpointsUpdate func([]*envoyapiv2.ClusterLoadAssignment) error) *ADSClient
NewADSClient new a ADSClient
func (*ADSClient) Stop ¶
func (adsClient *ADSClient) Stop()
Stop adsClient wait for send/receive goroutine graceful exit
func (*ADSClient) UpdateSubscribedClusters ¶
UpdateSubscribedClusters 更新订阅 Clusters
type ADSConfig ¶
type ADSConfig struct { ServiceCluster string // 服务名 ServiceNode string // 服务节点信息 APIType envoyapiv2core.ApiConfigSource_ApiType RefreshDelay time.Duration // 订阅 Cluster 轮询时间 AllRefreshDelay time.Duration // 所有 Cluster 轮询时间 ADSAddr string // ads 服务器地址 ConnectTimeout time.Duration // ads 服务器连接超时时间 LocalIP string // 本服务 ip Env string // qa/pre/prd Container string // vm/k8s Datacenter string // 所在集群标识 DefaultNetWorkCard string // 默认网卡名 // contains filtered or unexported fields }
ADSConfig ADS 客户端配置
func (*ADSConfig) GetClient ¶
func (c *ADSConfig) GetClient() ads.AggregatedDiscoveryService_StreamAggregatedResourcesClient
GetClient 获取 AggregatedDiscoveryService_StreamAggregatedResourcesClient
func (*ADSConfig) GetStreamClient ¶
func (c *ADSConfig) GetStreamClient() (*StreamClient, error)
GetStreamClient 返回连接到 ads 的 grpc stream client
type ClientV2 ¶
type ClientV2 struct { ServiceCluster string ServiceNode string ClientIP string Env string // qa/pre/prd Container string // vm/k8s Datacenter string // 所在集群标识 }
ClientV2 contains config which v2 module needed
type StreamClient ¶
type StreamClient struct {
// contains filtered or unexported fields
}
StreamClient grpc 客户端
type TypeURLHandleFunc ¶
type TypeURLHandleFunc func(client *ADSClient, resp *envoy_api_v2.DiscoveryResponse) error
TypeURLHandleFunc is a function that used to parse ads type url data