-
Notifications
You must be signed in to change notification settings - Fork 10
/
repo.go
85 lines (71 loc) · 2.31 KB
/
repo.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package utils
import "fmt"
// IngressCodebasePath returns the path to the ingress codebase.
func IngressCodebasePath() string {
// Format:
// /{{ .Region }}/{{ .Zone }}/{{ .Group }}/{{ .Cluster }}/ingress
return GetDefaultIngressPath()
}
// NamespacedIngressCodebasePath returns the path to the ingress codebase for the given namespace.
func NamespacedIngressCodebasePath(namespace string) string {
// Format:
// /{{ .Region }}/{{ .Zone }}/{{ .Group }}/{{ .Cluster }}/nsig/{{ .Namespace }}
//return util.EvaluateTemplate(commons.NamespacedIngressPathTemplate, struct {
// Region string
// Zone string
// Group string
// Cluster string
// Namespace string
//}{
// Region: c.Cluster.Region,
// Zone: c.Cluster.Zone,
// Group: c.Cluster.Group,
// Cluster: c.Cluster.Name,
// Namespace: namespace,
//})
return fmt.Sprintf("/local/nsig/%s", namespace)
}
// GetDefaultServicesPath returns the path to the services codebase.
func GetDefaultServicesPath() string {
// Format:
// /{{ .Region }}/{{ .Zone }}/{{ .Group }}/{{ .Cluster }}/services
//return util.EvaluateTemplate(commons.ServicePathTemplate, struct {
// Region string
// Zone string
// Group string
// Cluster string
//}{
// Region: c.Cluster.Region,
// Zone: c.Cluster.Zone,
// Group: c.Cluster.Group,
// Cluster: c.Cluster.Name,
//})
return "/local/services"
}
// GetDefaultIngressPath returns the path to the ingress codebase.
func GetDefaultIngressPath() string {
// Format:
// /{{ .Region }}/{{ .Zone }}/{{ .Group }}/{{ .Cluster }}/ingress
//return util.EvaluateTemplate(commons.IngressPathTemplate, struct {
// Region string
// Zone string
// Group string
// Cluster string
//}{
// Region: c.Cluster.Region,
// Zone: c.Cluster.Zone,
// Group: c.Cluster.Group,
// Cluster: c.Cluster.Name,
//})
return "/local/ingress"
}
// GatewayCodebasePath get the codebase URL for the gateway in specified namespace
// inherit hierarchy: /base/gateways -> /local/gateways -> /local/gw/[ns]
func GatewayCodebasePath(namespace string) string {
return fmt.Sprintf("/local/gw/%s", namespace)
}
// GetDefaultGatewaysPath returns the path to the gateways codebase.
// inherit hierarchy: /base/gateways -> /local/gateways -> /local/gw/[ns]
func GetDefaultGatewaysPath() string {
return "/local/gateways"
}