Skip to content

Commit

Permalink
Set template namespace to VM namespace when posting to ProcessedTempl…
Browse files Browse the repository at this point in the history
…ates endpoint (kubevirt#206)
  • Loading branch information
rawagner committed Feb 4, 2019
1 parent 345a58d commit c0ac1c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/k8s/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ export const createVmTemplate = (k8sCreate, templates, basicSettings, networks,
export const createVm = (k8sCreate, templates, basicSettings, networks, storage, persistentVolumeClaims) => {
const getSetting = settingsValue.bind(undefined, basicSettings);
const template = getModifiedVmTemplate(templates, basicSettings, getSetting, networks, storage);
return k8sCreate(ProcessedTemplatesModel, template).then(({ objects }) => {
// ProcessedTemplates endpoit will reject the request if user cannot post to the namespace
// common-templates are stored in openshift namespace, default user can read but cannot post
const postTemplate = cloneDeep(template);
postTemplate.metadata.namespace = settingsValue(basicSettings, NAMESPACE_KEY);
return k8sCreate(ProcessedTemplatesModel, postTemplate).then(({ objects }) => {
const vm = selectVm(objects);

addMetadata(vm, template, getSetting);
Expand Down

0 comments on commit c0ac1c7

Please sign in to comment.