Skip to content

Commit 085a435

Browse files
authored
Add Operator AWS credentials (#349)
1 parent 20da0fe commit 085a435

File tree

6 files changed

+49
-13
lines changed

6 files changed

+49
-13
lines changed

cortex.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ if [ "$AWS_SECRET_ACCESS_KEY" = "" ]; then
115115
fi
116116
fi
117117

118+
export CORTEX_AWS_ACCESS_KEY_ID="${CORTEX_AWS_ACCESS_KEY_ID:-$AWS_ACCESS_KEY_ID}"
119+
export CORTEX_AWS_SECRET_ACCESS_KEY="${CORTEX_AWS_SECRET_ACCESS_KEY:-$AWS_SECRET_ACCESS_KEY}"
120+
118121
export CORTEX_LOG_GROUP="${CORTEX_LOG_GROUP:-cortex}"
119122
export CORTEX_BUCKET="${CORTEX_BUCKET:-""}"
120123
export CORTEX_REGION="${CORTEX_REGION:-us-west-2}"
@@ -183,6 +186,8 @@ function install_cortex() {
183186
docker run -it --entrypoint /root/install_cortex.sh \
184187
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
185188
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
189+
-e CORTEX_AWS_ACCESS_KEY_ID=$CORTEX_AWS_ACCESS_KEY_ID \
190+
-e CORTEX_AWS_SECRET_ACCESS_KEY=$CORTEX_AWS_SECRET_ACCESS_KEY \
186191
-e CORTEX_CLUSTER=$CORTEX_CLUSTER \
187192
-e CORTEX_REGION=$CORTEX_REGION \
188193
-e CORTEX_NAMESPACE=$CORTEX_NAMESPACE \
@@ -394,7 +399,7 @@ function confirm_for_uninstall() {
394399
while true
395400
do
396401
echo
397-
read -p "Are you sure you want to uninstall Cortex? Your cluster will be spun down and all resources will be deleted. [Y/n] " -n 1 -r
402+
read -p "Are you sure you want to uninstall Cortex? (Your cluster will be spun down and all resources will be deleted) [Y/n] " -n 1 -r
398403
echo
399404
if [[ $REPLY =~ ^[Yy]$ ]]; then
400405
break

docs/cluster/config.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ These environment variables can be modified and exported before running `cortex.
1111
export AWS_ACCESS_KEY_ID="***"
1212
export AWS_SECRET_ACCESS_KEY="***"
1313

14+
# Optional AWS credentials for the Operator which may be used to restrict its AWS access (defaults to the AWS credentials set above)
15+
export CORTEX_AWS_ACCESS_KEY_ID="***"
16+
export CORTEX_AWS_SECRET_ACCESS_KEY="***"
17+
1418
# The name of the CloudWatch log group Cortex will use
1519
export CORTEX_LOG_GROUP="cortex"
1620

docs/cluster/security.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,36 @@ If you are not using a sensitive AWS account and do not have a lot of experience
66

77
### Operator
88

9-
The operator requires read permissions for any data sources, read and write permissions for the Cortex S3 bucket, and read and write permissions for the Cortex CloudWatch log group. The pre-defined `AmazonS3FullAccess` and `CloudWatchLogsFullAccess` policies cover these permissions, but you can create more limited policies manually.
10-
11-
If you don't already have a Cortex S3 bucket and/or Cortex CloudWatch log group, you will need to add create permissions during installation.
9+
The operator requires read permissions for any S3 bucket containing exported models, read and write permissions for the Cortex S3 bucket, read and write permissions for the Cortex CloudWatch log group, and read and write permissions for CloudWatch metrics. The policy below may be used to restrict the Operator's access:
10+
11+
```json
12+
{
13+
"Version": "2012-10-17",
14+
"Statement": [
15+
{
16+
"Sid": "VisualEditor0",
17+
"Effect": "Allow",
18+
"Action": [
19+
"sts:GetCallerIdentity"
20+
],
21+
"Resource": "*"
22+
},
23+
{
24+
"Effect": "Allow",
25+
"Action": "s3:*",
26+
"Resource": "*"
27+
},
28+
{
29+
"Action": [
30+
"cloudwatch:*",
31+
"logs:*"
32+
],
33+
"Effect": "Allow",
34+
"Resource": "*"
35+
}
36+
]
37+
}
38+
```
1239

1340
### CLI
1441

docs/cluster/upgrade.md renamed to docs/cluster/update.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Upgrade
1+
# Update
22

33
## Prerequisites
44

@@ -22,10 +22,10 @@ chmod +x cortex.sh
2222
export AWS_ACCESS_KEY_ID=***
2323
export AWS_SECRET_ACCESS_KEY=***
2424

25-
# Upgrade Cortex
26-
./cortex.sh upgrade
25+
# Update Cortex
26+
./cortex.sh update
2727

28-
# Upgrade the CLI
28+
# Update the CLI
2929
./cortex.sh install cli
3030

3131
# Confirm version

docs/summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* [AWS Credentials](cluster/aws.md)
2323
* [Configuration](cluster/config.md)
2424
* [Security](cluster/security.md)
25-
* [Upgrade](cluster/upgrade.md)
25+
* [Update](cluster/update.md)
2626
* [Uninstall](cluster/uninstall.md)
2727
* [Development](cluster/development.md)
2828

manager/install_cortex.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ function setup_configmap() {
7575

7676
function setup_secrets() {
7777
kubectl -n=$CORTEX_NAMESPACE create secret generic 'aws-credentials' \
78-
--from-literal='AWS_ACCESS_KEY_ID'=$AWS_ACCESS_KEY_ID \
79-
--from-literal='AWS_SECRET_ACCESS_KEY'=$AWS_SECRET_ACCESS_KEY \
78+
--from-literal='AWS_ACCESS_KEY_ID'=$CORTEX_AWS_ACCESS_KEY_ID \
79+
--from-literal='AWS_SECRET_ACCESS_KEY'=$CORTEX_AWS_SECRET_ACCESS_KEY \
8080
-o yaml --dry-run | kubectl apply -f - >/dev/null
8181
}
8282

@@ -104,8 +104,8 @@ function setup_istio() {
104104
envsubst < manifests/istio-metrics.yaml | kubectl apply -f - >/dev/null
105105

106106
kubectl -n=istio-system create secret generic 'aws-credentials' \
107-
--from-literal='AWS_ACCESS_KEY_ID'=$AWS_ACCESS_KEY_ID \
108-
--from-literal='AWS_SECRET_ACCESS_KEY'=$AWS_SECRET_ACCESS_KEY \
107+
--from-literal='AWS_ACCESS_KEY_ID'=$CORTEX_AWS_ACCESS_KEY_ID \
108+
--from-literal='AWS_SECRET_ACCESS_KEY'=$CORTEX_AWS_SECRET_ACCESS_KEY \
109109
-o yaml --dry-run | kubectl apply -f - >/dev/null
110110
istio_patch="[
111111
{\"op\": \"add\", \"path\": \"/spec/template/spec/containers/0/env/-\", \"value\": {\"name\": \"AWS_ACCESS_KEY_ID\", \"valueFrom\": {\"secretKeyRef\": {\"name\": \"aws-credentials\", \"key\": \"AWS_ACCESS_KEY_ID\"}}}},\

0 commit comments

Comments
 (0)