<commit_before># AWS ECR Credentials
Allow for AWS ECR credentials to be refreshed inside your Kubernetes cluster via ImagePullSecrets

## How it works

1. The tool runs as a container in the `kube-system` namespace.
- It gets credentials from AWS ECR via the aws-go sdk
- Next it creates a secret named `awsecr-creds` (by default)
- Then it sets up this secret to be used in the `ImagePullSecrets` for the default service account
- Whenever a pod is created, this secret is attached to the pod
- The container will refresh the credentials by default every 11 hours 55 minutes since they expire at 12 hours

## How to setup

1. Clone the repo and navigate to directory

2. Edit the sample [replication controller](k8s/replicationController.yml) and update with your AWS account id

3. Create the replication controller

  ```bash
  kubectl create -f k8s/replicationController.yml
  ```

4. Make sure your EC2 instances have the following IAM permissions:

  ```json
  {
   "Effect": "Allow",
    "Action": [
     "ecr:GetAuthorizationToken",
     "ecr:BatchCheckLayerAvailability",
     "ecr:GetDownloadUrlForLayer",
     "ecr:GetRepositoryPolicy",
     "ecr:DescribeRepositories",
     "ecr:ListImages",
     "ecr:BatchGetImage"
   ],
   "Resource": "*"
  }
  ```

## DockerHub Image

- https://hub.docker.com/r/upmcenterprises/awsecr-creds/

## About

Built by UPMC Enterprises in Pittsburgh, PA. http://enterprises.upmc.com/<commit_msg>Updated readme to demonstrate how to pass AWS creds if not running on EC2 inside AWS<commit_after># AWS ECR Credentials
Allow for AWS ECR credentials to be refreshed inside your Kubernetes cluster via ImagePullSecrets

## How it works

1. The tool runs as a container in the `kube-system` namespace.
- It gets credentials from AWS ECR via the aws-go sdk
- Next it creates a secret named `awsecr-creds` (by default)
- Then it sets up this secret to be used in the `ImagePullSecrets` for the default service account
- Whenever a pod is created, this secret is attached to the pod
- The container will refresh the credentials by default every 11 hours 55 minutes since they expire at 12 hours

## How to setup running in AWS

1. Clone the repo and navigate to directory

2. Edit the sample [replication controller](k8s/replicationController.yml) and update with your AWS account id

3. Create the replication controller

  ```bash
  kubectl create -f k8s/replicationController.yml
  ```

4. Make sure your EC2 instances have the following IAM permissions:

  ```json
  {
   "Effect": "Allow",
    "Action": [
     "ecr:GetAuthorizationToken",
     "ecr:BatchCheckLayerAvailability",
     "ecr:GetDownloadUrlForLayer",
     "ecr:GetRepositoryPolicy",
     "ecr:DescribeRepositories",
     "ecr:ListImages",
     "ecr:BatchGetImage"
   ],
   "Resource": "*"
  }
  ```

### Note:
If you are not running in AWS Cloud, then you can still use this tool! Simply add the following environment variables to your replication controller:
```
AWS_ACCESS_KEY_ID=AKID1234567890
AWS_SECRET_ACCESS_KEY=MY-SECRET-KEY
```

## DockerHub Image

- https://hub.docker.com/r/upmcenterprises/awsecr-creds/

## About

Built by UPMC Enterprises in Pittsburgh, PA. http://enterprises.upmc.com/
{'fraction_non_alphanumeric': 0.08213616489693941, 'fraction_numerical': 0.012179887570268583, 'mean_word_length': 3.996879875195008, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4498573', 'n_tokens_mistral': 986, 'n_tokens_neox': 939, 'n_words': 381}