From 949984601ffd147ef306ed96715308921c7344f6 Mon Sep 17 00:00:00 2001 From: Sascha Marcel Schmidt Date: Wed, 5 Sep 2018 15:58:44 +0200 Subject: [PATCH] actually use heketi auth --- .../roles/provision/tasks/bootstrap/topology.yml | 6 +++--- .../heketi/roles/provision/tasks/bootstrap/volumes.yml | 10 +++++----- .../heketi/roles/provision/tasks/topology.yml | 4 ++-- .../heketi/roles/provision/templates/heketi.json.j2 | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/contrib/network-storage/heketi/roles/provision/tasks/bootstrap/topology.yml b/contrib/network-storage/heketi/roles/provision/tasks/bootstrap/topology.yml index 8c29aa1a6..31d1d48cb 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/bootstrap/topology.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/bootstrap/topology.yml @@ -1,7 +1,7 @@ --- - name: "Get heketi topology." register: "heketi_topology" - command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology info --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} topology info --json" - name: "Render heketi topology template." become: true vars: { nodes: "{{ groups['heketi-node'] }}" } @@ -12,11 +12,11 @@ command: "{{ bin_dir }}/kubectl cp {{ kube_config_dir }}/topology.json {{ initial_heketi_pod_name }}:/tmp/topology.json" - name: "Load heketi topology." when: "heketi_topology.stdout|from_json|json_query(\"clusters[*].nodes[*]\")|flatten|length == 0" - command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology load --json=/tmp/topology.json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} topology load --json=/tmp/topology.json" register: "load_heketi" - name: "Get heketi topology." register: "heketi_topology" - command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology info --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} topology info --json" until: "heketi_topology.stdout|from_json|json_query(\"clusters[*].nodes[*].devices[?state=='online'].id\")|flatten|length == groups['heketi-node']|length" retries: 60 delay: 5 diff --git a/contrib/network-storage/heketi/roles/provision/tasks/bootstrap/volumes.yml b/contrib/network-storage/heketi/roles/provision/tasks/bootstrap/volumes.yml index e6226a7c3..bb088173e 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/bootstrap/volumes.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/bootstrap/volumes.yml @@ -1,11 +1,11 @@ --- - name: "Get heketi volume ids." - command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume list --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} volume list --json" changed_when: false register: "heketi_volumes" - name: "Get heketi volumes." changed_when: false - command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume info {{ volume_id }} --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} volume info {{ volume_id }} --json" with_items: "{{ heketi_volumes.stdout|from_json|json_query(\"volumes[*]\") }}" loop_control: { loop_var: "volume_id" } register: "volumes_information" @@ -16,18 +16,18 @@ vars: { volume: "{{ volume_information.stdout|from_json }}" } when: "volume.name == 'heketidbstorage'" - name: "Provision database volume." - command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli setup-openshift-heketi-storage" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} setup-openshift-heketi-storage" when: "heketi_database_volume_exists is undefined" - name: "Copy configuration from pod." become: true command: "{{ bin_dir }}/kubectl cp {{ initial_heketi_pod_name }}:/heketi-storage.json {{ kube_config_dir }}/heketi-storage.json" - name: "Get heketi volume ids." - command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume list --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} volume list --json" changed_when: false register: "heketi_volumes" - name: "Get heketi volumes." changed_when: false - command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume info {{ volume_id }} --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} volume info {{ volume_id }} --json" with_items: "{{ heketi_volumes.stdout|from_json|json_query(\"volumes[*]\") }}" loop_control: { loop_var: "volume_id" } register: "volumes_information" diff --git a/contrib/network-storage/heketi/roles/provision/tasks/topology.yml b/contrib/network-storage/heketi/roles/provision/tasks/topology.yml index 52c709f37..b9cb3e0d2 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/topology.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/topology.yml @@ -15,11 +15,11 @@ command: "{{ bin_dir }}/kubectl cp {{ kube_config_dir }}/topology.json {{ heketi_pod_name }}:/tmp/topology.json" - name: "Load heketi topology." when: "rendering.changed" - command: "{{ bin_dir }}/kubectl exec {{ heketi_pod_name }} -- heketi-cli topology load --json=/tmp/topology.json" + command: "{{ bin_dir }}/kubectl exec {{ heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} topology load --json=/tmp/topology.json" - name: "Get heketi topology." register: "heketi_topology" changed_when: false - command: "{{ bin_dir }}/kubectl exec {{ heketi_pod_name }} -- heketi-cli topology info --json" + command: "{{ bin_dir }}/kubectl exec {{ heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} topology info --json" until: "heketi_topology.stdout|from_json|json_query(\"clusters[*].nodes[*].devices[?state=='online'].id\")|flatten|length == groups['heketi-node']|length" retries: 60 delay: 5 diff --git a/contrib/network-storage/heketi/roles/provision/templates/heketi.json.j2 b/contrib/network-storage/heketi/roles/provision/templates/heketi.json.j2 index 7ba980dca..5861b684b 100644 --- a/contrib/network-storage/heketi/roles/provision/templates/heketi.json.j2 +++ b/contrib/network-storage/heketi/roles/provision/templates/heketi.json.j2 @@ -3,7 +3,7 @@ "port": "8080", "_use_auth": "Enable JWT authorization. Please enable for deployment", - "use_auth": false, + "use_auth": true, "_jwt": "Private keys for access", "jwt": {