diff --git a/api/v1alpha2/cloudconfig_types.go b/api/v1alpha2/cloudconfig_types.go index 46ff4c5..56efdfe 100644 --- a/api/v1alpha2/cloudconfig_types.go +++ b/api/v1alpha2/cloudconfig_types.go @@ -1,8 +1,8 @@ package v1alpha2 type CloudConfig struct { - Users Users `json:"users,omitempty"` - Plural Plural `json:"plural,omitempty"` + Users Users `json:"users,omitempty" yaml:"users,omitempty"` + Plural Plural `json:"plural,omitempty" yaml:"plural,omitempty"` } type Users []User @@ -16,8 +16,8 @@ func (in Users) FirstUser() *User { } type User struct { - Name string `json:"name"` - Passwd string `json:"passwd"` + Name string `json:"name" yaml:"name"` + Passwd string `json:"passwd" yaml:"passwd"` } func (in *User) GetName() *string { @@ -37,6 +37,6 @@ func (in *User) GetPasswd() *string { } type Plural struct { - Token string `json:"token"` - URL string `json:"url"` + Token string `json:"token" yaml:"token"` + URL string `json:"url" yaml:"url"` } diff --git a/controllers/osartifact_controller.go b/controllers/osartifact_controller.go index 682c81f..bd2da74 100644 --- a/controllers/osartifact_controller.go +++ b/controllers/osartifact_controller.go @@ -18,7 +18,6 @@ package controllers import ( "context" - "encoding/json" "fmt" "time" @@ -40,6 +39,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/yaml" osbuilder "github.com/kairos-io/osbuilder/api/v1alpha2" consoleclient "github.com/kairos-io/osbuilder/pkg/client" @@ -552,7 +552,7 @@ func (r *OSArtifactReconciler) getCloudConfig(ctx context.Context, artifact *osb return config, fmt.Errorf("could not find key %s in secret %s", artifact.Spec.CloudConfigRef.Key, artifact.Spec.CloudConfigRef.Name) } - if err := json.Unmarshal(configBytes, config); err != nil { + if err := yaml.Unmarshal(configBytes, config); err != nil { return config, err }