@@ -21,7 +21,6 @@ import (
21
21
"context"
22
22
"encoding/base64"
23
23
"fmt"
24
- "io/ioutil"
25
24
"os"
26
25
"os/exec"
27
26
"path/filepath"
@@ -65,7 +64,7 @@ func NewDecryptor(kubeClient client.Client,
65
64
66
65
func NewTempDecryptor (kubeClient client.Client ,
67
66
kustomization kustomizev1.Kustomization ) (* KustomizeDecryptor , func (), error ) {
68
- tmpDir , err := ioutil . TempDir ("" , fmt .Sprintf ("decryptor-%s-" , kustomization .Name ))
67
+ tmpDir , err := os . MkdirTemp ("" , fmt .Sprintf ("decryptor-%s-" , kustomization .Name ))
69
68
if err != nil {
70
69
return nil , nil , fmt .Errorf ("tmp dir error: %w" , err )
71
70
}
@@ -140,7 +139,7 @@ func (kd *KustomizeDecryptor) ImportKeys(ctx context.Context) error {
140
139
return fmt .Errorf ("decryption secret error: %w" , err )
141
140
}
142
141
143
- tmpDir , err := ioutil . TempDir ("" , kd .kustomization .Name )
142
+ tmpDir , err := os . MkdirTemp ("" , kd .kustomization .Name )
144
143
if err != nil {
145
144
return fmt .Errorf ("tmp dir error: %w" , err )
146
145
}
@@ -154,7 +153,7 @@ func (kd *KustomizeDecryptor) ImportKeys(ctx context.Context) error {
154
153
if err != nil {
155
154
return err
156
155
}
157
- if err := ioutil .WriteFile (keyPath , file , os .ModePerm ); err != nil {
156
+ if err := os .WriteFile (keyPath , file , os .ModePerm ); err != nil {
158
157
return fmt .Errorf ("unable to write key to storage: %w" , err )
159
158
}
160
159
if err := kd .gpgImport (keyPath ); err != nil {
@@ -185,7 +184,7 @@ func (kd *KustomizeDecryptor) gpgImport(path string) error {
185
184
186
185
func (kd * KustomizeDecryptor ) decryptDotEnvFiles (dirpath string ) error {
187
186
kustomizePath := filepath .Join (dirpath , konfig .DefaultKustomizationFileName ())
188
- ksData , err := ioutil .ReadFile (kustomizePath )
187
+ ksData , err := os .ReadFile (kustomizePath )
189
188
if err != nil {
190
189
return nil
191
190
}
@@ -224,7 +223,7 @@ func (kd *KustomizeDecryptor) decryptDotEnvFiles(dirpath string) error {
224
223
}
225
224
226
225
envPath := filepath .Join (dirpath , envFile )
227
- data , err := ioutil .ReadFile (envPath )
226
+ data , err := os .ReadFile (envPath )
228
227
if err != nil {
229
228
return err
230
229
}
@@ -235,7 +234,7 @@ func (kd *KustomizeDecryptor) decryptDotEnvFiles(dirpath string) error {
235
234
return err
236
235
}
237
236
238
- err = ioutil .WriteFile (envPath , out , 0644 )
237
+ err = os .WriteFile (envPath , out , 0644 )
239
238
if err != nil {
240
239
return fmt .Errorf ("error writing to file: %w" , err )
241
240
}
0 commit comments