-
Notifications
You must be signed in to change notification settings - Fork 593
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 1870114: Updated template PVC name and namespace to use parameters #6428
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,13 @@ export const iGetRelevantTemplates = ( | |
const versionCMP = compareVersions(splitVersion(aVersion), splitVersion(bVersion)) * -1; // descending | ||
|
||
if (versionCMP !== 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we move this logic to compareVersions and also add it to the unit test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done 👍 |
||
// 'devel' version if exist is always the highst version. | ||
if (aVersion === 'devel') { | ||
return -1; | ||
} | ||
if (bVersion === 'devel') { | ||
return 1; | ||
} | ||
return versionCMP; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,18 @@ import { | |
CloudInitDataHelper, | ||
CloudInitDataFormKeys, | ||
} from '../../k8s/wrapper/vm/cloud-init-data-helper'; | ||
import { getAnnotation, getAnnotations, getLabels } from '../selectors'; | ||
import { getAnnotation, getAnnotations, getLabels, getParameter } from '../selectors'; | ||
import { | ||
TEMPLATE_FLAVOR_LABEL, | ||
TEMPLATE_OS_LABEL, | ||
TEMPLATE_OS_NAME_ANNOTATION, | ||
TEMPLATE_TYPE_LABEL, | ||
TEMPLATE_TYPE_VM, | ||
TEMPLATE_WORKLOAD_LABEL, | ||
TEMPLATE_DATAVOLUME_NAME_PARAMETER, | ||
TEMPLATE_DATAVOLUME_NAMESPACE_PARAMETER, | ||
} from '../../constants/vm'; | ||
import { | ||
getCloudInitVolume, | ||
getOperatingSystemDataVolumeAnnotation, | ||
getOperatingSystemDataVolumeNamespaceAnnotation, | ||
} from '../vm/selectors'; | ||
import { getCloudInitVolume } from '../vm/selectors'; | ||
import { VolumeWrapper } from '../../k8s/wrapper/vm/volume-wrapper'; | ||
import { selectVM } from './basic'; | ||
import { removeOSDups } from '../../utils/sort'; | ||
|
@@ -83,11 +81,12 @@ export const getTemplateOperatingSystems = (templates: TemplateKind[]) => { | |
(t) => | ||
!!Object.keys(getAnnotations(t, {})).find((annotation) => annotation === nameAnnotation), | ||
); | ||
|
||
return { | ||
id: osId, | ||
name: getAnnotation(template, nameAnnotation), | ||
dataVolumeName: getOperatingSystemDataVolumeAnnotation(template, osId), | ||
dataVolumeNamespace: getOperatingSystemDataVolumeNamespaceAnnotation(template), | ||
dataVolumeName: getParameter(template, TEMPLATE_DATAVOLUME_NAME_PARAMETER)?.value, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we have similar selectors and change it to getPrameterValue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done :-) |
||
dataVolumeNamespace: getParameter(template, TEMPLATE_DATAVOLUME_NAMESPACE_PARAMETER)?.value, | ||
}; | ||
}), | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please include flavor and workloadProfile in hasVMSettingsValueChanged so we always get relevant template here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
p.s.
the spec says that os disk image should not change on cpu/mem or orher none os related changes,
but since we have this problem all over the code, so we can fix it in a folow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not an problem as this not about the spec. I'd be glad if our code worked also on a broken/customized env with different templates of different versions with different base images for different oses, if it doesn't cost us that much. Just using these selectors properly with all the relevant info.