mirror of
https://github.com/kairos-io/osbuilder.git
synced 2025-08-23 18:08:36 +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
|
package v1alpha2
|
||||||
|
|
||||||
type CloudConfig struct {
|
type CloudConfig struct {
|
||||||
Users Users `json:"users,omitempty"`
|
Users Users `json:"users,omitempty" yaml:"users,omitempty"`
|
||||||
Plural Plural `json:"plural,omitempty"`
|
Plural Plural `json:"plural,omitempty" yaml:"plural,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Users []User
|
type Users []User
|
||||||
@ -16,8 +16,8 @@ func (in Users) FirstUser() *User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name" yaml:"name"`
|
||||||
Passwd string `json:"passwd"`
|
Passwd string `json:"passwd" yaml:"passwd"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (in *User) GetName() *string {
|
func (in *User) GetName() *string {
|
||||||
@ -37,6 +37,6 @@ func (in *User) GetPasswd() *string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Plural struct {
|
type Plural struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token" yaml:"token"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url" yaml:"url"`
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -40,6 +39,7 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||||
|
"sigs.k8s.io/yaml"
|
||||||
|
|
||||||
osbuilder "github.com/kairos-io/osbuilder/api/v1alpha2"
|
osbuilder "github.com/kairos-io/osbuilder/api/v1alpha2"
|
||||||
consoleclient "github.com/kairos-io/osbuilder/pkg/client"
|
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)
|
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
|
return config, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user