mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 01:40:13 +00:00
e2e: reduce built time for framework
Pulling the CreateKubeConfig function from the expensive to build test/utils/apiserver package had a considerable impact on the overall build time because that package depends on a lot of other packages. Because only that one function is needed by the framework, that extra build time can be avoided by moving it into its own package.
This commit is contained in:
parent
d9f21e55df
commit
d33e66b81b
@ -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())
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
Loading…
Reference in New Issue
Block a user