ソースを参照

Merge pull request #4571 from wongma7/efs-follow

Add blank storageClassName to provisioner PVC & PV template
Michael Gugino 7 年 前
コミット
e3d95a3e9e

+ 3 - 1
roles/openshift_provisioners/tasks/generate_clusterrolebindings.yaml

@@ -1,6 +1,8 @@
 ---
 - name: Generate ClusterRoleBindings
-  template: src=clusterrolebinding.j2 dest={{mktemp.stdout}}/templates/{{obj_name}}-clusterrolebinding.yaml
+  template:
+    src: clusterrolebinding.j2
+    dest: "{{ mktemp.stdout }}/templates/{{ obj_name }}-clusterrolebinding.yaml"
   vars:
     acct_name: provisioners-{{item}}
     obj_name: run-provisioners-{{item}}

+ 3 - 1
roles/openshift_provisioners/tasks/generate_secrets.yaml

@@ -1,6 +1,8 @@
 ---
 - name: Generate secret for efs
-  template: src=secret.j2 dest={{mktemp.stdout}}/templates/{{obj_name}}-secret.yaml
+  template:
+    src: secret.j2
+    dest: "{{ mktemp.stdout }}/templates/{{ obj_name }}-secret.yaml"
   vars:
     name: efs
     obj_name: "provisioners-efs"

+ 3 - 1
roles/openshift_provisioners/tasks/generate_serviceaccounts.yaml

@@ -1,6 +1,8 @@
 ---
 - name: Generating serviceaccounts
-  template: src=serviceaccount.j2 dest={{mktemp.stdout}}/templates/{{obj_name}}-sa.yaml
+  template:
+    src: serviceaccount.j2
+    dest: "{{ mktemp.stdout }}/templates/{{ obj_name }}-sa.yaml"
   vars:
     obj_name: provisioners-{{item}}
     labels:

+ 6 - 2
roles/openshift_provisioners/tasks/install_efs.yaml

@@ -9,7 +9,9 @@
   changed_when: no
 
 - name: Generate efs PersistentVolumeClaim
-  template: src=pvc.j2 dest={{mktemp.stdout}}/templates/{{obj_name}}-pvc.yaml
+  template:
+    src: pvc.j2
+    dest: "{{ mktemp.stdout }}/templates/{{ obj_name }}-pvc.yaml"
   vars:
     obj_name: "provisioners-efs"
     size: "1Mi"
@@ -21,7 +23,9 @@
   changed_when: no
 
 - name: Generate efs PersistentVolume
-  template: src=pv.j2 dest={{mktemp.stdout}}/templates/{{obj_name}}-pv.yaml
+  template:
+    src: pv.j2
+    dest: "{{ mktemp.stdout }}/templates/{{ obj_name }}-pv.yaml"
   vars:
     obj_name: "provisioners-efs"
     size: "1Mi"

+ 5 - 12
roles/openshift_provisioners/tasks/install_support.yaml

@@ -1,16 +1,9 @@
 ---
-- name: Check for provisioners project already exists
-  command: >
-    {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get project {{openshift_provisioners_project}} --no-headers
-  register: provisioners_project_result
-  ignore_errors: yes
-  when: not ansible_check_mode
-  changed_when: no
-
-- name: Create provisioners project
-  command: >
-    {{ openshift.common.admin_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig new-project {{openshift_provisioners_project}}
-  when: not ansible_check_mode and "not found" in provisioners_project_result.stderr
+- name: Set provisioners project
+  oc_project:
+    state: present
+    kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
+    name: "{{ openshift_provisioners_project }}"
 
 - name: Create temp directory for all our templates
   file: path={{mktemp.stdout}}/templates state=directory mode=0755

+ 1 - 0
roles/openshift_provisioners/templates/pv.j2

@@ -30,3 +30,4 @@ spec:
     name: {{claim_name}}
     namespace: {{openshift_provisioners_project}}
 {% endif %}
+  storageClassName: ""

+ 1 - 0
roles/openshift_provisioners/templates/pvc.j2

@@ -23,4 +23,5 @@ spec:
   resources:
     requests:
       storage: {{size}}
+  storageClassName: ""