shreemaan-abhishek commented on PR #2814:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2814#issuecomment-5127841281

   Checked this against a real API server (envtest, CRDs from 
`config/crd/bases`) rather than reasoning from the Go semantics alone, and 
`config: null` is not reachable.
   
   The API server prunes the explicit null before it is persisted, so 
`plugin.Config.Raw` comes back empty rather than `[]byte("null")`:
   
   ```
   ApisixRoute        ACCEPTED (null)                        -> stored raw="" 
len=0
   ApisixPluginConfig ACCEPTED (null)                        -> stored raw="" 
len=0
   ApisixRoute        ACCEPTED (["10.0.0.0/8"])              -> stored 
raw="[\"10.0.0.0/8\"]" len=14
   ApisixRoute        ACCEPTED ("oops")                      -> stored 
raw="\"oops\"" len=6
   ApisixRoute        ACCEPTED ({"whitelist":["10.0.0.0/8"]}) -> stored 
raw="{\"whitelist\":[\"10.0.0.0/8\"]}" len=28
   ```
   
   With an empty `Raw` the `len(plugin.Config.Raw) > 0` guard is false, so the 
unmarshal is skipped entirely and `config` stays the empty non-nil map from 
`make`. There is no nil map, so no nil-map write in the `secretRef` merge and 
no `null` published for the plugin. The same holds on the `ApisixPluginConfig` 
path that `fillPluginFromExtensionRef` reads.
   
   The non-object cases the PR does target (array, string, number) are 
persisted verbatim, which is what the new tests cover.
   
   The variable shadowing in `fillPluginFromExtensionRef` was a fair point and 
is fixed.
   


-- 
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