Copilot commented on code in PR #88:
URL: 
https://github.com/apache/cloudstack-kubernetes-provider/pull/88#discussion_r4045323086


##########
cloudstack_loadbalancer.go:
##########
@@ -1236,6 +1451,21 @@ func getStringFromServiceAnnotation(service 
*corev1.Service, annotationKey strin
        return defaultSetting
 }
 
+// parseStickinessParams parses a comma-separated string of key=value pairs 
into a map.
+// Whitespace around entries, keys and values is trimmed. Empty entries and 
entries
+// without a "=" are skipped, while an empty value ("key=") is kept as an 
empty string.
+func parseStickinessParams(paramString string) map[string]string {
+       params := make(map[string]string)
+       for _, param := range strings.Split(paramString, ",") {
+               parts := strings.SplitN(param, "=", 2)
+               if len(parts) != 2 {
+                       continue
+               }
+               params[strings.TrimSpace(parts[0])] = 
strings.TrimSpace(parts[1])

Review Comment:
   `SplitN` makes values such as `expr=a=b` and `key=` look supported here, but 
CloudStack serializes stickiness parameters as `key=value&...` and its 
`LBStickinessPolicyVO.getParams()` splits on both `=` and `&` (and drops 
trailing empty fields). Those values are therefore truncated or disappear when 
read back: the next reconciliation sees a mismatch, repeatedly replaces the 
policy, and the backend never receives the requested value. Please 
reject/escape these values or otherwise align the parser and documentation with 
CloudStack's round-trip format.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to