mirror of
https://github.com/kairos-io/osbuilder.git
synced 2025-08-18 15:57:17 +00:00
use yaml unmarshaller instead of json for cloud config
This commit is contained in:
parent
bcea090a11
commit
f07cf1d24f
@ -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"`
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user