@@ -21,7 +21,6 @@ import (
2121 "errors"
2222 "fmt"
2323 "io"
24- "io/ioutil"
2524 "net/url"
2625 "os"
2726
@@ -105,7 +104,7 @@ func (r *HelmChartReconciler) reconcileFromHelmRepository(ctx context.Context, o
105104 }
106105
107106 // Get client options from secret
108- tmpDir , err := ioutil . TempDir ("" , "helm-client-" )
107+ tmpDir , err := os . MkdirTemp ("" , "helm-client-" )
109108 if err != nil {
110109 conditions .MarkFalse (obj , sourcev1 .SourceAvailableCondition , sourcev1 .AuthenticationFailedReason , "Could not create temporary directory for : %s" , err .Error ())
111110 return ctrl.Result {}, err
@@ -151,7 +150,7 @@ func (r *HelmChartReconciler) reconcileFromHelmRepository(ctx context.Context, o
151150 }
152151
153152 // Create a new temporary file for the chart and download it
154- f , err := ioutil . TempFile ("" , fmt .Sprintf ("%s-%s-" , obj .Name , obj .Namespace ))
153+ f , err := os . CreateTemp ("" , fmt .Sprintf ("%s-%s-" , obj .Name , obj .Namespace ))
155154 if err != nil {
156155 conditions .MarkFalse (obj , sourcev1 .SourceAvailableCondition , sourcev1 .ChartPullFailedReason , "Chart download for %q version %q failed: %s" , obj .Spec .Chart , chartVer .Version , err .Error ())
157156 return ctrl.Result {}, err
@@ -182,7 +181,7 @@ func (r *HelmChartReconciler) reconcileFromTarballArtifact(ctx context.Context,
182181 return ctrl.Result {}, err
183182 }
184183
185- dir , err := ioutil . TempDir ("" , fmt .Sprintf ("%s-%s-" , obj .Name , obj .Namespace ))
184+ dir , err := os . MkdirTemp ("" , fmt .Sprintf ("%s-%s-" , obj .Name , obj .Namespace ))
186185 if err != nil {
187186 conditions .MarkFalse (obj , sourcev1 .SourceAvailableCondition , sourcev1 .StorageOperationFailedReason , "Could not create temporary working directory: %s" , err .Error ())
188187 return ctrl.Result {}, err
0 commit comments