l-60 kubectl config done

master
dongming 2 years ago
parent 0bf06f6589
commit b8bbbf1bb2

@ -16,7 +16,8 @@ import (
var DefaultStartTimeout = float64(60 * 60)
type Framework struct {
Config *Config
Config *Config
ClusterConfig *ClusterConfig
configFile string // 配置文件的路径
initTimeout float64 // 启动时候,包括安装集群和依赖及本程序的超时时间
@ -60,8 +61,17 @@ func (f *Framework) SynchronizedBeforeSuite(initFunc func()) *Framework {
// 2. 初始化环境访问的授权也就是创建kubectl 访问需要的config
ginkgo.By("kubectl switch context")
// TODO
// kubectl config
kubectlConfig := NewKubectlConfig(f.Config)
if err := kubectlConfig.SetContext(f.ClusterConfig); err != nil {
panic(err)
}
// 推出前清理context
defer func() {
ginkgo.By("kubectl reverting context")
if !f.Config.Sub("cluster").Sub("kind").GetBool("retain") {
_ = kubectlConfig.DeleteContext(f.ClusterConfig)
}
}()
// 3. 安装依赖和我们的程序
ginkgo.By("Preparing install steps")
@ -110,6 +120,7 @@ func (f *Framework) WithConfig(config *Config) *Framework {
}
// TODO
// 创建环境之后填充f.ClusterConfig
func (f *Framework) DeployTestEnvironment() error {
return nil

Loading…
Cancel
Save