Bug 1280247 - Pre-upgrade checks couldn't report invalid port name
Pre-upgrade checks couldn't report invalid port name
Product: OpenShift Container Platform
Classification: Red Hat
Component: Upgrade (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Jason DeTiberus
Johnny Liu
Depends On:
  Show dependency treegraph
Reported: 2015-11-11 05:34 EST by Anping Li
Modified: 2015-11-19 18:29 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-11-19 18:29:33 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2015:2492 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 3.1 upgrade support enhancement 2015-11-19 22:10:38 EST

  None (edit)
Description Anping Li 2015-11-11 05:34:19 EST
Description of problem:
pre-upgrade-check can't report the invalid port name. For example: "web-web-web-webs", "mysqlmysql-mysqls",  "w-e--b" , " "name": "w-e--b""

Version-Release number of selected component (if applicable):
openshift v3.0.2.0

How reproducible:

Steps to Reproduce:
1. create applications with invalid port name.

anli@openshift-120 ~]$ oc get service -o json |grep name
<--skip -->
   "name": "w-e--b",
<--skip -->
   "name": "m--ysql",

2. python pre-upgrade-check

Actual results:
[root@openshift-120 ~]# python pre-upgrade-check
Checking for oc ... found
[root@openshift-120 ~]#

Expected Results:

All invalid port name should be print.
Comment 1 Brenton Leanhardt 2015-11-11 09:01:33 EST
Hi Anping!

In the case of services it's not the name that is being checked but instead the 'targetPort':


I think this is simply a minor problem with the test case.  Would you mind testing again by setting a broken targetPort on a 3.0 install?
Comment 2 Anping Li 2015-11-11 10:01:55 EST
Hi Brenton,  
Andy Goldstein said 'this is about port names, not pod names. 3.0 supported port names longer than 15 characters, and it also allowed consecutive hyphens. 3.1 restricts port names to a max of 15 characters and won't allow --. We need a pre-upgrade script that ensures that anyone with 3.0 deployed can identify possible DCs, RCs, pods, and services that have port names that become invalid in 3.1.'. target port only can be digits. I think it should be port name.
Comment 3 Andy Goldstein 2015-11-11 10:11:36 EST
Hi Anping,

Brenton is correct. For services, the field that can potentially result in validation errors when upgrading from 3.0 to a newer version is targetPort. It can be either number or a string. See https://github.com/openshift/origin/blob/e0399d977ca537eb2532f0cbccf48d7c5ec8f71b/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/v1/types.go#L1616-L1623 for full details.

Could you please retest with values in service.spec.ports[i].targetPort? Thanks!
Comment 4 Anping Li 2015-11-12 09:10:59 EST
Finally, I can create the test data. the issue finally turn out only exist in openshift v3.0.0.1. 

The scripts pre-upgrade-check works well. A short snapshot is as following. 

root@openshift-111 ~]# python pre-upgrade-check 
Checking for oc ... found
At least one port name does not validate. Valid port names:

    * must be less that 16 chars
    * have at least one letter
    * only a-z0-9-
    * do not start or end with -
    * Dashes may not be next to eachother ('--')

services/frontend -n test2 (Port="88888888888888888")
services/frontend -n test3 (Port="8")
services/database -n test4 (Port="#a")
services/frontend -n test4 (Port="a--a")
services/database -n test6 (Port="-a")
services/frontend -n test6 (Port="a1-")
Comment 6 errata-xmlrpc 2015-11-19 18:29:33 EST
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.


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