Skip to content

New-app: Expose ports specified in source Dockerfile - #3201

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
csrwng:newapp_dockerfile_ports
Jun 24, 2015
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
csrwng:newapp_dockerfile_ports

Conversation

@csrwng

@csrwng csrwng commented Jun 15, 2015

Copy link
Copy Markdown
Contributor

Fixes #3192

@csrwng

csrwng commented Jun 15, 2015

Copy link
Copy Markdown
Contributor Author

@deads2k fyi -- adding a test

@csrwng
csrwng force-pushed the newapp_dockerfile_ports branch from da97321 to 9128753 Compare June 15, 2015 21:12
@csrwng

csrwng commented Jun 15, 2015

Copy link
Copy Markdown
Contributor Author

test added

@csrwng
csrwng force-pushed the newapp_dockerfile_ports branch from 9128753 to a38b8da Compare June 16, 2015 02:44
@csrwng

csrwng commented Jun 16, 2015

Copy link
Copy Markdown
Contributor Author

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

An observation about the code. It's really difficult to know which parts of the objects are supposed to be valid at any given point in time. The ComponentReference holds a ComponentInput which could contain this information as early as the componentsForRepos step, but the ComponentInput gets stomped again during the Resolve step.

Having this change here means that even after Resolve is finished, the ComponentInput is incomplete. I think the ComponentInput is getting mutated here via series of navigated references, but I'm not completely certain. If so, it feels a little weird to have something called buildPipelines change an input object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Having this change here means that even after Resolve is finished, the ComponentInput is incomplete. I think the ComponentInput is getting mutated here via series of navigated references, but I'm not completely certain. If so, it feels a little weird to have something called buildPipelines change an input object.

Not quite. So the input image ref is created here in this method (using ref.Input().Match as the input) https://github.com/csrwng/origin/blob/newapp_dockerfile_ports/pkg/generate/app/cmd/newapp.go#L403, and we're simply mutating that created imageref.

Having said that, I agree that it is hard to follow what objects are available at what time. A restructuring and maybe a refactor to a more functional style of code here with immutable inputs/outputs would be great. But that won't happen right now :-)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Port detection was previously happening while in source detection (removed by this PR). We should restore it somewhere there and not so late in the new-app flow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Port detection was previously happening while in source detection (removed by this PR). We should restore it somewhere there and not so late in the new-app flow.

An issue describing what we'd like to achieve in a refactor would be sufficient for me. I tried to make this modification myself, but after spending an hour in the code, I couldn't figure out where to do it. My changes kept getting stomped.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Port detection was previously happening while in source detection (removed by this PR). We should restore it somewhere there and not so late in the new-app flow.

We still get the data during source detection (populated Dockerfile). However, the flow is different now since we do a resolve step which wasn't happening before.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

An issue describing what we'd like to achieve in a refactor would be sufficient for me. I tried to make this modification myself, but after spending an hour in the code, I couldn't figure out where to do it. My changes kept getting stomped.

#3215

@deads2k

deads2k commented Jun 16, 2015

Copy link
Copy Markdown
Contributor

This isn't handling multiple ports exposed on the same line:

EXPOSE 111/udp 2049/tcp

is producing

- apiVersion: v1
  kind: Service
  metadata:
    creationTimestamp: null
    name: docker-nfs-server
  spec:
    portalIP: ""
    ports:
    - name: docker-nfs-server-udp-111
      nodePort: 0
      port: 111
      protocol: UDP
      targetPort: 111
    selector:
      deploymentconfig: docker-nfs-server
  status:
    loadBalancer: {}

@csrwng

csrwng commented Jun 16, 2015

Copy link
Copy Markdown
Contributor Author

It's a feature :)
We only expose a single port as a service, by design.

@csrwng

csrwng commented Jun 16, 2015

Copy link
Copy Markdown
Contributor Author

The container in the deployment config, however, should include all ports

@deads2k

deads2k commented Jun 16, 2015

Copy link
Copy Markdown
Contributor

We only expose a single port as a service, by design.

Why would I want that? If I have explicitly said in my Dockerfile that I want to expose multiple ports, doesn't it seem reasonable to expose all of them by default?

@deads2k

deads2k commented Jun 16, 2015

Copy link
Copy Markdown
Contributor

Take my case as a for instance. nfs requires more than one port, so I've exposed them in my Dockerfile, but I can't use new-app because it only exposes one.

@csrwng

csrwng commented Jun 16, 2015

Copy link
Copy Markdown
Contributor Author

The thinking is that you could expose more if you like via the oc expose command - per @smarterclayton

@deads2k

deads2k commented Jun 16, 2015

Copy link
Copy Markdown
Contributor

The thinking is that you could expose more if you like via the oc expose command - per

That's certainly a recovery option, but I think the default should be full exposure. The author exposed them for a reason and it's easier for people to edit and delete than to edit and create.

@smarterclayton smarterclayton modified the milestones: 1.0.0, 1.1.0 Jun 17, 2015
@csrwng
csrwng force-pushed the newapp_dockerfile_ports branch from a38b8da to f0ccc3b Compare June 22, 2015 12:23
@csrwng

csrwng commented Jun 22, 2015

Copy link
Copy Markdown
Contributor Author

rebased. @smarterclayton @deads2k - this one should be ready to go in

@deads2k

deads2k commented Jun 22, 2015

Copy link
Copy Markdown
Contributor

lgtm. Will take multiple ports as a separate pull. [merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/3268/) (Image: devenv-fedora_1862)

@csrwng

csrwng commented Jun 22, 2015

Copy link
Copy Markdown
Contributor Author

trying again... [merge]

@deads2k

deads2k commented Jun 23, 2015

Copy link
Copy Markdown
Contributor

re[merge]

@csrwng

csrwng commented Jun 24, 2015

Copy link
Copy Markdown
Contributor Author

hmm, haven't seen this one before...

/data/src/github.com/openshift/origin/assets/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
  var template = new Error(this.message);
                 ^
UnknownError: Error communicating with the remote browser. It may have died.
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
Driver info: driver.version: PhantomJSDriver

@liggitt

liggitt commented Jun 24, 2015

Copy link
Copy Markdown
Contributor

Web driver flake. There's an issue open to investigate replacing with headless chrome

@csrwng

csrwng commented Jun 24, 2015

Copy link
Copy Markdown
Contributor Author

[merge] again

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin up to 2da4e06

openshift-bot pushed a commit that referenced this pull request Jun 24, 2015
@openshift-bot
openshift-bot merged commit 1c9de0d into openshift:master Jun 24, 2015
@csrwng
csrwng deleted the newapp_dockerfile_ports branch July 20, 2015 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants