Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install config from yaml #30

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
423 changes: 303 additions & 120 deletions cmd/kuberoCli/install.go

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions cmd/kuberoCli/install.types.go
Original file line number Diff line number Diff line change
@@ -113,6 +113,73 @@ type KindConfig struct {
} `yaml:"nodes"`
}

type KuberoConfig struct {
configLoaded bool
ClusterType string `yaml:"clusterType" default:"kind"`
OLMRelease string `yaml:"OLMRelease" default:"0.23.1"`
IngressProvider string `yaml:"ingressProvider" default:"baremetal"`
Install struct {
Kubernetes bool `yaml:"kubernetes"`
OLM bool `yaml:"olm"`
Ingress bool `yaml:"ingress" default:"true"`
Metrics bool `yaml:"metrics"`
CertManager bool `yaml:"certManager"`
KuberoOperator bool `yaml:"kuberoOperator" default:"true"`
KuberoUI bool `yaml:"kuberoUI"`
Registry bool `yaml:"registry"`
WriteCliConfig bool `yaml:"writeCliConfig" default:"true"`
} `yaml:"install"`
CertManager struct {
AcmeEmail string `yaml:"acmeEmail" default:"noreply@yourdomain.com"`
} `yaml:"certManager"`
KuberoUI struct {
WebhookSecret string `yaml:"webhookSecret"`
SessionKey string `yaml:"sessionKey"`
AdminUser string `yaml:"adminUser" default:"admin"`
AdminPassword string `yaml:"adminPassword"`
ApiToken string `yaml:"apiToken"`
UI struct {
Host string `yaml:"host" default:"kubero.localhost.com"`
WebhookUrl string `yaml:"webhookUrl" default:"https://kubero.localhost.com/api/repo/webhooks"`
SSL bool `yaml:"ssl" default:"true"`
} `yaml:"ui"`
Registry struct {
Enabled bool `yaml:"enabled" default:"false"`
Local bool `yaml:"local" default:"false"`
Host string `yaml:"host"`
Port string `yaml:"port" default:"443"`
Username string `yaml:"username" default:"admin"`
Password string `yaml:"password"`
StorageSize string `yaml:"storageSize" default:"10Gi"`
StorageClassName string `yaml:"storageClassName" default:""`
} `yaml:"registry"`
Github struct {
Enabled bool `yaml:"enabled"`
PersonalAccessToken string `yaml:"personalAccessToken"`
} `yaml:"github"`
Gitea struct {
Enabled bool `yaml:"enabled"`
PersonalAccessToken string `yaml:"personalAccessToken"`
BaseURL string `yaml:"baseUrl"`
} `yaml:"gitea"`
Gogs struct {
Enabled bool `yaml:"enabled"`
PersonalAccessToken string `yaml:"personalAccessToken"`
BaseURL string `yaml:"baseUrl"`
} `yaml:"gogs"`
Gitlab struct {
Enabled bool `yaml:"enabled"`
PersonalAccessToken string `yaml:"personalAccessToken"`
BaseURL string `yaml:"baseUrl"`
} `yaml:"gitlab"`
Bitbucket struct {
Enabled bool `yaml:"enabled"`
Username string `yaml:"username"`
AppPassword string `yaml:"appPassword"`
} `yaml:"bitbucket"`
} `yaml:"kuberoUI"`
}

type KuberoUIConfig struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
2 changes: 1 addition & 1 deletion cmd/kuberoCli/root.go
Original file line number Diff line number Diff line change
@@ -290,7 +290,7 @@ func loadCLIConfig() {

viper.UnmarshalKey("instances", &instanceList)

// iterate over all instances and and set the config path
// iterate over all instances and set the config path
for instanceName, instance := range instanceList {
instance.Name = instanceName
instance.ConfigPath = viper.ConfigFileUsed()
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ module kubero
go 1.19

require (
github.com/creasty/defaults v1.7.0
github.com/go-git/go-billy/v5 v5.3.1
github.com/go-git/go-git/v5 v5.4.2
github.com/go-resty/resty/v2 v2.7.0
@@ -61,7 +62,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -67,6 +67,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/creasty/defaults v1.7.0 h1:eNdqZvc5B509z18lD8yc212CAqJNvfT1Jq6L8WowdBA=
github.com/creasty/defaults v1.7.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=