@@ -48,6 +48,7 @@ import (
4848)
4949
5050const (
51+ clusterConfigDir = ".kit/env"
5152 kubeconfigPath = "/etc/kubernetes"
5253 kubeconfigFile = "etc/kubernetes/admin.conf"
5354 certPKIPath = "/etc/kubernetes/pki"
@@ -129,6 +130,13 @@ func (c *Config) Delete(ctx context.Context, substrate *v1alpha1.Substrate) (rec
129130 } else {
130131 logging .FromContext (ctx ).Infof ("Deleted S3 bucket %s" , aws .StringValue (discovery .Name (substrate )))
131132 }
133+ if c .clusterConfigPath == "" {
134+ home , err := os .UserHomeDir ()
135+ if err != nil {
136+ return reconcile.Result {}, fmt .Errorf ("finding HOME dir %v" , err )
137+ }
138+ c .clusterConfigPath = filepath .Join (home , clusterConfigDir )
139+ }
132140 return reconcile.Result {}, os .RemoveAll (path .Join (c .clusterConfigPath , aws .StringValue (discovery .Name (substrate ))))
133141}
134142
@@ -335,9 +343,9 @@ func (c *Config) ensureKitEnvDir() error {
335343 if err != nil {
336344 return fmt .Errorf ("finding HOME dir %v" , err )
337345 }
338- c .clusterConfigPath = filepath .Join (home , ".kit/env" )
346+ c .clusterConfigPath = filepath .Join (home , clusterConfigDir )
339347 if err := os .MkdirAll (c .clusterConfigPath , 0755 ); err != nil {
340- return fmt .Errorf ("creating .kit/env dir %v" , err )
348+ return fmt .Errorf ("creating cluster config dir %v" , err )
341349 }
342350 return nil
343351}
0 commit comments