Skip to content

Commit 4c62604

Browse files
authored
Merge pull request #76 from pkit/implicit_creds
fix hardcoded s3 creds
2 parents d23befd + 9b16a39 commit 4c62604

File tree

5 files changed

+51
-9
lines changed

5 files changed

+51
-9
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/core-dump-handler/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,41 @@ You can make use of a more compact values.yaml during installation to override f
102102
helm install core-dump-handler . --create-namespace --namespace observe --values values.openshift.yaml
103103
```
104104

105+
### EKS setup for gitops pipelines (`eksctl` or similar)
106+
107+
Set up a service account with a role that has access to S3 bucket (in `cluster.yaml`):
108+
109+
```yaml
110+
iam:
111+
withOIDC: true
112+
serviceAccounts:
113+
- metadata:
114+
name: core-dump-admin
115+
namespace: core-dump
116+
attachPolicyARNs:
117+
- arn:aws:iam::123456789011:policy/s3-write-policy
118+
```
119+
120+
**Note**: here the namespace is `core-dump`, change it to the namespace where you installed the chart
121+
122+
Example S3 policy:
123+
124+
```json
125+
{
126+
"Version": "2012-10-17",
127+
"Statement": [
128+
{
129+
"Effect": "Allow",
130+
"Action": "s3:*",
131+
"Resource": [
132+
"arn:aws:s3:::my-core-dump-bucket",
133+
"arn:aws:s3:::my-core-dump-bucket/*"
134+
]
135+
}
136+
]
137+
}
138+
```
139+
105140
### Environment Variables
106141

107142
The agent pod has the following environment variables and these are all set by the chart but included here for informational purposes:

charts/core-dump-handler/templates/daemonset.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ spec:
5757
secretKeyRef:
5858
name: s3config
5959
key: s3AccessKey
60+
optional: true
6061
- name: S3_SECRET
6162
valueFrom:
6263
secretKeyRef:
6364
name: s3config
6465
key: s3Secret
66+
optional: true
6567
- name: S3_BUCKET_NAME
6668
valueFrom:
6769
secretKeyRef:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# AWS requires a crio client to be copied to the server
22
daemonset:
33
includeCrioExe: true
4+
vendor: rhel7 # EKS EC2 images have an old libc=2.26

core-dump-agent/src/main.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,21 @@ fn get_bucket() -> Result<Bucket, anyhow::Error> {
359359
}
360360
};
361361

362+
let credentials = if s3_access_key.is_empty() || s3_secret.is_empty() {
363+
Credentials::new(None, None, None, None, None)
364+
} else {
365+
Credentials::new(Some(s3_access_key.as_str()),
366+
Some(s3_secret.as_str()),
367+
None,
368+
None,
369+
None,
370+
)
371+
};
372+
362373
let s3 = Storage {
363374
name: "aws".into(),
364375
region,
365-
credentials: Credentials::new(
366-
Some(s3_access_key.as_str()),
367-
Some(s3_secret.as_str()),
368-
None,
369-
None,
370-
None,
371-
)
372-
.unwrap(),
376+
credentials: credentials.unwrap(),
373377
bucket: s3_bucket_name,
374378
location_supported: false,
375379
};

0 commit comments

Comments
 (0)