I have below snippet
func fakeGetInclusterConfig() (*corev1.ConfigMap, error) {
configMap := &corev1.ConfigMap{
Data: map[string]map[string]string{"cluster-config.json":{
"cluster_id":"xxx",
"cluster_name":"yyy",
"cluster_type":"zzz",
"cluster_pay_tier":"paid",
},
},
}
return configMap, nil
}
But the Data
part has some issue. I am unable to properly declare the type.I tried all options I know but obviously not the correct one . Please could some one help here
The main code expects
configmap, err := cm.GetConfigMap(handler.k8sclient, Configmap, ConfigmapNS)
clusterConfigJSON := configmap.Data["cluster-config.json"]
clusterConfigJSON = strings.Replace(clusterConfigJSON, "\n", "", -1)
clusterConfigJSON = strings.Replace(clusterConfigJSON, " ", "", -1)
var clusterConfigInfo clusterInfo
err = json.Unmarshal([]byte(clusterConfigJSON), &clusterConfigInfo)
if err != nil {
So I want a json structure for cluster-config.json
key. I am trying to create dummy data for test case.