-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
Problem
When a service binding contains boolean fields in the credentials (e.g., saasregistryenabled: true), the .metadata field in the generated Kubernetes secret incorrectly classifies these fields as format "json" instead of a more appropriate type like "text" or "boolean".
Example
Service Manager Binding Response:
{
"credentials": {
"saasregistryenabled": true,
"uaa": {...},
"url": "https://example.com"
}
}Generated Secret .metadata field:
{
"credentialProperties": [
{"name": "saasregistryenabled", "format": "json"},
{"name": "uaa", "format": "json"},
{"name": "url", "format": "text"}
],
"metaDataProperties": [...]
}Root Cause
The issue is in the serialize() function in internal/utils/controller_util.go (lines 151-162). It defaults to JSON for all non-string values:
func serialize(value interface{}) ([]byte, format, error) {
if byteArrayVal, ok := value.([]byte); ok {
return byteArrayVal, JSON, nil
}
if strVal, ok := value.(string); ok {
return []byte(strVal), TEXT, nil
}
data, err := json.Marshal(value)
if err != nil {
return nil, UNKNOWN, err
}
return data, JSON, nil
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels