Merge "Remove unsed functions and increase test coverage"
This commit is contained in:
commit
7fd2b820ae
@ -16,8 +16,6 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|
||||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewConfig returns a newly initialized Config object
|
// NewConfig returns a newly initialized Config object
|
||||||
@ -57,28 +55,6 @@ func NewConfig() *Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKubeConfig returns a newly initialized clientcmdapi.Config object, will be removed later
|
|
||||||
func NewKubeConfig() *clientcmdapi.Config {
|
|
||||||
return &clientcmdapi.Config{
|
|
||||||
Clusters: map[string]*clientcmdapi.Cluster{
|
|
||||||
AirshipDefaultContext: {
|
|
||||||
Server: "https://172.17.0.1:6443",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthInfos: map[string]*clientcmdapi.AuthInfo{
|
|
||||||
"admin": {
|
|
||||||
Username: "airship-admin",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Contexts: map[string]*clientcmdapi.Context{
|
|
||||||
AirshipDefaultContext: {
|
|
||||||
Cluster: AirshipDefaultContext,
|
|
||||||
AuthInfo: "admin",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewContext is a convenience function that returns a new Context
|
// NewContext is a convenience function that returns a new Context
|
||||||
func NewContext() *Context {
|
func NewContext() *Context {
|
||||||
return &Context{}
|
return &Context{}
|
||||||
@ -106,13 +82,3 @@ func NewRepository() *Repository {
|
|||||||
func EncodeString(given string) string {
|
func EncodeString(given string) string {
|
||||||
return base64.StdEncoding.EncodeToString([]byte(given))
|
return base64.StdEncoding.EncodeToString([]byte(given))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeString returns the base64 decoded string
|
|
||||||
// If err decoding, return the given string
|
|
||||||
func DecodeString(given string) (string, error) {
|
|
||||||
decoded, err := base64.StdEncoding.DecodeString(given)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return string(decoded), nil
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user