@@ -31,9 +31,9 @@ type controllerInformer interface {
3131 GetOperatorConfig () * config.Config
3232 GetStatus () * spec.ControllerStatus
3333 TeamClusterList () map [string ][]spec.NamespacedName
34- ClusterStatus (team , namespace , cluster string ) (* cluster.ClusterStatus , error )
35- ClusterLogs (team , namespace , cluster string ) ([]* spec.LogEntry , error )
36- ClusterHistory (team , namespace , cluster string ) ([]* spec.Diff , error )
34+ ClusterStatus (namespace , cluster string ) (* cluster.ClusterStatus , error )
35+ ClusterLogs (namespace , cluster string ) ([]* spec.LogEntry , error )
36+ ClusterHistory (namespace , cluster string ) ([]* spec.Diff , error )
3737 ClusterDatabasesMap () map [string ][]string
3838 WorkerLogs (workerID uint32 ) ([]* spec.LogEntry , error )
3939 ListQueue (workerID uint32 ) (* spec.QueueDump , error )
@@ -55,9 +55,9 @@ const (
5555)
5656
5757var (
58- clusterStatusRe = fmt .Sprintf (`^/clusters/%s/%s/%s/ ?$` , teamRe , namespaceRe , clusterRe )
59- clusterLogsRe = fmt .Sprintf (`^/clusters/%s/%s/%s/ logs/?$` , teamRe , namespaceRe , clusterRe )
60- clusterHistoryRe = fmt .Sprintf (`^/clusters/%s/%s/%s/ history/?$` , teamRe , namespaceRe , clusterRe )
58+ clusterStatusRe = fmt .Sprintf (`^/clusters/%s/%s/?$` , namespaceRe , clusterRe )
59+ clusterLogsRe = fmt .Sprintf (`^/clusters/%s/%s/logs/?$` , namespaceRe , clusterRe )
60+ clusterHistoryRe = fmt .Sprintf (`^/clusters/%s/%s/history/?$` , namespaceRe , clusterRe )
6161 teamURLRe = fmt .Sprintf (`^/clusters/%s/?$` , teamRe )
6262
6363 clusterStatusURL = regexp .MustCompile (clusterStatusRe )
@@ -170,7 +170,7 @@ func (s *Server) clusters(w http.ResponseWriter, req *http.Request) {
170170
171171 if matches := util .FindNamedStringSubmatch (clusterStatusURL , req .URL .Path ); matches != nil {
172172 namespace := matches ["namespace" ]
173- resp , err = s .controller .ClusterStatus (matches [ "team" ], namespace , matches ["cluster" ])
173+ resp , err = s .controller .ClusterStatus (namespace , matches ["cluster" ])
174174 } else if matches := util .FindNamedStringSubmatch (teamURL , req .URL .Path ); matches != nil {
175175 teamClusters := s .controller .TeamClusterList ()
176176 clusters , found := teamClusters [matches ["team" ]]
@@ -181,21 +181,21 @@ func (s *Server) clusters(w http.ResponseWriter, req *http.Request) {
181181
182182 clusterNames := make ([]string , 0 )
183183 for _ , cluster := range clusters {
184- clusterNames = append (clusterNames , cluster .Name [ len ( matches [ "team" ]) + 1 :] )
184+ clusterNames = append (clusterNames , cluster .Name )
185185 }
186186
187187 resp , err = clusterNames , nil
188188 } else if matches := util .FindNamedStringSubmatch (clusterLogsURL , req .URL .Path ); matches != nil {
189189 namespace := matches ["namespace" ]
190- resp , err = s .controller .ClusterLogs (matches [ "team" ], namespace , matches ["cluster" ])
190+ resp , err = s .controller .ClusterLogs (namespace , matches ["cluster" ])
191191 } else if matches := util .FindNamedStringSubmatch (clusterHistoryURL , req .URL .Path ); matches != nil {
192192 namespace := matches ["namespace" ]
193- resp , err = s .controller .ClusterHistory (matches [ "team" ], namespace , matches ["cluster" ])
193+ resp , err = s .controller .ClusterHistory (namespace , matches ["cluster" ])
194194 } else if req .URL .Path == clustersURL {
195195 clusterNamesPerTeam := make (map [string ][]string )
196196 for team , clusters := range s .controller .TeamClusterList () {
197197 for _ , cluster := range clusters {
198- clusterNamesPerTeam [team ] = append (clusterNamesPerTeam [team ], cluster .Name [ len ( team ) + 1 :] )
198+ clusterNamesPerTeam [team ] = append (clusterNamesPerTeam [team ], cluster .Name )
199199 }
200200 }
201201 resp , err = clusterNamesPerTeam , nil
0 commit comments