Bug 1327500 - Build pod may fail on creation due to a long label
Summary: Build pod may fail on creation due to a long label
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Build
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Cesar Wong
QA Contact: Wenjing Zheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-15 09:10 UTC by Vadim Rutkovsky
Modified: 2016-06-27 15:06 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Pod and build names allow for up to 256 characters, however label values cannot be more than 64 characters. This caused builds to fail for build configurations with names longer than 64 characters, due to the invalid length set for the build pod's label. This bug fix truncates the value of build pod labels to 64 chars and relies on the build annotation to get the full name. As a result, builds no longer fail in this scenario.
Clone Of:
Environment:
Last Closed: 2016-06-27 15:06:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1343 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 3.2.1.1 bug fix and enhancement update 2016-06-27 19:04:05 UTC

Description Vadim Rutkovsky 2016-04-15 09:10:33 UTC
Description of problem:
Openshift trims the buildconfig name for very long input, but the build cannot be started as '-build' is appended at the end.

Version-Release number of selected component (if applicable):
Openshift Dedicated
oc v3.1.1.6-33-g81eabcc
kubernetes v1.1.0-origin-1107-g4c8e6f4

How reproducible:
Always

Steps to Reproduce:
1. Create a buildconfig with a really long name, exceeding 64 chars
2. Start a build

Actual results:
Pod creation may fail:
oc describe builds jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1                                                                                         Name:			jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1
Created:		21 minutes ago
Labels:			buildconfig=jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe,is_autorebuild=false,openshift.io/build-config.name=jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe
Annotations:		openshift.io/build.number=1
Build Config:		jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe
Duration:		0
Build Pod:		jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1-build
Strategy:		Custom
URL:			git://pkgs.devel.redhat.com/rpms/jboss-webserver-3-docker
Ref:			4c251dccbe023735a4f9df226125568968b53745
Image Reference:	DockerImage brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/rcm/buildroot:eng-rhel-7-candidate-20160413130433
Expose Docker Socket:	yes
Environment:		DOCK_PLUGINS={"prebuild_plugins": [{"args": {"parent_registry_insecure": true, "parent_registry": "brew-pulp-docker01.web.qa.ext.phx1.redhat.com:8888"}, "name": "pull_base_image"}, {"args": {"labels": {"Authoritative_Registry": "registry.access.redhat.com", "distribution-scope": "public", "Vendor": "Red Hat, Inc.", "Build_Host": "osbs-devops.openshift.com"}}, "name": "add_labels_in_dockerfile"}, {"name": "change_from_in_dockerfile"}, {"name": "add_dockerfile"}, {"args": {"command": "rhpkg sources"}, "name": "distgit_fetch_artefacts"}, {"args": {"repourls": ["http://git.engineering.redhat.com/git/users/vrutkovs/openshift-jenkins-docker/plain/aos-signed-latest.repo"]}, "name": "add_yum_repo_by_url"}, {"name": "inject_yum_repo"}, {"name": "dockerfile_content"}], "exit_plugins": [{"args": {"url": "https://api.devops-osbs.openshift.com/", "verify_ssl": false, "use_auth": true}, "name": "store_metadata_in_osv3"}, {"args": {"kojihub": "https://brewhub.stage.engineering.redhat.com/brewhub", "url": "https://api.devops-osbs.openshift.com/", "blocksize": 10485760, "koji_ssl_certs": "/var/run/secrets/atomic-reactor/kojisecret", "verify_ssl": false, "use_auth": true}, "name": "koji_promote"}, {"name": "remove_built_image"}], "postbuild_plugins": [{"args": {"load_exported_image": true, "method": "gzip"}, "name": "compress"}, {"name": "tag_by_labels"}, {"args": {"registries": {}}, "name": "tag_and_push"}, {"args": {"pulp_secret_path": "/var/run/secrets/atomic-reactor/pulpsecret", "load_exported_image": true, "dockpulp_loglevel": "INFO", "pulp_registry_name": "brew-qa"}, "name": "pulp_push"}, {"args": {"image_id": "BUILT_IMAGE_ID"}, "name": "all_rpm_packages"}], "prepublish_plugins": [{"args": {"remove_former_image": false, "dont_load": true}, "name": "squash"}]}
:			OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE=brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/rcm/buildroot:eng-rhel-7-candidate-20160413130433
Output to:		DockerImage root/vrutkovs-httpd:ce-1.2-tomcat7-webserver-3.0-jdk-8-rhel-7-docker-candidate-20160415103634
Status:			Cancelled (Failed to create build pod: Pod "jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1-build" is invalid: metadata.labels: invalid value 'jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1', Details: must have at most 63 characters, matching regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?: e.g. "MyValue" or "".)
Events:
  FirstSeen	LastSeen	Count	From			SubobjectPath	Reason			Message
  ─────────	────────	─────	────			─────────────	──────			───────
  21m		21m		1	{build-controller }			HandleBuildError	Build has error: failed to create build pod: Pod "jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1-build" is invalid: metadata.labels: invalid value 'jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1', Details: must have at most 63 characters, matching regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?: e.g. "MyValue" or ""
  21m		13m		458	{build-controller }			FailedCreate		Error creating: Pod "jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1-build" is invalid: metadata.labels: invalid value 'jboss-webserver-3-docker-ce-1.2-tomcat7-webserver-3.0-jdk-8-rhe-1', Details: must have at most 63 characters, matching regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?: e.g. "MyValue" or ""


Expected results:
Pod name is trimmed correctly, the build can start

Additional info:

Comment 1 Cesar Wong 2016-05-12 22:13:43 UTC
PR with fix: https://github.com/openshift/origin/pull/8864

Comment 2 Cesar Wong 2016-05-31 20:34:12 UTC
Delivered to OSE (next release) with PR
https://github.com/openshift/ose/pull/249

Comment 4 yantan 2016-06-06 07:47:10 UTC
$oc version
oc v3.2.1.1-1-g33fa4ea
kubernetes v1.2.0-36-g4a3f9c5

$ oc get build
NAME                                                                       TYPE      FROM          STATUS     STARTED         DURATION
ruby-sample-build-longename-morethan64characters-to-thebuildname-build-1   Source    Git@e79d887   Complete   4 minutes ago   1m28s
$ oc describe pod ruby-sample-build-longename-morethan64characters-to-thebuildname-build-1-build
Name:		ruby-sample-build-longename-morethan64characters-to-thebuildname-build-1-build
Namespace:	yantan
Node:		openshift-150.lab.sjc.redhat.com/10.14.6.150
Start Time:	Mon, 06 Jun 2016 15:39:53 +0800
Labels:		openshift.io/build.name=ruby-sample-build-longename-morethan64characters-to-thebuildnam
Status:		Succeeded
IP:		10.2.0.4
Controllers:	<none>
Containers:
  sti-build:
    Container ID:	docker://66fd02fcf006346f23312f8b0abc992da3b57a45c356df76d711d0d7e5e85869
    Image:		brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/openshift3/ose-sti-builder:v3.2.1.1
    Image ID:		docker://sha256:351b75c51e61023ea82515b14364d105909d1d05136d4389c75c833275fdc62c
    Port:		
    Args:
      --loglevel=5
    QoS Tier:
      cpu:		BestEffort
      memory:		BestEffort
    State:		Terminated
      Reason:		Completed

Comment 6 errata-xmlrpc 2016-06-27 15:06:06 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:1343


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