Skip to content

Commit 76e1b87

Browse files
authored
OADP-6019: Add emptyDir volume for tmp files created by CCO flow for AWS STS. (#1731)
Add a new emptyDir volume named tmp-dir to the controller pod specification Add a volume mount to the container that mounts this volume to /tmp Keep readOnlyRootFilesystem: true for security Replaced the deprecated ioutil.TempFile() function with the recommended os.CreateTemp() function Removed the unnecessary io/ioutil import since it's no longer needed Signed-off-by: Tiger Kaovilai <[email protected]>
1 parent a21288a commit 76e1b87

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

bundle/manifests/oadp-operator.clusterserviceversion.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,8 @@ spec:
11641164
- mountPath: /var/run/secrets/openshift/serviceaccount
11651165
name: bound-sa-token
11661166
readOnly: true
1167+
- mountPath: /tmp
1168+
name: tmp-dir
11671169
securityContext:
11681170
runAsNonRoot: true
11691171
serviceAccountName: openshift-adp-controller-manager
@@ -1176,6 +1178,8 @@ spec:
11761178
audience: openshift
11771179
expirationSeconds: 3600
11781180
path: token
1181+
- emptyDir: {}
1182+
name: tmp-dir
11791183
permissions:
11801184
- rules:
11811185
- apiGroups:

config/manager/manager.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ spec:
5151
- mountPath: /var/run/secrets/openshift/serviceaccount
5252
name: bound-sa-token
5353
readOnly: true
54+
- mountPath: /tmp
55+
name: tmp-dir
5456
env:
5557
- name: WATCH_NAMESPACE
5658
valueFrom:
@@ -126,4 +128,6 @@ spec:
126128
path: token
127129
expirationSeconds: 3600
128130
audience: openshift
131+
- name: tmp-dir
132+
emptyDir: {}
129133
terminationGracePeriodSeconds: 10

pkg/bucket/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"path/filepath"
109

@@ -91,7 +90,7 @@ func SharedCredentialsFileFromSecret(secret *corev1.Secret) (string, error) {
9190
return "", errors.New("invalid secret for aws credentials")
9291
}
9392

94-
f, err := ioutil.TempFile("", "aws-shared-credentials")
93+
f, err := os.CreateTemp("", "aws-shared-credentials")
9594
if err != nil {
9695
return "", err
9796
}

0 commit comments

Comments
 (0)