Bug 1463503

Summary: [PFfBJOsO]Object cannot be return per bind request if contain "." in name
Product: OpenShift Container Platform Reporter: Wenjing Zheng <wzheng>
Component: Service BrokerAssignee: Jim Minter <jminter>
Status: CLOSED CURRENTRELEASE QA Contact: DeShuai Ma <dma>
Severity: low Docs Contact:
Priority: medium    
Version: 3.6.0CC: aos-bugs, bparees
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-14 18:46:29 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 Wenjing Zheng 2017-06-21 07:06:54 UTC
Description of problem:
Cannot recognize object name which contain "." per bind request:
{
  "description": "FindResults failed on annotation template.openshift.io/expose-special.how: special is not found"
 }

Version-Release number of selected component (if applicable):
openshift v3.6.121
kubernetes v1.6.1+5115d708d7
etcd 3.2.0

How reproducible:
always

Steps to Reproduce:
1.Create a configmap template under test project like below:
"apiVersion": "v1",
                "kind": "ConfigMap",
                "metadata": {
                        "name": "special-config",
                        "annotations": {
                          "template.openshift.io/expose-how": "{.data['special.how']}",
                          "template.openshift.io/expose-type": "{.data['special.type']}"
                         }
                },
                "data": {
                        "special.how": "${DATA_1}",
                        "special.type": "${DATA_2}"
                }
        }],
2. Enable service broker to project test
3. Change namespace and cluster address in shared.shh
4. Change namespace to test in provision.sh and bind.ssh and execute these two scripts

Actual results:
{
  "description": "FindResults failed on annotation template.openshift.io/expose-special.how: special is not found"
 }

Expected results:
Should return output like below:
"credentials": {
   "special.how": "data1-SJ6",
   "special.type": "data2-K4E"
  }

Additional info:

Comment 2 Jim Minter 2017-06-21 08:31:41 UTC
Good find.

Perhaps I should have evaluated the kubernetes jsonpath implementation more closely before using it - this is a second example of the implementation being a bit shaky.

It's not documented upstream, but it looks intended that you can work around this issue by escaping the '.' character as follows:

"template.openshift.io/expose-how": "{.data['special\\.how']}",

I worry that there'll be no appetite for changing this behaviour upstream; I'm inclined to resolve this bz by adding a note to the documentation.  @bparees, what do you think?

Comment 3 Ben Parees 2017-06-21 12:30:27 UTC
I think documenting the need to escape special characters is a fine resolution.

Comment 5 Wenjing Zheng 2017-06-28 07:08:19 UTC
Verified this bug since this is added as a documentation to avoid using special characters.