Skip to content

Commit

Permalink
Merge pull request #34 from aaron-prindle/fix-gcr
Browse files Browse the repository at this point in the history
Fixing issues with GCR
  • Loading branch information
stevesloka authored Feb 24, 2017
2 parents 265fa8b + 5e06d5b commit d65a628
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 31 deletions.
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,15 @@ kubectl create -f k8s/secret.yaml

1. Clone the repo and navigate to directory

2. Input your application_default_credentials.json information into a secret with the template at k8s/gcr-secret.yaml:
```bash
apiVersion: v1
data:
application_default_credentials.json: <base-64 encoded ~/.config/gcloud/application_default_credentials.json>
kind: Secret
metadata:
name: gcr-secret
namespace: kube-system
labels:
app: gcr-creds
version: v1.2
kubernetes.io/minikube-addons: gcr-creds
type: Opaque
```
2. Input your application_default_credentials.json information into the secret.yaml template located [here](k8s/secret.yaml#L17):
The value for application_default_credentials.json can be obtained with the following command:
```bash
base64 -w $HOME/.config/gcloud/application_default_credentials.json
```

3. Create the secret in kubernetes
```bash
kubectl create -f k8s/gcr-secret.yaml
kubectl create -f k8s/secret.yml
```

3. Create the replication controller:
Expand Down
12 changes: 0 additions & 12 deletions k8s/gcr-secret.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions k8s/replicationController.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ spec:
secretKeyRef:
name: registry-creds
key: aws-region
volumeMounts:
- name: gcr-creds
mountPath: "/root/.config/gcloud"
readOnly: true
volumes:
- name: gcr-creds
secret:
secretName: gcr-secret
13 changes: 12 additions & 1 deletion k8s/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

apiVersion: v1
data:
AWS_ACCESS_KEY_ID: Y2hhbmdlbWU=
Expand All @@ -13,3 +12,15 @@ metadata:
version: v1.2
kubernetes.io/minikube-addons: registry-creds
type: Opaque

data:
application_default_credentials.json: Y2hhbmdlbWU=
kind: Secret
metadata:
name: gcr-secret
namespace: kube-system
labels:
app: gcr-creds
version: v1.2
kubernetes.io/minikube-addons: gcr-creds
type: Opaque
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func validateParams() providerConfig {
var ecrEnabled bool

awsAccountID = os.Getenv("awsaccount")
if len(awsAccountID) == 0 {
if len(awsAccountID) == 0 || awsAccountID == "changeme" {
log.Print("Missing awsaccount env variable, assuming GCR usage")
gcrEnabled = true
ecrEnabled = false
Expand Down Expand Up @@ -326,5 +326,4 @@ func main() {
}
}
}

}

0 comments on commit d65a628

Please sign in to comment.