Skip to content

Commit

Permalink
Fix flipping QdrantCluster.Spec.ServicePerNode from false to `tru…
Browse files Browse the repository at this point in the history
…e` (#45)

The default value for the field is `true`, and it is omitted from the serialized
output if the field is set to false. Hence, it is possible to flip value from `true` to
`false` in the following scenario:

* client submits to k8s API server with `ServicePerNode=false`
* client fetch the persisted instance from k8s API server, given that
`false` for a boolean is considered empty, `ServicePerNode` field does
not appear in the received payload.
* client updates the payload and sends it back the k8s API server. Given
that `ServicePerNode` is not present in the payload, k8s API server is going
to flip it to the default value, which is `true`

To correct this, `omitempty` tag is removed for `ServicePerNode` field,
so that the field is always present in the serialized output.
  • Loading branch information
pedjak authored Nov 22, 2024
1 parent 706498a commit 616d0bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/v1/qdrantcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type QdrantClusterSpec struct {
// ServicePerNode specifies whether the cluster should start a dedicated service for each node.
// +kubebuilder:default=true
// +optional
ServicePerNode bool `json:"servicePerNode,omitempty"`
ServicePerNode bool `json:"servicePerNode"`
// ClusterManager specifies whether to use the cluster manager for this cluster.
// The Python-operator will deploy a dedicated cluster manager instance.
// The Go-operator will use a shared instance.
Expand Down

0 comments on commit 616d0bd

Please sign in to comment.