Skip to content

Commit

Permalink
added endpoint to fetch duck typed event source crds
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi-kn committed Apr 14, 2020
1 parent ca30981 commit b604805
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/bridge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,24 @@ func main() {
},
}

srv.KnativeEventSourceCRDLister = &server.ResourceLister{
BearerToken: resourceListerToken,
RequestURL: &url.URL{
Scheme: k8sEndpoint.Scheme,
Host: k8sEndpoint.Host,
Path: "/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions",
RawQuery: url.Values{
"labelSelector": {"duck.knative.dev/source=true"},
}.Encode(),
},

Client: &http.Client{
Transport: &http.Transport{
TLSClientConfig: srv.K8sProxyConfig.TLSClientConfig,
},
},
}

listenURL := bridge.ValidateFlagIsURL("listen", *fListen)
switch listenURL.Scheme {
case "http":
Expand Down
6 changes: 6 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type Server struct {
MeteringProxyConfig *proxy.Config
// A lister for resource listing of a particular kind
MonitoringDashboardConfigMapLister *ResourceLister
KnativeEventSourceCRDLister *ResourceLister
HelmChartRepoProxyConfig *proxy.Config
GOARCH string
GOOS string
Expand Down Expand Up @@ -311,6 +312,7 @@ func (s *Server) HTTPHandler() http.Handler {
}

handle("/api/console/monitoring-dashboard-config", authHandler(s.handleMonitoringDashboardConfigmaps))
handle("/api/console/crd/knative-event-sources", authHandler(s.handleKnativeEventSourceCrds))
handle("/api/console/version", authHandler(s.versionHandler))

// Helm Endpoints
Expand Down Expand Up @@ -354,6 +356,10 @@ func (s *Server) handleMonitoringDashboardConfigmaps(w http.ResponseWriter, r *h
s.MonitoringDashboardConfigMapLister.handleResources(w, r)
}

func (s *Server) handleKnativeEventSourceCrds(w http.ResponseWriter, r *http.Request) {
s.KnativeEventSourceCRDLister.handleResources(w, r)
}

func (s *Server) indexHandler(w http.ResponseWriter, r *http.Request) {
jsg := &jsGlobals{
ConsoleVersion: version.Version,
Expand Down

0 comments on commit b604805

Please sign in to comment.