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: {}
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?
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
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?
oc new-app now exposes all ports in the service. Fixed in master.
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: {}
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