Fix Cinder CSI bugs (#5492)

This commit is contained in:
Ali Sanhaji 2020-02-17 10:49:28 +01:00 committed by GitHub
parent 57b0b6a9b1
commit d56e9f6b80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 16 deletions

View file

@ -2,15 +2,16 @@
# To access Cinder, the CSI controller will need credentials to access # To access Cinder, the CSI controller will need credentials to access
# openstack apis. Per default this values will be # openstack apis. Per default this values will be
# read from the environment. # read from the environment.
cinder_auth_url: "{{ lookup('env','OS_AUTH_URL') }}" cinder_auth_url: "{{ lookup('env','OS_AUTH_URL') }}"
cinder_username: "{{ lookup('env','OS_USERNAME') }}" cinder_username: "{{ lookup('env','OS_USERNAME') }}"
cinder_password: "{{ lookup('env','OS_PASSWORD') }}" cinder_password: "{{ lookup('env','OS_PASSWORD') }}"
cinder_region: "{{ lookup('env','OS_REGION_NAME') }}" cinder_region: "{{ lookup('env','OS_REGION_NAME') }}"
cinder_tenant_id: "{{ lookup('env','OS_TENANT_ID')| default(lookup('env','OS_PROJECT_ID')|default(lookup('env','OS_PROJECT_NAME'),true),true) }}" cinder_tenant_id: "{{ lookup('env','OS_TENANT_ID')| default(lookup('env','OS_PROJECT_ID'),true) }}"
cinder_tenant_name: "{{ lookup('env','OS_TENANT_NAME') }}" cinder_tenant_name: "{{ lookup('env','OS_TENANT_NAME')| default(lookup('env','OS_PROJECT_NAME'),true) }}"
cinder_domain_name: "{{ lookup('env','OS_USER_DOMAIN_NAME') }}" cinder_domain_name: "{{ lookup('env','OS_USER_DOMAIN_NAME') }}"
cinder_domain_id: "{{ lookup('env','OS_USER_DOMAIN_ID') }}" cinder_domain_id: "{{ lookup('env','OS_USER_DOMAIN_ID') }}"
cinder_cacert: "{{ lookup('env','OS_CACERT') }}" cinder_cacert: "{{ lookup('env','OS_CACERT') }}"
# For now, only Cinder v3 is supported in Cinder CSI driver # For now, only Cinder v3 is supported in Cinder CSI driver
cinder_blockstorage_version: "v3" cinder_blockstorage_version: "v3"
cinder_csi_controller_replicas: 1 cinder_csi_controller_replicas: 1

View file

@ -21,14 +21,14 @@
- name: Cinder CSI Driver | check cinder_tenant_id value - name: Cinder CSI Driver | check cinder_tenant_id value
fail: fail:
msg: "one of cinder_tenant_id or cinder_trust_id must be specified" msg: "one of cinder_tenant_id or cinder_tenant_name must be specified"
when: when:
- cinder_tenant_id is not defined or not cinder_tenant_id - cinder_tenant_id is not defined or not cinder_tenant_id
- cinder_trust_id is not defined - cinder_tenant_name is not defined
- name: Cinder CSI Driver | check cinder_trust_id value - name: Cinder CSI Driver | check cinder_tenant_name value
fail: fail:
msg: "one of cinder_tenant_id or cinder_trust_id must be specified" msg: "one of cinder_tenant_id or cinder_tenant_name must be specified"
when: when:
- cinder_trust_id is not defined or not cinder_trust_id - cinder_tenant_name is not defined or not cinder_tenant_name
- cinder_tenant_id is not defined - cinder_tenant_id is not defined

View file

@ -3,9 +3,7 @@ auth-url="{{ cinder_auth_url }}"
username="{{ cinder_username }}" username="{{ cinder_username }}"
password="{{ cinder_password }}" password="{{ cinder_password }}"
region="{{ cinder_region }}" region="{{ cinder_region }}"
{% if cinder_trust_id is defined and cinder_trust_id != "" %} {% if cinder_tenant_id is defined and cinder_tenant_id != "" %}
trust-id="{{ cinder_trust_id }}"
{% else %}
tenant-id="{{ cinder_tenant_id }}" tenant-id="{{ cinder_tenant_id }}"
{% endif %} {% endif %}
{% if cinder_tenant_name is defined and cinder_tenant_name != "" %} {% if cinder_tenant_name is defined and cinder_tenant_name != "" %}

View file

@ -90,7 +90,7 @@ spec:
- name: secret-cinderplugin - name: secret-cinderplugin
mountPath: /etc/config mountPath: /etc/config
readOnly: true readOnly: true
{% if cinder_cacert is defined %} {% if cinder_cacert is defined and cinder_cacert != "" %}
- name: cinder-cacert - name: cinder-cacert
mountPath: {{ kube_config_dir }}/cinder-cacert.pem mountPath: {{ kube_config_dir }}/cinder-cacert.pem
readOnly: true readOnly: true
@ -101,7 +101,7 @@ spec:
- name: secret-cinderplugin - name: secret-cinderplugin
secret: secret:
secretName: cloud-config secretName: cloud-config
{% if cinder_cacert is defined %} {% if cinder_cacert is defined and cinder_cacert != "" %}
- name: cinder-cacert - name: cinder-cacert
hostPath: hostPath:
path: {{ kube_config_dir }}/cinder-cacert.pem path: {{ kube_config_dir }}/cinder-cacert.pem