11package config
22
33import (
4+ "encoding/json"
45 "fmt"
56 "regexp"
67 "strings"
@@ -14,38 +15,38 @@ import (
1415
1516type (
1617 Config struct {
17- Pools []PoolConfig `yaml :"pools"`
18+ Pools []PoolConfig `json :"pools"`
1819 }
1920
2021 PoolConfig struct {
21- Name string `yaml :"pool"`
22- Continue bool `yaml :"continue"`
23- Selector []PoolConfigSelector `yaml :"selector"`
24- Node PoolConfigNode `yaml :"node"`
22+ Name string `json :"pool"`
23+ Continue bool `json :"continue"`
24+ Selector []PoolConfigSelector `json :"selector"`
25+ Node PoolConfigNode `json :"node"`
2526 }
2627
2728 PoolConfigSelector struct {
28- Path string `yaml :"path"`
29+ Path string `json :"path"`
2930 jsonPath * jsonpath.JSONPath
30- Match * string `yaml :"match"`
31- Regexp * string `yaml :"regexp"`
31+ Match * string `json :"match"`
32+ Regexp * string `json :"regexp"`
3233 regexp * regexp.Regexp
3334 }
3435
3536 PoolConfigNode struct {
36- Roles PoolConfigNodeValueMap `yaml :"roles"`
37- JsonPatches []k8s.JsonPatchObject `yaml :"jsonPatches"`
38- ConfigSource * PoolConfigNodeConfigSource `yaml :"configSource"`
39- Labels PoolConfigNodeValueMap `yaml :"labels"`
40- Annotations PoolConfigNodeValueMap `yaml :"annotations"`
37+ Roles PoolConfigNodeValueMap `json :"roles"`
38+ JsonPatches []k8s.JsonPatchObject `json :"jsonPatches"`
39+ ConfigSource * PoolConfigNodeConfigSource `json :"configSource"`
40+ Labels PoolConfigNodeValueMap `json :"labels"`
41+ Annotations PoolConfigNodeValueMap `json :"annotations"`
4142 }
4243
4344 PoolConfigNodeConfigSource struct {
4445 ConfigMap struct {
45- Name string `yaml:"name" json:"name"`
46- Namespace string `yaml:"namespace" json:"namespace"`
47- KubeletConfigKey string `yaml:"kubeletConfigKey" json:"kubeletConfigKey"`
48- } `yaml:"configMap" json:"configMap"`
46+ Name string `json:"name"`
47+ Namespace string `json:"namespace"`
48+ KubeletConfigKey string `json:"kubeletConfigKey"`
49+ } `json:"configMap"`
4950 }
5051
5152 PoolConfigNodeValueMap struct {
@@ -63,12 +64,12 @@ func (valueMap *PoolConfigNodeValueMap) Entries() map[string]*string {
6364 return mapList
6465}
6566
66- func (valueMap * PoolConfigNodeValueMap ) UnmarshalYAML ( unmarshal func ( interface {}) error ) error {
67+ func (valueMap * PoolConfigNodeValueMap ) UnmarshalJSON ( b [] byte ) error {
6768 mapList := map [string ]* string {}
68- err := unmarshal ( & mapList )
69+ err := json . Unmarshal ( b , & mapList )
6970 if err != nil {
7071 var stringList []string
71- err := unmarshal ( & stringList )
72+ err := json . Unmarshal ( b , & stringList )
7273 if err != nil {
7374 return err
7475 }
0 commit comments