Skip to content

Commit 5aeed08

Browse files
committed
Main: remove unused AWS credentials and functions
1 parent aa454c9 commit 5aeed08

File tree

5 files changed

+2
-66
lines changed

5 files changed

+2
-66
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ Grafana dashboard configmaps are stored in the [Dashboards](./dashboards/) direc
162162
* `CAD_OCM_CLIENT_ID`: refers to the OCM client ID used by CAD to initialize the OCM client
163163
* `CAD_OCM_CLIENT_SECRET`: refers to the OCM client secret used by CAD to initialize the OCM client
164164
* `CAD_OCM_URL`: refers to the used OCM url used by CAD to initialize the OCM client
165-
* `AWS_ACCESS_KEY_ID`: refers to the access key id of the base AWS account used by CAD
166-
* `AWS_SECRET_ACCESS_KEY`: refers to the secret access key of the base AWS account used by CAD
167-
* `CAD_AWS_CSS_JUMPROLE`: refers to the arn of the RH-SRE-CCS-Access jumprole
168-
* `CAD_AWS_SUPPORT_JUMPROLE`: refers to the arn of the RH-Technical-Support-Access jumprole
169165
* `CAD_PD_EMAIL`: refers to the email for a login via mail/pw credentials
170166
* `CAD_PD_PW`: refers to the password for a login via mail/pw credentials
171167
* `CAD_PD_TOKEN`: refers to the generated private access token for token-based authentication

deploy/aws.env.sample

Lines changed: 0 additions & 6 deletions
This file was deleted.

deploy/task-cad-checks-secrets-aws.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

openshift/template.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,6 @@ objects:
249249
subjects:
250250
- kind: ServiceAccount
251251
name: cad-sa
252-
- apiVersion: v1
253-
kind: Secret
254-
metadata:
255-
name: cad-aws-credentials
256-
stringData:
257-
AWS_ACCESS_KEY_ID: CHANGEME
258-
AWS_DEFAULT_REGION: CHANGEME
259-
AWS_SECRET_ACCESS_KEY: CHANGEME
260-
AWS_SESSION_TOKEN: CHANGEME
261-
CAD_AWS_CSS_JUMPROLE: CHANGEME
262-
CAD_AWS_SUPPORT_JUMPROLE: CHANGEME
263-
type: Opaque
264252
- apiVersion: v1
265253
kind: Secret
266254
metadata:

pkg/aws/aws.go

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ package aws
44
import (
55
"context"
66
"fmt"
7-
"os"
8-
"path"
9-
"path/filepath"
107
"reflect"
118
"regexp"
129
"strings"
@@ -29,10 +26,8 @@ import (
2926
)
3027

3128
const (
32-
accessKeyIDFilename string = "aws_access_key_id"
33-
secretAccessKeyIDFilename string = "aws_secret_access_key" /* #nosec G101 -- this is just the fileName, not a key*/
34-
maxRetries int = 3
35-
backoffUpperLimit = 5 * time.Minute
29+
maxRetries int = 3
30+
backoffUpperLimit = 5 * time.Minute
3631
)
3732

3833
var stopInstanceDateRegex = regexp.MustCompile(`\((\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*)\)`)
@@ -98,26 +93,6 @@ func NewClient(accessID, accessSecret, token, region string) (*SdkClient, error)
9893
}, nil
9994
}
10095

101-
// NewClientFromFileCredentials creates a new client by reading credentials from a file
102-
func NewClientFromFileCredentials(dir string, region string) (*SdkClient, error) {
103-
dir = strings.TrimSuffix(dir, "/")
104-
dir = filepath.Clean(dir)
105-
106-
accessKeyBytesPath := filepath.Clean(path.Join(dir, accessKeyIDFilename))
107-
accessKeyBytes, err := os.ReadFile(accessKeyBytesPath)
108-
if err != nil {
109-
return nil, fmt.Errorf("cannot read accessKeyID '%s' from path %s", accessKeyIDFilename, dir)
110-
}
111-
secretKeyBytesPath := filepath.Clean(path.Join(dir, secretAccessKeyIDFilename))
112-
secretKeyBytes, err := os.ReadFile(secretKeyBytesPath)
113-
if err != nil {
114-
return nil, fmt.Errorf("cannot read secretKeyID '%s' from path %s", secretAccessKeyIDFilename, dir)
115-
}
116-
accessKeyID := strings.TrimRight(string(accessKeyBytes), "\n")
117-
secretKeyID := strings.TrimRight(string(secretKeyBytes), "\n")
118-
return NewClient(accessKeyID, secretKeyID, "", region)
119-
}
120-
12196
// GetAWSCredentials gets the AWS credentials
12297
func (c *SdkClient) GetAWSCredentials() awsv2.Credentials {
12398
return c.Credentials

0 commit comments

Comments
 (0)