mirror of https://github.com/kubernetes/kops.git
run hack/update-bazel.sh and go fmt and BUILD.bazel file in addons
This commit is contained in:
parent
013f8799fa
commit
5bc52c08c0
|
@ -0,0 +1,5 @@
|
||||||
|
filegroup(
|
||||||
|
name = "exported_testdata",
|
||||||
|
srcs = glob(["**"]),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
|
@ -105,6 +105,7 @@ go_test(
|
||||||
"populateinstancegroup_test.go",
|
"populateinstancegroup_test.go",
|
||||||
"subnets_test.go",
|
"subnets_test.go",
|
||||||
"tagbuilder_test.go",
|
"tagbuilder_test.go",
|
||||||
|
"template_functions_test.go",
|
||||||
"validation_test.go",
|
"validation_test.go",
|
||||||
],
|
],
|
||||||
data = [
|
data = [
|
||||||
|
@ -116,6 +117,7 @@ go_test(
|
||||||
"//pkg/apis/kops/validation:go_default_library",
|
"//pkg/apis/kops/validation:go_default_library",
|
||||||
"//pkg/assets:go_default_library",
|
"//pkg/assets:go_default_library",
|
||||||
"//pkg/client/simple/vfsclientset:go_default_library",
|
"//pkg/client/simple/vfsclientset:go_default_library",
|
||||||
|
"//pkg/featureflag:go_default_library",
|
||||||
"//pkg/kopscodecs:go_default_library",
|
"//pkg/kopscodecs:go_default_library",
|
||||||
"//pkg/model:go_default_library",
|
"//pkg/model:go_default_library",
|
||||||
"//pkg/templates:go_default_library",
|
"//pkg/templates:go_default_library",
|
||||||
|
@ -127,5 +129,6 @@ go_test(
|
||||||
"//util/pkg/vfs:go_default_library",
|
"//util/pkg/vfs:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
|
"//vendor/k8s.io/kubernetes/pkg/controller/nodeipam/ipam:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,18 +1,34 @@
|
||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cloudup
|
package cloudup
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/kops/pkg/featureflag"
|
|
||||||
"path/filepath"
|
|
||||||
"io/ioutil"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"text/template"
|
|
||||||
"k8s.io/kops/pkg/apis/kops"
|
|
||||||
"reflect"
|
|
||||||
"testing"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"io/ioutil"
|
||||||
|
"k8s.io/kops/pkg/apis/kops"
|
||||||
|
"k8s.io/kops/pkg/featureflag"
|
||||||
"k8s.io/kops/upup/pkg/fi"
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
"k8s.io/kubernetes/pkg/controller/nodeipam/ipam"
|
"k8s.io/kubernetes/pkg/controller/nodeipam/ipam"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_TemplateFunctions_CloudControllerConfigArgv(t *testing.T) {
|
func Test_TemplateFunctions_CloudControllerConfigArgv(t *testing.T) {
|
||||||
|
@ -27,7 +43,6 @@ func Test_TemplateFunctions_CloudControllerConfigArgv(t *testing.T) {
|
||||||
cluster: &kops.Cluster{Spec: kops.ClusterSpec{
|
cluster: &kops.Cluster{Spec: kops.ClusterSpec{
|
||||||
CloudProvider: string(kops.CloudProviderOpenstack),
|
CloudProvider: string(kops.CloudProviderOpenstack),
|
||||||
ExternalCloudControllerManager: &kops.CloudControllerManagerConfig{},
|
ExternalCloudControllerManager: &kops.CloudControllerManagerConfig{},
|
||||||
|
|
||||||
}},
|
}},
|
||||||
expectedArgv: []string{
|
expectedArgv: []string{
|
||||||
"--v=2",
|
"--v=2",
|
||||||
|
@ -85,8 +100,6 @@ func Test_TemplateFunctions_CloudControllerConfigArgv(t *testing.T) {
|
||||||
ExternalCloudControllerManager: &kops.CloudControllerManagerConfig{
|
ExternalCloudControllerManager: &kops.CloudControllerManagerConfig{
|
||||||
ClusterName: "k8s",
|
ClusterName: "k8s",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
}},
|
}},
|
||||||
expectedArgv: []string{
|
expectedArgv: []string{
|
||||||
"--v=2",
|
"--v=2",
|
||||||
|
@ -138,7 +151,6 @@ func Test_TemplateFunctions_CloudControllerConfigArgv(t *testing.T) {
|
||||||
"--cloud-provider=openstack",
|
"--cloud-provider=openstack",
|
||||||
"--allocate-node-cidrs=true",
|
"--allocate-node-cidrs=true",
|
||||||
"--use-service-account-credentials=true",
|
"--use-service-account-credentials=true",
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -202,7 +214,6 @@ func Test_TemplateFunctions_CloudControllerConfigArgv(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func Test_executeTemplate(t *testing.T) {
|
func Test_executeTemplate(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
desc string
|
desc string
|
||||||
|
@ -270,7 +281,7 @@ func Test_executeTemplate(t *testing.T ) {
|
||||||
|
|
||||||
actualString := strings.TrimSpace(string(actualManifest))
|
actualString := strings.TrimSpace(string(actualManifest))
|
||||||
expectedString := strings.TrimSpace(string(expectedManifest))
|
expectedString := strings.TrimSpace(string(expectedManifest))
|
||||||
if !reflect.DeepEqual(actualString,expectedString,) {
|
if !reflect.DeepEqual(actualString, expectedString) {
|
||||||
t.Fatalf("Manifests differs: %+v instead of %+v", actualString, expectedString)
|
t.Fatalf("Manifests differs: %+v instead of %+v", actualString, expectedString)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue