-
Notifications
You must be signed in to change notification settings - Fork 784
/
connector.go
32 lines (27 loc) · 988 Bytes
/
connector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package connector
import "path/filepath"
// RemoteConnector specifies the namespace in the remote cluster
type RemoteConnector struct {
GKE *GKEConnector `json:"gcp,omitempty" protobuf:"bytes,1,opt,name=gcp"`
}
// Key returns the key used for caching connectors
func (c *RemoteConnector) Path() string {
if c.GKE != nil {
return c.GKE.Path()
}
return "unknown"
}
// GKEConnector the connection details for using Google Cloud
type GKEConnector struct {
Project string `json:"project,omitempty" protobuf:"bytes,1,opt,name=project"`
Cluster string `json:"cluster,omitempty" protobuf:"bytes,2,opt,name=cluster"`
Region string `json:"region,omitempty" protobuf:"bytes,3,opt,name=region"`
Zone string `json:"zone,omitempty" protobuf:"bytes,4,opt,name=zone"`
}
func (c *GKEConnector) Path() string {
if c.Region != "" {
return filepath.Join("gcp", c.Project, c.Cluster, "region", c.Region)
} else {
return filepath.Join("gcp", c.Project, c.Cluster, "zone", c.Zone)
}
}