Bug 1229520 - [RFE] [beta4] new-app against a dockerfile repo doesn't create a service for every exposed port
Summary: [RFE] [beta4] new-app against a dockerfile repo doesn't create a service for ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: ---
Assignee: Fabiano Franz
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-09 02:39 UTC by Erik M Jacobs
Modified: 2017-03-08 18:26 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-27 09:29:18 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1933 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.3 Release Advisory 2016-09-27 13:24:36 UTC

Description Erik M Jacobs 2015-06-09 02:39:49 UTC
The following YAML only has a service entry for the first port exposed:

osc new-app https://github.com/openshift/centos7-wordpress.git -o yaml

apiVersion: v1beta3
items:
- apiVersion: v1beta3
  kind: ImageStream
  metadata:
    creationTimestamp: null
    name: centos
  spec:
    dockerImageRepository: library/centos:centos7
  status:
    dockerImageRepository: ""
- apiVersion: v1beta3
  kind: ImageStream
  metadata:
    creationTimestamp: null
    name: centos7-wordpress
  spec:
    tags:
    - name: latest
  status:
    dockerImageRepository: ""
- apiVersion: v1beta3
  kind: BuildConfig
  metadata:
    creationTimestamp: null
    name: centos7-wordpress
  spec:
    output:
      to:
        kind: ImageStreamTag
        name: centos7-wordpress:latest
    resources: {}
    source:
      git:
        uri: https://github.com/openshift/centos7-wordpress.git
      type: Git
    strategy:
      dockerStrategy:
        from:
          kind: DockerImage
          name: library/centos:centos7
      type: Docker
    triggers:
    - github:
        secret: VOsqh0Ro4DABWmZnidn5
      type: github
    - generic:
        secret: k3CQ7QnxRTwuDn7lGksA
      type: generic
  status:
    lastVersion: 0
- apiVersion: v1beta3
  kind: DeploymentConfig
  metadata:
    creationTimestamp: null
    name: centos7-wordpress
  spec:
    replicas: 1
    selector:
      deploymentconfig: centos7-wordpress
    strategy:
      resources: {}
      type: Recreate
    template:
      metadata:
        creationTimestamp: null
        labels:
          deploymentconfig: centos7-wordpress
      spec:
        containers:
        - capabilities: {}
          image: library/centos7-wordpress:latest
          name: centos7-wordpress
          ports:
          - containerPort: 22
            name: centos7-wordpress-tcp-22
            protocol: TCP
          - containerPort: 80
            name: centos7-wordpress-tcp-80
            protocol: TCP
          resources: {}
        serviceAccount: ""
    triggers:
    - type: ConfigChange
    - imageChangeParams:
        automatic: true
        containerNames:
        - centos7-wordpress
        from:
          name: centos7-wordpress
        lastTriggeredImage: ""
      type: ImageChange
  status: {}
- apiVersion: v1beta3
  kind: Service
  metadata:
    creationTimestamp: null
    name: centos7-wordpress
  spec:
    portalIP: ""
    ports:
    - name: centos7-wordpress-tcp-22
      nodePort: 0
      port: 22
      protocol: TCP
      targetPort: 22
    selector:
      deploymentconfig: centos7-wordpress
  status:
    loadBalancer: {}
kind: List
metadata: {}

Comment 2 Fabiano Franz 2015-06-09 19:08:51 UTC
This is as designed, we only create a service for the first one in new-app, if you want to expose more ports you need to do 'oc expose'. Clayton can you clarify why we don't expose both 22 and 80 ports right away?

Comment 3 Clayton Coleman 2015-06-09 19:17:18 UTC
In the future we may allow you to specify which ports you want exposed (or all ports).  For now, we will continue to only expose the first.  This is a feature request and we should change it to an RFE and move it out of 3.0

Comment 4 Erik M Jacobs 2015-06-10 14:33:30 UTC
First numerical or first listed?

It appears to be first *numerical*. In the referenced Dockerfile port 80 is exposed before port 22.

I would say that the first listed port should be exposed?

Comment 5 Fabiano Franz 2016-07-04 19:12:52 UTC
oc new-app now exposes all ports in the service. Fixed in master.

Comment 6 XiaochuanWang 2016-07-07 06:48:46 UTC
Verified on oc v3.3.0.2

 oc new-app https://github.com/xiaocwan/ruby-hello-world.git -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: ImageStream
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftNewApp
    creationTimestamp: null
    labels:
      app: ruby-hello-world
    name: ruby-20-centos7
  spec:
    tags:
    - annotations:
        openshift.io/imported-from: openshift/ruby-20-centos7
      from:
        kind: DockerImage
        name: openshift/ruby-20-centos7
      generation: null
      importPolicy: {}
      name: latest
  status:
    dockerImageRepository: ""
- apiVersion: v1
  kind: ImageStream
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftNewApp
    creationTimestamp: null
    labels:
      app: ruby-hello-world
    name: ruby-hello-world
  spec: {}
  status:
    dockerImageRepository: ""
- apiVersion: v1
  kind: BuildConfig
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftNewApp
    creationTimestamp: null
    labels:
      app: ruby-hello-world
    name: ruby-hello-world
  spec:
    output:
      to:
        kind: ImageStreamTag
        name: ruby-hello-world:latest
    postCommit: {}
    resources: {}
    source:
      git:
        uri: https://github.com/xiaocwan/ruby-hello-world.git
      secrets: []
      type: Git
    strategy:
      dockerStrategy:
        from:
          kind: ImageStreamTag
          name: ruby-20-centos7:latest
      type: Docker
    triggers:
    - github:
        secret: qc5sa5ALRnYeeSYS8d92
      type: GitHub
    - generic:
        secret: ocq1dAOw1noYNL1LxXja
      type: Generic
    - type: ConfigChange
    - imageChange: {}
      type: ImageChange
  status:
    lastVersion: 0
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftNewApp
    creationTimestamp: null
    labels:
      app: ruby-hello-world
    name: ruby-hello-world
  spec:
    replicas: 1
    selector:
      app: ruby-hello-world
      deploymentconfig: ruby-hello-world
    strategy:
      resources: {}
    template:
      metadata:
        annotations:
          openshift.io/container.ruby-hello-world.image.entrypoint: '["container-entrypoint","/bin/sh","-c","$STI_SCRIPTS_PATH/usage"]'
          openshift.io/generated-by: OpenShiftNewApp
        creationTimestamp: null
        labels:
          app: ruby-hello-world
          deploymentconfig: ruby-hello-world
      spec:
        containers:
        - image: ruby-hello-world:latest
          name: ruby-hello-world
          ports:
          - containerPort: 80
            protocol: TCP
          - containerPort: 22
            protocol: TCP
          resources: {}
    test: false
    triggers:
    - type: ConfigChange
    - imageChangeParams:
        automatic: true
        containerNames:
        - ruby-hello-world
        from:
          kind: ImageStreamTag
          name: ruby-hello-world:latest
      type: ImageChange
  status: {}
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftNewApp
    creationTimestamp: null
    labels:
      app: ruby-hello-world
    name: ruby-hello-world
  spec:
    ports:
    - name: 22-tcp
      port: 22
      protocol: TCP
      targetPort: 22
    - name: 80-tcp
      port: 80
      protocol: TCP
      targetPort: 80
    selector:
      app: ruby-hello-world
      deploymentconfig: ruby-hello-world
  status:
    loadBalancer: {}
kind: List
metadata: {}

Comment 8 errata-xmlrpc 2016-09-27 09:29:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1933


Note You need to log in before you can comment on or make changes to this bug.