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 1870114: Updated template PVC name and namespace to use parameters #6428

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented Aug 25, 2020

https://issues.redhat.com/browse/CNV-4764 updated the way PVC name and namespace are stated in the template.
We currently use the old way, we need to update according to latest updates.

Refs:
kubevirt/common-templates#168
kubevirt/kubevirt-ssp-operator#212

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Aug 25, 2020
@openshift-ci-robot
Copy link
Contributor

@yaacov: This pull request references Bugzilla bug 1870114, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1870114: Updated template PVC name and namespace to use parameters

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the component/kubevirt Related to kubevirt-plugin label Aug 25, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 25, 2020
@yaacov yaacov changed the title Bug 1870114: Updated template PVC name and namespace to use parameters [WIP] Bug 1870114: Updated template PVC name and namespace to use parameters Aug 25, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 25, 2020
`${TEMPLATE_DATAVOLUME_ANNOTATION}/${relevantOptions.os}`,
);
const pvcNamespace = iGetAnnotation(iTemplate, `${TEMPLATE_DATAVOLUME_ANNOTATION}/namespace`);
const pvcName = iGetPrameter(iTemplate, TEMPLATE_DATAVOLUME_NAME_PARAMETER).value;
Copy link
Member

Choose a reason for hiding this comment

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

is the parameter returned really a plain JS object?

Copy link
Member Author

Choose a reason for hiding this comment

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

:-) no, I'm fixing that 👍

@yaacov yaacov force-pushed the updated-the-way-we-collect-pvc-name-and-namespace branch from 2f26c05 to 4df9af0 Compare August 25, 2020 16:42
@yaacov yaacov force-pushed the updated-the-way-we-collect-pvc-name-and-namespace branch from 4df9af0 to adb17c3 Compare August 25, 2020 17:01
@yaacov yaacov changed the title [WIP] Bug 1870114: Updated template PVC name and namespace to use parameters Bug 1870114: Updated template PVC name and namespace to use parameters Aug 25, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 25, 2020
@yaacov
Copy link
Member Author

yaacov commented Aug 25, 2020

@suomiy @pcbailey @irosenzw @glekner please review

return {
id: osId,
name: getAnnotation(template, nameAnnotation),
dataVolumeName: getOperatingSystemDataVolumeAnnotation(template, osId),
dataVolumeNamespace: getOperatingSystemDataVolumeNamespaceAnnotation(template),
dataVolumeName: getParameter(template, TEMPLATE_DATAVOLUME_NAME_PARAMETER)?.value,
Copy link
Member

Choose a reason for hiding this comment

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

can we have similar selectors and change it to getPrameterValue?

Copy link
Member Author

Choose a reason for hiding this comment

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

done :-)

@@ -86,6 +86,13 @@ export const iGetRelevantTemplates = (
const versionCMP = compareVersions(splitVersion(aVersion), splitVersion(bVersion)) * -1; // descending

if (versionCMP !== 0) {
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

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

done 👍

@@ -129,14 +134,16 @@ const baseImageUpdater = ({ id, prevState, dispatch, getState }: UpdateOptions)
const iCommonTemplates = iGetLoadedCommonData(state, id, VMWizardProps.commonTemplates);
const iTemplate =
iCommonTemplates && iGetRelevantTemplate(null, iCommonTemplates, relevantOptions);
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

@yaacov yaacov force-pushed the updated-the-way-we-collect-pvc-name-and-namespace branch from ad2c586 to a5f557c Compare August 26, 2020 07:45
@yaacov yaacov force-pushed the updated-the-way-we-collect-pvc-name-and-namespace branch from 8936c4a to 7db54ae Compare August 26, 2020 08:02

it('check devel version when both of them are not null', () => {
expect(compareVersions(osVersion10, osVersion9)).toEqual(1);
});
});

describe('removeOSDups', () => {
Copy link
Member

Choose a reason for hiding this comment

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

can you please add it to this test as well?

@@ -129,14 +134,16 @@ const baseImageUpdater = ({ id, prevState, dispatch, getState }: UpdateOptions)
const iCommonTemplates = iGetLoadedCommonData(state, id, VMWizardProps.commonTemplates);
const iTemplate =
iCommonTemplates && iGetRelevantTemplate(null, iCommonTemplates, relevantOptions);
Copy link
Member

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.

@@ -48,7 +48,7 @@ export const ignoreCaseSort = <T>(
return array.sort((a, b) => resolve(a).localeCompare(resolve(b)));
};

export const splitVersion = (osID: string): number[] =>
const splitVersion = (osID: string): number[] =>
Copy link
Member

Choose a reason for hiding this comment

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

+1 nice refactoring

@atiratree
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: suomiy, yaacov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 5b8ab73 into openshift:master Aug 26, 2020
@openshift-ci-robot
Copy link
Contributor

@yaacov: All pull requests linked via external trackers have merged:

Bugzilla bug 1870114 has been moved to the MODIFIED state.

In response to this:

Bug 1870114: Updated template PVC name and namespace to use parameters

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.6 milestone Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/kubevirt Related to kubevirt-plugin lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants