Skip to content

Commit d6f9400

Browse files
[historyserver] Migrate S3 credentials to standard AWS environment variables (#4665)
* [historyserver] Migrate S3 credentials to standard AWS environment variables Replace non-standard env vars with the standard AWS SDK ones: - AWS_S3ID -> AWS_ACCESS_KEY_ID - AWS_S3SECRET -> AWS_SECRET_ACCESS_KEY - AWS_S3TOKEN -> AWS_SESSION_TOKEN Fixes #4664 Signed-off-by: Ashutosh Agarwal <ashutosh18011@gmail.com> * Update historyserver/pkg/storage/s3/config.go Signed-off-by: Han-Ju Chen (Future-Outlier) <eric901201@gmail.com> --------- Signed-off-by: Ashutosh Agarwal <ashutosh18011@gmail.com> Signed-off-by: Han-Ju Chen (Future-Outlier) <eric901201@gmail.com> Co-authored-by: Han-Ju Chen (Future-Outlier) <eric901201@gmail.com>
1 parent fb47c06 commit d6f9400

5 files changed

Lines changed: 27 additions & 27 deletions

File tree

historyserver/config/historyserver.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ spec:
3636
env:
3737
- name: S3DISABLE_SSL
3838
value: "true"
39-
- name: AWS_S3ID
39+
- name: AWS_ACCESS_KEY_ID
4040
value: minioadmin
41-
- name: AWS_S3SECRET
41+
- name: AWS_SECRET_ACCESS_KEY
4242
value: minioadmin
43-
- name: AWS_S3TOKEN
43+
- name: AWS_SESSION_TOKEN
4444
value: ""
4545
- name: S3_BUCKET
4646
value: "ray-historyserver"

historyserver/config/raycluster.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ spec:
100100
value: "30s"
101101
- name: S3DISABLE_SSL
102102
value: "true"
103-
- name: AWS_S3ID
103+
- name: AWS_ACCESS_KEY_ID
104104
value: minioadmin
105-
- name: AWS_S3SECRET
105+
- name: AWS_SECRET_ACCESS_KEY
106106
value: minioadmin
107-
- name: AWS_S3TOKEN
107+
- name: AWS_SESSION_TOKEN
108108
value: ""
109109
- name: S3_BUCKET
110110
value: "ray-historyserver"
@@ -203,11 +203,11 @@ spec:
203203
image: collector:v0.1.0
204204
imagePullPolicy: IfNotPresent
205205
env:
206-
- name: AWS_S3ID
206+
- name: AWS_ACCESS_KEY_ID
207207
value: minioadmin
208-
- name: AWS_S3SECRET
208+
- name: AWS_SECRET_ACCESS_KEY
209209
value: minioadmin
210-
- name: AWS_S3TOKEN
210+
- name: AWS_SESSION_TOKEN
211211
value: ""
212212
- name: S3_BUCKET
213213
value: "ray-historyserver"

historyserver/docs/set_up_historyserver.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ debugging in your own IDE. For example, you can set up `.vscode/launch.json` as
107107
// Use localhost rather than the Kubernetes service name.
108108
"S3_ENDPOINT": "localhost:9000",
109109
"S3_BUCKET": "ray-historyserver",
110-
"AWS_S3ID": "minioadmin",
111-
"AWS_S3SECRET": "minioadmin",
112-
"AWS_S3TOKEN": "",
110+
"AWS_ACCESS_KEY_ID": "minioadmin",
111+
"AWS_SECRET_ACCESS_KEY": "minioadmin",
112+
"AWS_SESSION_TOKEN": "",
113113
"S3FORCE_PATH_STYLE": "true",
114114
"S3DISABLE_SSL": "true"
115115
}
@@ -132,9 +132,9 @@ make buildhistoryserver
132132
export S3_REGION=test
133133
export S3_ENDPOINT=localhost:9000
134134
export S3_BUCKET=ray-historyserver
135-
export AWS_S3ID=minioadmin
136-
export AWS_S3SECRET=minioadmin
137-
export AWS_S3TOKEN=
135+
export AWS_ACCESS_KEY_ID=minioadmin
136+
export AWS_SECRET_ACCESS_KEY=minioadmin
137+
export AWS_SESSION_TOKEN=
138138
export S3FORCE_PATH_STYLE=true
139139
export S3DISABLE_SSL=true
140140

historyserver/pkg/storage/s3/config.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ type config struct {
1616
S3Endpoint string
1717
S3Bucket string
1818
S3Region string
19-
S3ID string
20-
S3Secret string
21-
S3Token string
19+
AccessKeyID string
20+
SecretAccessKey string
21+
SessionToken string
2222
types.RayCollectorConfig
2323
}
2424

@@ -32,9 +32,9 @@ func getS3BucketWithDefault() string {
3232

3333
func (c *config) complete(rcc *types.RayCollectorConfig, jd map[string]interface{}) {
3434
c.RayCollectorConfig = *rcc
35-
c.S3ID = os.Getenv("AWS_S3ID")
36-
c.S3Secret = os.Getenv("AWS_S3SECRET")
37-
c.S3Token = os.Getenv("AWS_S3TOKEN")
35+
c.AccessKeyID = os.Getenv("AWS_ACCESS_KEY_ID")
36+
c.SecretAccessKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
37+
c.SessionToken = os.Getenv("AWS_SESSION_TOKEN")
3838
c.S3Bucket = getS3BucketWithDefault()
3939
if len(jd) == 0 {
4040
c.S3Endpoint = os.Getenv("S3_ENDPOINT")
@@ -68,10 +68,10 @@ func (c *config) completeHSConfig(rcc *types.RayHistoryServerConfig, jd map[stri
6868
c.RayCollectorConfig = types.RayCollectorConfig{
6969
RootDir: rcc.RootDir,
7070
}
71-
c.S3ID = os.Getenv("AWS_S3ID")
72-
c.S3Secret = os.Getenv("AWS_S3SECRET")
73-
c.S3Token = os.Getenv("AWS_S3TOKEN")
74-
c.S3Bucket = getS3BucketWithDefault() // Use default if S3_BUCKET not set
71+
c.AccessKeyID = os.Getenv("AWS_ACCESS_KEY_ID")
72+
c.SecretAccessKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
73+
c.SessionToken = os.Getenv("AWS_SESSION_TOKEN")
74+
c.S3Bucket = getS3BucketWithDefault()
7575
if len(jd) == 0 {
7676
c.S3Endpoint = os.Getenv("S3_ENDPOINT")
7777
c.S3Region = os.Getenv("S3_REGION")

historyserver/pkg/storage/s3/s3.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ func New(c *config) (*RayLogsHandler, error) {
342342
// Only use static credentials when explicitly provided; otherwise let the
343343
// SDK fall back to the default credential chain (IRSA, instance role, etc.).
344344
var creds *credentials.Credentials
345-
if c.S3ID != "" {
346-
creds = credentials.NewStaticCredentials(c.S3ID, c.S3Secret, c.S3Token)
345+
if c.AccessKeyID != "" {
346+
creds = credentials.NewStaticCredentials(c.AccessKeyID, c.SecretAccessKey, c.SessionToken)
347347
}
348348

349349
// Create AWS session

0 commit comments

Comments
 (0)