Skip to content

Commit

Permalink
remove go-defaults
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gillson <[email protected]>
  • Loading branch information
TylerGillson committed Nov 6, 2023
1 parent 00ea8c4 commit e316483
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api/k3s_config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package api

type K3sServerConfig struct {
ClusterInit bool `yaml:"cluster-init,omitempty" default:"true"`
ClusterInit bool `yaml:"cluster-init,omitempty"`
DatastoreEndpoint string `yaml:"datastore-endpoint,omitempty"`
DatastoreCaFile string `yaml:"datastore-cafile,omitempty"`
DatastoreCertFile string `yaml:"datastore-certfile,omitempty"`
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.18

require (
github.com/kairos-io/kairos-sdk v0.0.16-0.20231030162246-196f133f2667
github.com/mcuadros/go-defaults v1.2.0
github.com/mudler/yip v1.3.0
github.com/sirupsen/logrus v1.9.3
gopkg.in/yaml.v3 v3.0.1
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mcuadros/go-defaults v1.2.0 h1:FODb8WSf0uGaY8elWJAkoLL0Ri6AlZ1bFlenk56oZtc=
github.com/mcuadros/go-defaults v1.2.0/go.mod h1:WEZtHEVIGYVDqkKSWBdWKUVdRyKlMfulPaGDWIVeCWY=
github.com/mudler/go-pluggable v0.0.0-20230126220627-7710299a0ae5 h1:FaZD86+A9mVt7lh9glAryzQblMsbJYU2VnrdZ8yHlTs=
github.com/mudler/go-pluggable v0.0.0-20230126220627-7710299a0ae5/go.mod h1:WmKcT8ONmhDQIqQ+HxU+tkGWjzBEyY/KFO8LTGCu4AI=
github.com/mudler/yip v1.3.0 h1:MjVh4dDr/imwJ46qXGbftnLRKmDgzs0Y60WyVtXY4i4=
github.com/mudler/yip v1.3.0/go.mod h1:3WeDh6tGX1yYPJom05E7xEjw8dNVlkH2WFxLi7Gflzk=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down Expand Up @@ -117,7 +114,6 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
Expand Down
9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"strings"

"github.com/kairos-io/kairos-sdk/clusterplugin"
"github.com/mcuadros/go-defaults"
yip "github.com/mudler/yip/pkg/schema"
"github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
Expand All @@ -32,9 +31,9 @@ const (

func clusterProvider(cluster clusterplugin.Cluster) yip.YipConfig {
k3sConfig := &api.K3sServerConfig{
Token: cluster.ClusterToken,
ClusterInit: true,
Token: cluster.ClusterToken,
}
defaults.SetDefaults(k3sConfig)

userOptionConfig := cluster.Options

Expand All @@ -46,7 +45,7 @@ func clusterProvider(cluster clusterplugin.Cluster) yip.YipConfig {
if err != nil {
logrus.Fatalf("failed to marshal cluster.ProviderOptions: %v", err)
}
if err := yaml.Unmarshal(providerOpts, &k3sConfig); err != nil {
if err := yaml.Unmarshal(providerOpts, k3sConfig); err != nil {
logrus.Fatalf("failed to unmarshal cluster.ProviderOptions: %v", err)
}
}
Expand All @@ -71,7 +70,7 @@ func clusterProvider(cluster clusterplugin.Cluster) yip.YipConfig {
}

var providerConfig bytes.Buffer
_ = yaml.NewEncoder(&providerConfig).Encode(&k3sConfig)
_ = yaml.NewEncoder(&providerConfig).Encode(k3sConfig)

userOptions, _ := kyaml.YAMLToJSON([]byte(userOptionConfig))
proxyOptions, _ := kyaml.YAMLToJSON([]byte(cluster.Options))
Expand Down

0 comments on commit e316483

Please sign in to comment.