mirror of
https://github.com/clastix/kamaji.git
synced 2026-02-14 18:10:03 +00:00
fix: using local etcd point with kine integration
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type ETCDStorageType int
|
||||
|
||||
const (
|
||||
@@ -7,10 +13,6 @@ const (
|
||||
KineMySQL
|
||||
)
|
||||
|
||||
const (
|
||||
defaultETCDStorageType = ETCD
|
||||
)
|
||||
|
||||
var etcdStorageTypeString = map[string]ETCDStorageType{"etcd": ETCD, "kine-mysql": KineMySQL}
|
||||
|
||||
func (s ETCDStorageType) String() string {
|
||||
@@ -23,6 +25,17 @@ func ParseETCDStorageType(s string) ETCDStorageType {
|
||||
return storageType
|
||||
}
|
||||
|
||||
// TODO: we have to decide what to do in this situation
|
||||
return defaultETCDStorageType
|
||||
panic(fmt.Errorf("unsupported storage type %s", s))
|
||||
}
|
||||
|
||||
// ParseETCDEndpoint returns the default ETCD endpoints used to interact with the Tenant Control Plane backing storage.
|
||||
func ParseETCDEndpoint(conf *viper.Viper) string {
|
||||
switch ParseETCDStorageType(conf.GetString("etcd-storage-type")) {
|
||||
case ETCD:
|
||||
return conf.GetString("etcd-endpoints")
|
||||
case KineMySQL:
|
||||
return "127.0.0.1:2379"
|
||||
default:
|
||||
panic("unsupported storage type")
|
||||
}
|
||||
}
|
||||
|
||||
2
main.go
2
main.go
@@ -82,7 +82,7 @@ func main() {
|
||||
ETCDCASecretNamespace: conf.GetString("etcd-ca-secret-namespace"),
|
||||
ETCDClientSecretName: conf.GetString("etcd-client-secret-name"),
|
||||
ETCDClientSecretNamespace: conf.GetString("etcd-client-secret-namespace"),
|
||||
ETCDEndpoints: conf.GetString("etcd-endpoints"),
|
||||
ETCDEndpoints: types.ParseETCDEndpoint(conf),
|
||||
ETCDCompactionInterval: conf.GetString("etcd-compaction-interval"),
|
||||
TmpBaseDirectory: conf.GetString("tmp-directory"),
|
||||
KineMySQLSecretName: conf.GetString("kine-mysql-secret-name"),
|
||||
|
||||
Reference in New Issue
Block a user