v2

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

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

View Source
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) Start

func (adsClient *ADSClient) Start() error

Start 启动 ads 客户端, 开始发送和获取

func (*ADSClient) Stop

func (adsClient *ADSClient) Stop()

Stop adsClient wait for send/receive goroutine graceful exit

func (*ADSClient) UpdateSubscribedClusters

func (adsClient *ADSClient) UpdateSubscribedClusters(subscribedClusters []string)

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL