Modify integration test to fill CCM test gap

This commit is contained in:
cici37
2021-02-10 15:00:44 -08:00
parent 3c150e8e1f
commit b669f04648
4 changed files with 91 additions and 58 deletions

View File

@@ -31,6 +31,7 @@ import (
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/cloud-provider"
"k8s.io/cloud-provider/app"
cloudcontrollerconfig "k8s.io/cloud-provider/app/config"
@@ -44,11 +45,6 @@ import (
// e.g. _"k8s.io/legacy-cloud-providers/<provider>"
)
const (
// cloudProviderName shows an sample of using hard coded parameter, please edit the value for your case.
cloudProviderName = "SampleCloudProviderName"
)
func main() {
rand.Seed(time.Now().UnixNano())
@@ -67,7 +63,7 @@ func main() {
// If you do not need additional controller, please ignore.
controllerInitializers["nodeipam"] = startNodeIpamControllerWrapper
command := app.NewCloudControllerManagerCommand(ccmOptions, cloudInitializer, controllerInitializers)
command := app.NewCloudControllerManagerCommand(ccmOptions, cloudInitializer, controllerInitializers, wait.NeverStop)
// TODO: once we switch everything over to Cobra commands, we can go back to calling
// utilflag.InitFlags() (by removing its pflag.Parse() call). For now, we have to set the
@@ -84,9 +80,9 @@ func main() {
}
func cloudInitializer(config *cloudcontrollerconfig.CompletedConfig) cloudprovider.Interface {
cloudConfigFile := config.ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile
cloudConfig := config.ComponentConfig.KubeCloudShared.CloudProvider
// initialize cloud provider with the cloud provider name and config file provided
cloud, err := cloudprovider.InitCloudProvider(cloudProviderName, cloudConfigFile)
cloud, err := cloudprovider.InitCloudProvider(cloudConfig.Name, cloudConfig.CloudConfigFile)
if err != nil {
klog.Fatalf("Cloud provider could not be initialized: %v", err)
}