I want to automate kubedb API-version of my custom resource. How can I get the API version that manages bu cluster and pass it in a code that will work in an automatic way. I am using multiple clusters and every cluster is manage by different Api-versions such as my dev cluster is managing by kubedb.com/v1alpha1 but my cluster on production is managed by kubedb.com/v1alpha2. So I want to automate it according to every cluster API-versions.
{
        pg := &unstructured.Unstructured{}
        pg.Object = map[string]interface{}{
            "kind":       "Postgres",
            "apiVersion": "kubedb.com/v1alpha1",
            "metadata": map[string]interface{}{
                "name":      instance.Name + "-timescaledb",
                "namespace": instance.Namespace,
            },
            "spec": map[string]interface{}{
                "version":     "11.1-v1",
                "storageType": "Durable",
                "storage": map[string]interface{}{
                    "storageClassName": "standard",
                    "accessModes":      []string{"ReadWriteOnce"},
                    "resources": map[string]interface{}{
                        "requests": map[string]interface{}{
                            "storage": "50Gi",
                        },
                    },
                },
                "terminationPolicy": "DoNotTerminate",
            },
        }
I want to update this the following apiVersion in the following code
  "apiVersion": "kubedb.com/v1alpha1",