Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1809555: Retrieve the list of Helm charts via chart repo proxy endpoint #4389

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions frontend/public/components/catalog/catalog-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,11 @@ export const Catalog = connectToFlags<CatalogProps>(
}, [loadTemplates, namespace]);

React.useEffect(() => {
coFetch('https://redhat-developer.github.io/redhat-helm-charts/index.yaml').then(
async (res) => {
const yaml = await res.text();
const json = safeLoad(yaml);
setHelmCharts(json.entries);
},
);
coFetch('/api/helm/charts/index.yaml').then(async (res) => {
const yaml = await res.text();
const json = safeLoad(yaml);
setHelmCharts(json.entries);
});
}, []);

const error = templateError || projectTemplateError;
Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/chartproxy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func RegisterFlags(fs *flag.FlagSet) *config {

cfg := new(config)

fs.StringVar(&cfg.repoUrl, "helm-chart-repo-url", "https://redhat-developer.github.com/redhat-helm-charts", "Helm chart repository URL")
fs.StringVar(&cfg.repoUrl, "helm-chart-repo-url", "https://redhat-developer.github.io/redhat-helm-charts", "Helm chart repository URL")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://redhat-developer.github.io/redhat-helm-charts/ is an HTML page. I'm guessing you don't want that as the default value here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do. HTML page is for humans, but UI fetches https://redhat-developer.github.io/redhat-helm-charts/index.yaml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't proxy any HTML since we don't want to run any JS on the console domain. We should restrict the API to only proxy to the endpoint we want.

fs.StringVar(&cfg.repoCaFile, "helm-chart-repo-ca-file", "", "CA bundle for Helm chart repository.")

return cfg
Expand Down
3 changes: 2 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ func (s *Server) HTTPHandler() http.Handler {

helmChartRepoProxy := proxy.NewProxy(s.HelmChartRepoProxyConfig)

handle(helmChartRepoProxyEndpoint, http.StripPrefix(
// Only proxy requests to chart repo index file
handle(helmChartRepoProxyEndpoint+"index.yaml", http.StripPrefix(
proxy.SingleJoiningSlash(s.BaseURL.Path, helmChartRepoProxyEndpoint),
http.HandlerFunc(helmChartRepoProxy.ServeHTTP)))

Expand Down