service-binding-operator: Service binding global and service envVarPrefix doesn't behave as expected
According to our latest test, there are some features broken after #407 is merged.
Below is the SBR and the environment result.
cat <<EOF | kubectl apply -f -
apiVersion: apps.openshift.io/v1alpha1
kind: ServiceBindingRequest
metadata:
name: sbr5
spec:
envVarPrefix: globalprefix
applicationSelector:
resourceRef: mytranslator-web-vcap5
group: apps
version: v1
resource: deployments
backingServiceSelectors:
- group: ibmcloud.ibm.com
version: v1alpha1
kind: Binding
resourceRef: thetranslator5
envVarPrefix: prefix1
customEnvVar:
- name: ALL_SECRET
value: '{{json .}}'
EOF
Env var result:
GLOBALPREFIX_PREFIX1_BINDING_SECRET_STATUS_SECRETNAME_IAM_ROLE_CRN=crn:v1:bluemix:public:iam::::serviceRole:Manager
GLOBALPREFIX_PREFIX1_BINDING_SECRET_STATUS_SECRETNAME_IAM_APIKEY_DESCRIPTION=Auto-generated for key 0aef56aa-fbb2-4dd7-8bc7-972302e14573
GLOBALPREFIX_PREFIX1_BINDING_SECRET_STATUS_SECRETNAME_APIKEY=xxxxx
globalprefix_ALL_SECRET={"v1alpha1":{"ibmcloud.ibm.com":{"Binding":{"thetranslator5":{"apiVersion":"ibmcloud.ibm.com/v1alpha1","kind":"Binding","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"ibmcloud.ibm.com/v1alpha1\",\"kind\":\"Binding\",\"metadata\":{\"annotations\":{},\"name\":\"thetranslator5\",\"namespace\":\"default\"},\"spec\":{\"serviceName\":\"thetranslator5\"}}\n","service-binding-operator.apps.openshift.io/binding-name":"sbr5","service-binding-operator.apps.openshift.io/binding-namespace":"default"},"creationTimestamp":"2020-05-14T08:55:22Z","finalizers":["binding.ibmcloud.ibm.com"],"generation":1,"name":"thetranslator5","namespace":"default","ownerReferences":[{"apiVersion":"ibmcloud.ibm.com/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"Service","name":"thetranslator5","uid":"a6adaa6b-94ae-421f-8698-1e9ec2b48e64"}],"resourceVersion":"4439896","selfLink":"/apis/ibmcloud.ibm.com/v1alpha1/namespaces/default/bindings/thetranslator5","uid":"e07c5c19-25d8-4016-add9-213366b4259c"},"spec":{"serviceName":"thetranslator5"},"status":{"instanceId":"crn:v1:bluemix:public:language-translator:us-south:a/ef6a34810cbcd892507d3ebe01e3d95a:78abe198-feb8-41c9-b293-38b21beb8973::","keyInstanceId":"crn:v1:bluemix:public:language-translator:us-south:a/ef6a34810cbcd892507d3ebe01e3d95a:78abe198-feb8-41c9-b293-38b21beb8973:resource-key:0aef56aa-fbb2-4dd7-8bc7-972302e14573","message":"Online","secretName":"thetranslator5","state":"Online"}}}},"ibmcloud_ibm_com":{"Binding":{"thetranslator5":{"apiVersion":"ibmcloud.ibm.com/v1alpha1","kind":"Binding","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"ibmcloud.ibm.com/v1alpha1\",\"kind\":\"Binding\",\"metadata\":{\"annotations\":{},\"name\":\"thetranslator5\",\"namespace\":\"default\"},\"spec\":{\"serviceName\":\"thetranslator5\"}}\n","service-binding-operator.apps.openshift.io/binding-name":"sbr5","service-binding-operator.apps.openshift.io/binding-namespace":"default"},"creationTimestamp":"2020-05-14T08:55:22Z","finalizers":["binding.ibmcloud.ibm.com"],"generation":1,"name":"thetranslator5","namespace":"default","ownerReferences":[{"apiVersion":"ibmcloud.ibm.com/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"Service","name":"thetranslator5","uid":"a6adaa6b-94ae-421f-8698-1e9ec2b48e64"}],"resourceVersion":"4439896","selfLink":"/apis/ibmcloud.ibm.com/v1alpha1/namespaces/default/bindings/thetranslator5","uid":"e07c5c19-25d8-4016-add9-213366b4259c"},"spec":{"serviceName":"thetranslator5"},"status":{"instanceId":"crn:v1:bluemix:public:language-translator:us-south:a/ef6a34810cbcd892507d3ebe01e3d95a:78abe198-feb8-41c9-b293-38b21beb8973::","keyInstanceId":"crn:v1:bluemix:public:language-translator:us-south:a/ef6a34810cbcd892507d3ebe01e3d95a:78abe198-feb8-41c9-b293-38b21beb8973:resource-key:0aef56aa-fbb2-4dd7-8bc7-972302e14573","message":"Online","secretName":"thetranslator5","state":"Online"}}}}}}
GLOBALPREFIX_PREFIX1_BINDING_SECRET_STATUS_SECRETNAME_IAM_SERVICEID_CRN=crn:v1:bluemix:public:iam-identity::a/ef6a34810cbcd892507d3ebe01e3d95a::serviceid:ServiceId-71e18dc7-1d02-4704-b167-be29f4172044
GLOBALPREFIX_PREFIX1_BINDING_SECRET_STATUS_SECRETNAME_IAM_APIKEY_NAME=thetranslator5
GLOBALPREFIX_PREFIX1_BINDING_SECRET_STATUS_SECRETNAME_URL=https://api.us-south.language-translator.watson.cloud.ibm.com/instances/78abe198-feb8-41c9-b293-38b21beb8973
There are 3 issues I have found:
1 There are prefixes BINDING_SECRET_STATUS
for all env vars, but previously we do not have them.
2 With the custom env var ALL_SECRET
, there is only secretName in the result content, but previously the content of the secret should be in the content.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 27 (27 by maintainers)
@qibobo here it is, right from the oven 😃