Skip to content

Commit

Permalink
Enable IPFS API Key authentication (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
stan153 authored Jul 22, 2021
1 parent 7882dab commit 7fb8aef
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ The following resources need attention:
| `IPFS_OUTPUT`, `IPFS_ADMINLOGS` | IPFS gateway to upload the output data (algorithm logs & algorithm output) and admin logs (logs from pod-configure & pod-publish)|
| `IPFS_OUTPUT_PREFIX`, `IPFS_ADMINLOGS_PREFIX` | Prefix used for the results files (see below) |
| `IPFS_EXPIRY_TIME` | Default expiry time for ipfs (see https://github.com/ipfs/ipfs-cluster/blob/dbca14e83295158558234e867477ce07a523b81b/CHANGELOG.md#rest-api-2_), with an expected value in Go's time format, i.e. 12h (optional)
| `IPFS_API_KEY`, `IPFS_API_CLIENT ` | IPFS API Key and Client ID for authentication purpose (optional) |
| `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION` | S3 credentials for the logs and output buckets. |
| `AWS_BUCKET_OUTPUT` | Bucket that will hold the output data (algorithm logs & algorithm output). |
| `AWS_BUCKET_ADMINLOGS` | Bucket that will hold the admin logs (logs from pod-configure & pod-publish). |
Expand Down
4 changes: 4 additions & 0 deletions kubernetes/operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ spec:
value: http://youradminipfsserver:5001/ipfs/
- name: IPFS_EXPIRY_TIME
value: "3600"
- name: IPFS_API_KEY
value: "apikey"
- name: IPFS_API_CLIENT
value: "clientid"
- name: STORAGE_CLASS
value: standard
- name: LOG_LEVEL
Expand Down
2 changes: 2 additions & 0 deletions operator_engine/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class OperatorConfig:
IPFS_OUTPUT_PREFIX = getenv('IPFS_OUTPUT_PREFIX',None)
IPFS_ADMINLOGS_PREFIX = getenv('IPFS_ADMINLOGS_PREFIX',None)
IPFS_EXPIRY_TIME = getenv('IPFS_EXPIRY_TIME', None)
IPFS_API_KEY = getenv('IPFS_API_KEY', None)
IPFS_API_CLIENT = getenv('IPFS_API_CLIENT', None)
DEBUG_NO_CLEANUP = getenv('DEBUG_NO_CLEANUP',None)
NOTIFY_START_URL = getenv('NOTIFY_START_URL',None)
NOTIFY_STOP_URL = getenv('NOTIFY_STOP_URL',None)
Expand Down
4 changes: 4 additions & 0 deletions operator_engine/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ def create_publish_job(body, logger):
job['spec']['template']['spec']['containers'][0]['env'].append({'name': 'IPFS_ADMINLOGS_PREFIX','value': OperatorConfig.IPFS_ADMINLOGS_PREFIX})
if OperatorConfig.IPFS_EXPIRY_TIME is not None:
job['spec']['template']['spec']['containers'][0]['env'].append({'name': 'IPFS_EXPIRY_TIME','value': OperatorConfig.IPFS_EXPIRY_TIME})
if OperatorConfig.IPFS_API_KEY is not None:
job['spec']['template']['spec']['containers'][0]['env'].append({'name': 'IPFS_API_KEY','value': OperatorConfig.IPFS_API_KEY})
if OperatorConfig.IPFS_API_CLIENT is not None:
job['spec']['template']['spec']['containers'][0]['env'].append({'name': 'IPFS_API_CLIENT','value': OperatorConfig.IPFS_API_CLIENT})
job['spec']['template']['spec']['containers'][0]['env'].append({'name': 'WORKFLOWID',
'value': body['metadata']['name']})
# Volumes
Expand Down

0 comments on commit 7fb8aef

Please sign in to comment.