Merge pull request #112375 from pohly/e2e-build-time

e2e: reduce built time for framework
This commit is contained in:
Kubernetes Prow Robot 2022-09-10 10:05:22 -07:00 committed by GitHub
commit 4411a16a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -39,7 +39,7 @@ import (
"k8s.io/klog/v2"
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
testapiserver "k8s.io/kubernetes/test/utils/apiserver"
"k8s.io/kubernetes/test/utils/kubeconfig"
)
const (
@ -460,7 +460,7 @@ func AfterReadingAllFlags(t *TestContextType) {
// Check if we can use the in-cluster config
if clusterConfig, err := restclient.InClusterConfig(); err == nil {
if tempFile, err := os.CreateTemp(os.TempDir(), "kubeconfig-"); err == nil {
kubeConfig := testapiserver.CreateKubeConfig(clusterConfig)
kubeConfig := kubeconfig.CreateKubeConfig(clusterConfig)
clientcmd.WriteToFile(*kubeConfig, tempFile.Name())
t.KubeConfig = tempFile.Name()
klog.V(4).Infof("Using a temporary kubeconfig file from in-cluster config : %s", tempFile.Name())

View File

@ -29,6 +29,7 @@ import (
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/cert"
kubeapiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
"k8s.io/kubernetes/test/utils/kubeconfig"
)
// TestAPIServer provides access to a running apiserver instance.
@ -90,7 +91,7 @@ func writeKubeConfigForWardleServerToKASConnection(t *testing.T, kubeClientConfi
t.Logf("CA bundle %v\n", dynamiccertificates.GetHumanCertDetail(curr))
}
adminKubeConfig := CreateKubeConfig(wardleToKASKubeClientConfig)
adminKubeConfig := kubeconfig.CreateKubeConfig(wardleToKASKubeClientConfig)
tmpDir := t.TempDir()
kubeConfigFile := path.Join(tmpDir, "kube.config")
if err := clientcmd.WriteToFile(*adminKubeConfig, kubeConfigFile); err != nil {

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package apiserver
package kubeconfig
import (
"k8s.io/client-go/rest"