Skip to content

Commit 997c2ee

Browse files
committed
clusterapi: move envtest.kubeconfig to hidden dir
Prior to this commit, envtest.kubeconfig was placed in the auth dir which contains the cluster kubeconfigs. Leaving the envtest.kubeconfig in this dir may confuse users. Instead, let's hide the kubeconfig in the capi artifacts directory.
1 parent d1e03dc commit 997c2ee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/clusterapi/localcontrolplane.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,15 @@ func (c *localControlPlane) Run(ctx context.Context) error {
107107
return err
108108
}
109109

110+
artifactsDirPath := filepath.Join(command.RootOpts.Dir, ArtifactsDir)
111+
err = os.MkdirAll(artifactsDirPath, 0750)
112+
if err != nil {
113+
return fmt.Errorf("error creating cluster-api artifacts directory: %w", err)
114+
}
115+
110116
kc := fromEnvTestConfig(c.Cfg)
111117
{
112-
dir := filepath.Join(command.RootOpts.Dir, "auth")
113-
kf, err := os.Create(filepath.Join(dir, "envtest.kubeconfig"))
118+
kf, err := os.Create(filepath.Join(artifactsDirPath, "envtest.kubeconfig"))
114119
if err != nil {
115120
return err
116121
}

0 commit comments

Comments
 (0)