Browse Source

Merge pull request #2579 from sdodson/fix-registry-volume-namespace

Fix config and namespace for registry volume detection
Andrew Butcher 8 years ago
parent
commit
131bcdcd7e

+ 9 - 2
roles/openshift_hosted/tasks/registry/storage/persistent_volume.yml

@@ -3,7 +3,11 @@
     registry_volume_claim: "{{ openshift.hosted.registry.storage.volume.name }}-claim"
 
 - name: Determine if volume is already attached to dc/docker-registry
-  command: "{{ openshift.common.client_binary }} get -o template dc/docker-registry --template=\\{\\{.spec.template.spec.volumes\\}\\} --output-version=v1"
+  command: >
+      {{ openshift.common.client_binary }}
+      --config={{ openshift_hosted_kubeconfig }}
+      --namespace={{ openshift.hosted.registry.namespace | default('default') }}
+      get -o template dc/docker-registry --template=\\{\\{.spec.template.spec.volumes\\}\\} --output-version=v1
   changed_when: false
   failed_when: false
   register: registry_volumes_output
@@ -13,7 +17,10 @@
 
 - name: Add volume to dc/docker-registry
   command: >
-    {{ openshift.common.client_binary }} volume dc/docker-registry
+    {{ openshift.common.client_binary }}
+    --config={{ openshift_hosted_kubeconfig }}
+    --namespace={{ openshift.hosted.registry.namespace | default('default') }}
+    volume dc/docker-registry
     --add --overwrite -t persistentVolumeClaim --claim-name={{ registry_volume_claim }}
     --name=registry-storage
   when: not volume_attached | bool