aerospike-kubernetes-operator
aerospike-kubernetes-operator copied to clipboard
.podSpec.multiPodPerHost missing from result AerospikeCluster
Issue Details
When the AerospikeCluster CRD is applied with the ".podSpec.multiPodPerHost" field, the resulting target AerospikeCluster CRD does not contain this field, despite it being clearly mentioned in the kubectl.kubernetes.io/last-applied-configuration
metadata.annotation.
I'm using aerospike-operator v3.2.0.
Steps to Reproduce:
To reproduce this issue, follow these steps:
- Apply an AerospikeCluster CRD with ".podSpec.multiPodPerHost"
- Check the resulting target CRD and observe that the field is missing.
Expected Behavior:
After applying the CRD, the target CRD should reflect the same configuration as the kubectl.kubernetes.io/last-applied-configuration
metadata.annotation and contain the ".podSpec.multiPodPerHost" field.
Impact
When using AerospikeCluster with ArgoCD, the object is always "out of sync" (left is the cluster object, right is the git manifest)
Hi Noam,
This action is a result of the JSON marshalling process. The use of the "omitempty" option indicates that the field will be excluded from the encoding if it holds an empty value. An empty value is defined as false, 0, a nil pointer, a nil interface value, or any empty array, slice, map, or string.
In the context of the described situation, the multiPodPerHost field is a boolean type with the omitempty tag. Consequently, a value of "false" is considered empty, leading to the omission of this field from the Custom Resource Definition (CRD).
Hey @tanmayja, thanks for the detailed explanation.
In my experience it is not the expected outcome when working with the k8s manifests. From a user perspective I have to add a small hack to my chart:
{{- if .Values.multiPodPerHost }}
multiPodPerHost: {{ .Values.multiPodPerHost }}
{{- end }}
Thanks @noam-ma-ma for feedback, we will pick this in future release.
Fixed in 3.3.0