protoactor-go
protoactor-go copied to clipboard
K8S Provider is trying to do an invalid patch operation
Describe the bug
After working around https://github.com/asynkron/protoactor-go/issues/652 by injecting larger timeouts into the code when receive timeout is set to 0 I ran into another issue where the provider is trying to do a patch call into the pod labels but failing with json: cannot unmarshal object into Go value of type jsonpatch.Patch.
This is caused by the k8s expecting a JSON array with patch ops rather than a single op.
https://github.com/asynkron/protoactor-go/blob/dev/cluster/clusterproviders/k8s/k8s_provider.go#L337-L345
A simple fix for the issue is to change the patch into a slice.
payload := []struct {
Op string `json:"op"`
Path string `json:"path"`
Value Labels `json:"value"`
}{
{
Op: "replace",
Path: "/metadata/labels",
Value: pod.GetLabels(),
},
}
I can contribute a fix once it clear what the fix for https://github.com/asynkron/protoactor-go/issues/652 is as currently my change set is just full of hacks ;)
I am currently out and incapable of taking care of this but I will be back soon, I can take care of it if you are busy by then