Bug 1486775

Summary: oc adm create-bootstrap-project-template creates an invalid project template
Product: OpenShift Container Platform Reporter: Eduardo Minguez <eminguez>
Component: ocAssignee: Juan Vallejo <jvallejo>
Status: CLOSED ERRATA QA Contact: Wang Haoran <haowang>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.6.1CC: aos-bugs, eminguez, ffranz, jokerman, jvallejo, mfojtik, mkhan, mmccomas, xtian
Target Milestone: ---   
Target Release: 3.6.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-25 13:06:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eduardo Minguez 2017-08-30 14:09:45 UTC
Description of problem:
Using oc adm create-bootstrap-project-template it creates a template with apiVersion parameters wrong, like:

- apiVersion: project.openshift.io/v1

Version-Release number of selected component (if applicable):
$ oc version
oc v3.6.173.0.5
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO

How reproducible:
oc 3.6.173.0.5 command line.




Steps to Reproduce:
1. oc adm create-bootstrap-project-template -o yaml >> oc_adm_template.yaml
2. oadm create-bootstrap-project-template -o yaml >> oadm_template.yaml
3. diff oc_adm_template.yaml oadm_template.yaml

Actual results:
7c7
< - apiVersion: project.openshift.io/v1
---
> - apiVersion: v1
18c18
< - apiVersion: authorization.openshift.io/v1
---
> - apiVersion: v1
32c32
< - apiVersion: authorization.openshift.io/v1
---
> - apiVersion: v1
46c46
< - apiVersion: authorization.openshift.io/v1
---
> - apiVersion: v1
60c60
< - apiVersion: authorization.openshift.io/v1
---
> - apiVersion: v1



Expected results:
Empty

Additional info:
If the *bad* project-request is created, when you try to create a project it fails as:

$ oc new-project jenkins-persistent-test
Error from server (InternalError): Internal error occurred: the project template (default/project-request) is not correctly configured: must contain a project resource

Comment 1 Eduardo Minguez 2017-08-30 14:17:45 UTC
This BZ blocks this one -> https://github.com/openshift/openshift-docs/pull/4785

Comment 2 Juan Vallejo 2017-08-30 15:35:55 UTC
Are you running this against a 3.6 server as well? I'm unable to reproduce this using:

- oc 3.6
- against 3.7 cluster

- oc 3.7
- against 3.7 cluster

Comment 3 Eduardo Minguez 2017-08-30 15:41:19 UTC
The cluster is OCP 3.5, but I've tried it in an isolated environment (aka not logged) and it's the same issue:

$ rm -Rf ~/.kube/*
$ oc logout
error: Missing or incomplete configuration info.  Please login or point to an existing, complete config file:

  1. Via the command-line flag --config
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

To view or setup config directly use the 'config' command.
$ oc whoami
error: Missing or incomplete configuration info.  Please login or point to an existing, complete config file:

  1. Via the command-line flag --config
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

To view or setup config directly use the 'config' command.
$ oc version
oc v3.6.173.0.5
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO

$ ls
$ oc adm create-bootstrap-project-template -o yaml >> oc_adm_template.yaml
$ grep api oc_adm_template.yaml 
apiVersion: v1
- apiVersion: project.openshift.io/v1
- apiVersion: authorization.openshift.io/v1
- apiVersion: authorization.openshift.io/v1
- apiVersion: authorization.openshift.io/v1
- apiVersion: authorization.openshift.io/v1

Comment 4 Eduardo Minguez 2017-08-31 15:01:27 UTC
OCP 3.6 with oc 3.6 seem to work:

[cloud-user@master-0 proje]$ oc adm create-bootstrap-project-template -o yaml >> project.yaml
[cloud-user@master-0 proje]$ oadm create-bootstrap-project-template -o yaml >> oadm_project.yaml
[cloud-user@master-0 proje]$ diff project.yaml oadm_project.yaml 
[cloud-user@master-0 proje]$ oc version
oc v3.6.173.0.5
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://openshift.refarch.roger.com:8443
openshift v3.6.173.0.5
kubernetes v1.6.1+5115d708d7

Comment 5 Juan Vallejo 2017-08-31 21:58:04 UTC
I was able to replicate this with a 1.5 cluster and a 3.6 client.
@ffranz I'm thinking maybe we did not add support for a `project.openshift.io/v1` Project group-version until 3.6? I was able to get the same invalid template generated by `oc adm` to work once I deleted `project.openshift.io/` and just left `v1`.

cc'ing Mo as well.

Comment 6 Juan Vallejo 2017-09-05 20:43:27 UTC
@mfojtik I think `oc` 3.6 should default to generating non-grouped projects for the project template, in order to have at least one future release be backwards-compatible with 3.5 clusters.

Comment 7 Juan Vallejo 2017-09-07 15:47:07 UTC
Origin PR: https://github.com/openshift/origin/pull/16207

Comment 8 Wang Haoran 2017-09-13 02:48:26 UTC
Update status to MODIFY, will verify this once new ose3.6.1 pudle built out

Comment 11 Wang Haoran 2017-09-28 02:24:34 UTC
Verified with:

openshift v3.6.173.0.37
kubernetes v1.6.1+5115d708d7
etcd 3.2.1


steps:
# oc adm create-bootstrap-project-template -o yaml >> oc_adm_template.yaml
# oadm create-bootstrap-project-template -o yaml >> oadm_template.yaml
# diff oc_adm_template.yaml oadm_template.yaml
# less oc_adm_template.yaml 
# 
# grep apiVersion oadm_template.yaml 
apiVersion: v1
- apiVersion: v1
- apiVersion: v1
- apiVersion: v1
- apiVersion: v1
- apiVersion: v1
# grep apiVersion oc_adm_template.yaml 
apiVersion: v1
- apiVersion: v1
- apiVersion: v1
- apiVersion: v1
- apiVersion: v1
- apiVersion: v1

Comment 13 errata-xmlrpc 2017-10-25 13:06:40 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-2017:3049