Skip to content

Commit

Permalink
Save repo in kubeapps namespace when created in _all
Browse files Browse the repository at this point in the history
  • Loading branch information
absoludity committed Feb 10, 2020
1 parent 6a3fe02 commit 638b0a2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dashboard/src/actions/repos.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,19 @@ spec:
await store.dispatch(installRepoCMD);
expect(store.getActions()).toEqual(expectedActions);
});

it("uses kubeapps own namespace if namespace is _all", async () => {
await store.dispatch(repoActions.installRepo("my-repo", "_all", "http://foo.bar", "", "", ""));

expect(AppRepository.create).toHaveBeenCalledWith(
"my-repo",
"kubeapps-namespace",
"http://foo.bar",
"",
"",
{},
);
});
});

describe("checkChart", () => {
Expand Down
7 changes: 7 additions & 0 deletions dashboard/src/actions/repos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ThunkAction } from "redux-thunk";
import { ActionType, createAction } from "typesafe-actions";
import { AppRepository } from "../shared/AppRepository";
import Chart from "../shared/Chart";
import { definedNamespaces } from "../shared/Namespace";
import { errorChart } from "./charts";

import { IAppRepository, IStoreState, NotFoundError } from "../shared/types";
Expand Down Expand Up @@ -146,6 +147,12 @@ export const installRepo = (
if (syncJobPodTemplate.length) {
syncJobPodTemplateObj = yaml.safeLoad(syncJobPodTemplate);
}
const {
config: { namespace: kubeappsNamespace },
} = getState();
if (namespace === definedNamespaces.all) {
namespace = kubeappsNamespace;
}
dispatch(addRepo());
const data = await AppRepository.create(
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class AppRepoList extends React.Component<IAppRepoListProps> {
deleteRepo={deleteRepo}
resyncRepo={resyncRepo}
repo={repo}
renderNamespace={renderNamespace}
/>
))}
</tbody>
Expand Down

0 comments on commit 638b0a2

Please sign in to comment.