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 1760836: Deploy image ignores target port drop down selection and always uses first entry #2868

Merged
merged 3 commits into from
Oct 4, 2019

Conversation

divyanshiGupta
Copy link
Contributor

@divyanshiGupta divyanshiGupta commented Sep 30, 2019

Jira Issue - https://jira.coreos.com/browse/ODC-1911

Refactored import-submit-utis and deployImage-submit-utils

  • Extracted common code and made it shareable for both the forms
  • Added container resources to deploymentConfig in createDeploymentConfig of deployImage-submit-utils

To Do-

  • Unit tests for shared-submit-utils

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. component/dev-console Related to dev-console labels Sep 30, 2019
@divyanshiGupta
Copy link
Contributor Author

/test e2e-aws-console-olm

@divyanshiGupta
Copy link
Contributor Author

/assign @rohitkrai03

@divyanshiGupta divyanshiGupta changed the title Bug: Deploy image ignores target port drop down selection and always uses first entry [WIP]Bug: Deploy image ignores target port drop down selection and always uses first entry Oct 1, 2019
@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 1, 2019
@divyanshiGupta divyanshiGupta changed the title [WIP]Bug: Deploy image ignores target port drop down selection and always uses first entry Bug: Deploy image ignores target port drop down selection and always uses first entry Oct 1, 2019
@openshift-ci-robot openshift-ci-robot removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 1, 2019
import { createService, createRoute } from '../shared-submit-utils';
import { GitImportFormData, DeployImageFormData } from '../../components/import/import-types';

describe('Shared submit utils', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably worth creating some snapshot tests here so that the entire output can be tested fully.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@invincibleJai
Copy link
Member

@divyanshiGupta do you have any sample image to test which would have multiple ports exposed?

Copy link
Member

@invincibleJai invincibleJai left a comment

Choose a reason for hiding this comment

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

I have verified locally and seems to work as expected.

const mockData: GitImportFormData = _.cloneDeep(mockFormData);
const mockDeployImageData: DeployImageFormData = _.cloneDeep(mockDeployImageFormData);
const PORT1 = { containerPort: 8081, protocol: 'TCP' };
let serviceObj;
Copy link
Member

Choose a reason for hiding this comment

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

do we know type of serviceObj? i think K8sResourceKind should work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So in K8sResourceKind podLabels is of type Selector but from getPodLabels we are returning a simple object with the required label values and not a Selector object. Hence if I assign K8sResourceKind it gives error. I tried to add a Selector Object with the required label values but while submitting the form it showed some error. That is why I have added any for now in the submit methods also for the resource object.

it('should set correct target port in route object', () => {
const mockData: GitImportFormData = _.cloneDeep(mockFormData);
const mockDeployImageData: DeployImageFormData = _.cloneDeep(mockDeployImageFormData);
let routeObj;
Copy link
Member

Choose a reason for hiding this comment

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

same as above

@@ -62,6 +62,7 @@ const ImageSearch: React.FC = () => {
setFieldValue('isi.status', status);
setFieldValue('isi.ports', ports);
setFieldValue('image.ports', ports);
setFieldValue('image.tag', tag);
Copy link
Member

Choose a reason for hiding this comment

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

Any specific reason for passing tags fetched from imagestream to image.tag here, can we use isi tag only for labels in create service/routes.

Ideally, both would be same but it would be good to have them separate isi tag would be one generated as part of imageStream and image tag would be one provided by user( we may need this later as of now we are not fetching user entered tags)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you see the code of shared submit utils, I have made it usable for both forms. So there are some properties of git import form data that are not available in deploy image form data and vice versa, for such properties I am using get. Before I did, if image exists in form data then its tag will be used otherwise isi.tag will be used, but since image is present in both the form data this was not the right way to get the tag because if we are on deploy image form in this case tag will always be empty since we are not setting image.tag anywhere. That is why I had to set it. This image and isi thing needs to be refactored. I planned to do it in this PR but it turned out that it will need some investigation to refactor it and not break the code anywhere else as both are being used at different places.

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 3, 2019
@invincibleJai
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 3, 2019
@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, divyanshiGupta, invincibleJai

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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 4, 2019
@openshift-merge-robot openshift-merge-robot merged commit d9f98f8 into openshift:master Oct 4, 2019
@spadgett spadgett added this to the v4.3 milestone Oct 4, 2019
@christianvogt
Copy link
Contributor

/retitle Bug 1760836: Deploy image ignores target port drop down selection and always uses first entry

@openshift-ci-robot openshift-ci-robot changed the title Bug: Deploy image ignores target port drop down selection and always uses first entry Bug 1760836: Deploy image ignores target port drop down selection and always uses first entry Nov 5, 2019
@christianvogt
Copy link
Contributor

/bugzilla refresh

@openshift-ci-robot
Copy link
Contributor

@divyanshiGupta: All pull requests linked via external trackers have merged. Bugzilla bug 1760836 has been moved to the MODIFIED state.

In response to this:

Bug 1760836: Deploy image ignores target port drop down selection and always uses first entry

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
Copy link
Contributor

@christianvogt: Bugzilla bug 1760836 is in an unrecognized state (MODIFIED) and will not be moved to the MODIFIED state.

In response to this:

/bugzilla refresh

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.

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. component/dev-console Related to dev-console lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants