@@ -30,9 +30,9 @@ type controllerInformer interface {
30
30
GetOperatorConfig () * config.Config
31
31
GetStatus () * spec.ControllerStatus
32
32
TeamClusterList () map [string ][]spec.NamespacedName
33
- ClusterStatus (team , cluster string ) (* spec.ClusterStatus , error )
34
- ClusterLogs (team , cluster string ) ([]* spec.LogEntry , error )
35
- ClusterHistory (team , cluster string ) ([]* spec.Diff , error )
33
+ ClusterStatus (team , namespace , cluster string ) (* spec.ClusterStatus , error )
34
+ ClusterLogs (team , namespace , cluster string ) ([]* spec.LogEntry , error )
35
+ ClusterHistory (team , namespace , cluster string ) ([]* spec.Diff , error )
36
36
ClusterDatabasesMap () map [string ][]string
37
37
WorkerLogs (workerID uint32 ) ([]* spec.LogEntry , error )
38
38
ListQueue (workerID uint32 ) (* spec.QueueDump , error )
@@ -48,9 +48,9 @@ type Server struct {
48
48
}
49
49
50
50
var (
51
- clusterStatusURL = regexp .MustCompile (`^/clusters/(?P<team>[a-zA-Z][a-zA-Z0-9]*)/(?P<cluster>[a-zA-Z][a-zA-Z0-9-]*)/?$` )
52
- clusterLogsURL = regexp .MustCompile (`^/clusters/(?P<team>[a-zA-Z][a-zA-Z0-9]*)/(?P<cluster>[a-zA-Z][a-zA-Z0-9-]*)/logs/?$` )
53
- clusterHistoryURL = regexp .MustCompile (`^/clusters/(?P<team>[a-zA-Z][a-zA-Z0-9]*)/(?P<cluster>[a-zA-Z][a-zA-Z0-9-]*)/history/?$` )
51
+ clusterStatusURL = regexp .MustCompile (`^/clusters/(?P<team>[a-zA-Z][a-zA-Z0-9]*)(/(?P<namespace>[a-zA-Z][a-zA-Z0-9-]*))? /(?P<cluster>[a-zA-Z][a-zA-Z0-9-]*)/?$` )
52
+ clusterLogsURL = regexp .MustCompile (`^/clusters/(?P<team>[a-zA-Z][a-zA-Z0-9]*)(/(?P<namespace>[a-zA-Z][a-zA-Z0-9-]*))? /(?P<cluster>[a-zA-Z][a-zA-Z0-9-]*)/logs/?$` )
53
+ clusterHistoryURL = regexp .MustCompile (`^/clusters/(?P<team>[a-zA-Z][a-zA-Z0-9]*)(/(?P<namespace>[a-zA-Z][a-zA-Z0-9-]*))? /(?P<cluster>[a-zA-Z][a-zA-Z0-9-]*)/history/?$` )
54
54
teamURL = regexp .MustCompile (`^/clusters/(?P<team>[a-zA-Z][a-zA-Z0-9]*)/?$` )
55
55
workerLogsURL = regexp .MustCompile (`^/workers/(?P<id>\d+)/logs/?$` )
56
56
workerEventsQueueURL = regexp .MustCompile (`^/workers/(?P<id>\d+)/queue/?$` )
@@ -149,7 +149,8 @@ func (s *Server) clusters(w http.ResponseWriter, req *http.Request) {
149
149
)
150
150
151
151
if matches := util .FindNamedStringSubmatch (clusterStatusURL , req .URL .Path ); matches != nil {
152
- resp , err = s .controller .ClusterStatus (matches ["team" ], matches ["cluster" ])
152
+ namespace , _ := matches ["namespace" ]
153
+ resp , err = s .controller .ClusterStatus (matches ["team" ], namespace , matches ["cluster" ])
153
154
} else if matches := util .FindNamedStringSubmatch (teamURL , req .URL .Path ); matches != nil {
154
155
teamClusters := s .controller .TeamClusterList ()
155
156
clusters , found := teamClusters [matches ["team" ]]
@@ -166,9 +167,11 @@ func (s *Server) clusters(w http.ResponseWriter, req *http.Request) {
166
167
s .respond (clusterNames , nil , w )
167
168
return
168
169
} else if matches := util .FindNamedStringSubmatch (clusterLogsURL , req .URL .Path ); matches != nil {
169
- resp , err = s .controller .ClusterLogs (matches ["team" ], matches ["cluster" ])
170
+ namespace , _ := matches ["namespace" ]
171
+ resp , err = s .controller .ClusterLogs (matches ["team" ], namespace , matches ["cluster" ])
170
172
} else if matches := util .FindNamedStringSubmatch (clusterHistoryURL , req .URL .Path ); matches != nil {
171
- resp , err = s .controller .ClusterHistory (matches ["team" ], matches ["cluster" ])
173
+ namespace , _ := matches ["namespace" ]
174
+ resp , err = s .controller .ClusterHistory (matches ["team" ], namespace , matches ["cluster" ])
172
175
} else if req .URL .Path == clustersURL {
173
176
res := make (map [string ][]string )
174
177
for team , clusters := range s .controller .TeamClusterList () {
0 commit comments