aerospike-kubernetes-operator icon indicating copy to clipboard operation
aerospike-kubernetes-operator copied to clipboard

.podSpec.multiPodPerHost missing from result AerospikeCluster

Open noam-ma-ma opened this issue 1 year ago • 3 comments

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:

  1. Apply an AerospikeCluster CRD with ".podSpec.multiPodPerHost"
  2. 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) Screenshot 2024-02-01 at 14 46 56

noam-ma-ma avatar Feb 01 '24 12:02 noam-ma-ma

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

tanmayja avatar Feb 02 '24 10:02 tanmayja

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

noam-ma-ma avatar Feb 08 '24 11:02 noam-ma-ma

Thanks @noam-ma-ma for feedback, we will pick this in future release.

tanmayja avatar Feb 13 '24 12:02 tanmayja

Fixed in 3.3.0

sud82 avatar May 24 '24 10:05 sud82