diff --git a/README.md b/README.md index 0b134bad..41ea587a 100644 --- a/README.md +++ b/README.md @@ -63,21 +63,7 @@ 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: -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 @@ -85,7 +71,7 @@ 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: diff --git a/k8s/gcr-secret.yaml b/k8s/gcr-secret.yaml deleted file mode 100644 index cac3de17..00000000 --- a/k8s/gcr-secret.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -data: - 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 diff --git a/k8s/replicationController.yaml b/k8s/replicationController.yaml index 532d8518..b1306440 100644 --- a/k8s/replicationController.yaml +++ b/k8s/replicationController.yaml @@ -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 \ No newline at end of file diff --git a/k8s/secret.yaml b/k8s/secret.yaml index 429495ec..3f772e15 100644 --- a/k8s/secret.yaml +++ b/k8s/secret.yaml @@ -1,4 +1,3 @@ - apiVersion: v1 data: AWS_ACCESS_KEY_ID: Y2hhbmdlbWU= @@ -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 diff --git a/main.go b/main.go index 6fc0a39e..4aea5755 100644 --- a/main.go +++ b/main.go @@ -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 @@ -326,5 +326,4 @@ func main() { } } } - }