kubeapps源码分析-assetsvc
| 阅读 | 共 194 字,阅读约
Overview
kubeapps源码分析-assetsvc
概述
这个组件主要是通过查询postgresq数据库的数据,并提供接口展示给前端。在asset-sysncer组件我们介绍过,它将同步的数据写入数据库。
源码分析
函数入口
listChartsWithFilters
getChartCategories
listChartsWithFilters
getChartCategories
getChart
1func getChart(w http.ResponseWriter, req *http.Request, params Params) {
2 namespace, repo, _, paramErr, err := extractDecodedNamespaceAndRepoAndVersionParams(params)
3 if err != nil {
4 handleDecodeError(paramErr, w, err)
5 return
6 }
7 chartID := getChartID(repo, params["chartName"]) // chartName remains encoded
8
9 chart, err := manager.getChart(namespace, chartID)
10 if err != nil {
11 log.WithError(err).Errorf("could not find chart with id %s", chartID)
12 response.NewErrorResponse(http.StatusNotFound, "could not find chart").Write(w)
13 return
14 }
15
16 cr := newChartResponse(&chart)
17 response.NewDataResponse(cr).Write(w)
18}