Skip to content

Commit f1c9760

Browse files
committed
Update Azure NetApp management and add NFS protocol version for Infrastructure and CML usage
Signed-off-by: Webster Mudge <[email protected]>
1 parent 0ae37f4 commit f1c9760

File tree

9 files changed

+61
-34
lines changed

9 files changed

+61
-34
lines changed

roles/common/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ common__azure_sp_login_from_env: "{{ infra.azure.sp_login_from_env | de
131131
common__azure_netapp_account_name: "{{ infra.azure.netapp.account.name | default([common__namespace, common__azure_netapp_suffix, common__azure_account_suffix] | join('-'))}}"
132132
common__azure_netapp_pool_name: "{{ infra.azure.netapp.pool.name | default([common__namespace, common__azure_netapp_suffix, common__azure_pool_suffix] | join('-')) }}"
133133
common__azure_netapp_vol_name: "{{ infra.azure.netapp.volume.name | default([common__namespace, common__azure_netapp_suffix, common__azure_volume_suffix] | join('-')) }}"
134+
common__azure_netapp_nfs_version: "{{ infra.azure.netapp.nfs.version | default('3') }}"
134135

135136
# GCP Infra
136137
common__gcp_project: "{{ infra.gcp.project | default('gcp-se') }}"

roles/infrastructure/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ infra__azure_storage_kind: "{{ infra.azure.storage.type | default('Stor
144144
infra__azure_netapp_account_name: "{{ common__azure_netapp_account_name }}"
145145
infra__azure_netapp_pool_name: "{{ common__azure_netapp_pool_name }}"
146146
infra__azure_netapp_vol_name: "{{ common__azure_netapp_vol_name }}"
147+
infra__azure_netapp_nfs_version: "{{ common__azure_netapp_nfs_version }}"
147148

148149
infra__azure_netapp_pool_size: "{{ infra.azure.netapp.pool.size | default(1) }}" # 4TB 'chunks'
149150
infra__azure_netapp_pool_type: "{{ infra.azure.netapp.pool.type | default('Standard') }}"

roles/infrastructure/tasks/setup_azure_storage.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
- name: Handle Azure NetApp Storage if deploying CML
7676
when:
7777
- infra__ml_deploy
78-
- infra__azure_nfs_mount is undefined or infra__azure_nfs_mount == ''
78+
- infra__azure_netapp_nfs_mount is undefined or infra__azure_netapp_nfs_mount == ''
7979
block:
8080
- name: Handle Netapp Storage Account
8181
netapp.azure.azure_rm_netapp_account:
@@ -108,14 +108,15 @@
108108
subnet_id: "{{ infra__vpc_svcnet_name }}"
109109
service_level: "{{ infra__azure_netapp_vol_type }}"
110110
size: "{{ infra__azure_netapp_vol_size }}"
111+
protocol_types: "{{ ['NFSv' + infra__azure_netapp_nfs_version] }}"
111112

112113
- name: Prepare netapp vol info for submission during initial creation
113114
when: __azure_netapp_vol_details.msg is defined
114-
set_fact:
115-
infra__azure_nfs_mount: "{{ __azure_netapp_vol_details.msg }}"
115+
ansible.builtin.set_fact:
116+
infra__azure_netapp_nfs_mount: "{{ __azure_netapp_vol_details.msg }}"
116117

117118
# Yay for Azure consistency
118119
- name: Prepare netapp vol info for submission during recreation
119120
when: __azure_netapp_vol_details.mount_path is defined
120-
set_fact:
121-
infra__azure_nfs_mount: "{{ __azure_netapp_vol_details.mount_path }}"
121+
ansible.builtin.set_fact:
122+
infra__azure_netapp_nfs_mount: "{{ __azure_netapp_vol_details.mount_path }}"

roles/platform/defaults/main.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,5 @@ plat__azure_storageowner_datalakeadmin_data_assn_name: "{{ env.azure.role.assig
211211
plat__azure_storagecontr_log_assn_name: "{{ env.azure.role.assignment.log.storagecontr | default('-'.join([plat__namespace, plat__azure_contributor_name_suffix, plat__azure_log_suffix, plat__azure_assignment_name_suffix,ansible_date_time.iso8601]) | to_uuid )}}"
212212
plat__azure_storagecontr_ranger_audit_assn_name: "{{ env.azure.role.assignment.ranger_audit.storagecontr | default('-'.join([plat__namespace, plat__azure_contributor_name_suffix, plat__azure_ranger_audit_suffix, plat__azure_assignment_name_suffix,ansible_date_time.iso8601]) | to_uuid )}}"
213213

214-
plat__azure_netapp_account_name: "{{ common__azure_netapp_account_name }}"
215-
plat__azure_netapp_pool_name: "{{ common__azure_netapp_pool_name }}"
216-
plat__azure_netapp_vol_name: "{{ common__azure_netapp_vol_name }}"
217-
218214
plat__azure_stor_logs_uri: "{{ env.azure.storage.path.logs | default('abfs://' + plat__logs_path + '@' + plat__azure_storage_name + '.dfs.core.windows.net') }}"
219215
plat__azure_stor_data_uri: "{{ env.azure.storage.path.data | default('abfs://' + plat__data_path + '@' + plat__azure_storage_name + '.dfs.core.windows.net') }}"

roles/platform/tasks/initialize_azure.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -131,26 +131,6 @@
131131
jq_log_rl_uri: "[?name=='{{ plat__azure_log_identity_name }}'].id"
132132
jq_rngr_rl_uri: "[?name=='{{ plat__azure_ranger_audit_identity_name }}'].id"
133133

134-
- name: Get Azure Netapp NFS Info
135-
register: __azure_netapp_nfs_info
136-
command: >
137-
az netappfiles volume show \
138-
--resource-group "{{ plat__azure_metagroup_name |quote }}" \
139-
--account-name "{{ plat__azure_netapp_account_name |quote }}" \
140-
--pool-name "{{ plat__azure_netapp_pool_name |quote }}" \
141-
--volume-name "{{ plat__azure_netapp_vol_name |quote }}"
142-
ignore_errors: true
143-
144-
- name: Set Azure NetApp Volume Start IP if exists
145-
when: __azure_netapp_nfs_info.stdout != ''
146-
ansible.builtin.set_fact:
147-
__azure_netapp_startip: "{{ __azure_netapp_nfs_info.stdout | from_json | community.general.json_query('mountTargets[0].ipAddress') }}"
148-
149-
- name: Set Azure NetApp Volume Info if exists
150-
when: __azure_netapp_startip is defined
151-
ansible.builtin.set_fact:
152-
infra__azure_nfs_mount: "{{ __azure_netapp_startip }}:/{{ plat__namespace }}"
153-
154134
- name: Generate Public Subnet details
155135
ansible.builtin.set_fact:
156136
plat__vpc_public_subnets_info: "{{ plat__vpc_public_subnets_info | default([]) | union([entry]) }}"

roles/runtime/defaults/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,10 @@ run__include_opdb: "{{ common__include_opdb }}"
9797
run__aws_vpc_id: "{{ common__aws_vpc_id }}"
9898
run__aws_public_subnet_ids: "{{ common__aws_public_subnet_ids }}"
9999
run__aws_private_subnet_ids: "{{ common__aws_private_subnet_ids }}"
100+
101+
# Azure
102+
run__azure_metagroup_name: "{{ common__azure_metagroup_name }}"
103+
run__azure_netapp_account_name: "{{ common__azure_netapp_account_name }}"
104+
run__azure_netapp_pool_name: "{{ common__azure_netapp_pool_name }}"
105+
run__azure_netapp_vol_name: "{{ common__azure_netapp_vol_name }}"
106+
run__azure_netapp_nfs_version: "{{ common__azure_netapp_nfs_version }}"

roles/runtime/tasks/initialize_base.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@
152152
base_instance_group: "{{ run__ml_k8s_request_base }}"
153153
config:
154154
name: "{{ __ml_config.name | default([run__namespace_cdp, __ml_config.suffix | default(include.suffix) | default(run__ml_suffix)] | join('-')) }}"
155-
nfs: "{{ __ml_config.nfs | default(run__azure_nfs_mount | default(omit)) }}"
155+
nfs: "{{ __ml_config.nfs | default(run__azure_netapp_nfs_mount | default(omit)) }}"
156+
nfs_version: "{{ __ml_config.nfs_version | default(run__azure_netapp_nfs_version if __ml_config.nfs is defined or run__azure_netapp_nfs_mount is defined | default(omit)) }}"
156157
k8s_request:
157158
environmentName: "{{ run__env_name }}"
158159
instanceGroups: "{{ overlay_instance_groups | map('cloudera.exe.combine_onto', base_instance_group, recursive=True) | list }}"

roles/runtime/tasks/initialize_setup_azure.yml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,47 @@
1818
ansible.builtin.set_fact:
1919
run__datahub_subnet_ids: "{{ infra__azure_subnets }}"
2020

21-
- name: Set fact for Azure NFS Mount
22-
when: infra__azure_nfs_mount is defined
21+
# TODO Discover an existing NFS mount (shared) if not created upstream
22+
# This might not exist. If so, then the ML configs MUST declare their own location
23+
# If it does exist, then the ML configs can use it as a default if not set explicitly
24+
25+
- name: Set fact for Azure NFS mount path if established by Infrastructure
26+
when: infra__azure_netapp_nfs_mount is defined
2327
ansible.builtin.set_fact:
24-
run__azure_nfs_mount: "{{ infra__azure_nfs_mount }}"
28+
run__azure_netapp_nfs_mount: "{{ infra__azure_netapp_nfs_mount }}"
29+
30+
- name: Discover Azure NetApp NFS mount path
31+
when: run__azure_netapp_nfs_mount is undefined
32+
block:
33+
- name: Get Azure NetApp NFS volume details
34+
register: __azure_netapp_nfs_info
35+
azure.azcollection.azure_rm_resource_info:
36+
resource_group: "{{ run__azure_metagroup_name }}"
37+
provider: NetApp
38+
resource_type: netAppAccounts
39+
resource_name: "{{ run__azure_netapp_account_name }}"
40+
subresource:
41+
- type: capacityPools
42+
name: "{{ run__azure_netapp_pool_name }}"
43+
- type: volumes
44+
name: "{{ run__azure_netapp_vol_name }}"
45+
46+
- name: Set Azure NetApp Volume Start IP if exists
47+
when: __azure_netapp_nfs_info.response | length > 0
48+
ansible.builtin.set_fact:
49+
__azure_netapp_startip: "{{ __azure_netapp_nfs_info.response | first | community.general.json_query('properties.mountTargets[0].ipAddress') }}"
50+
51+
- name: Set Azure NetApp Volume Info and Protocol if exists
52+
when: __azure_netapp_startip is defined
53+
block:
54+
- name: Set Azure NetApp Volume NFS mount path
55+
ansible.builtin.set_fact:
56+
run__azure_netapp_nfs_mount: "{{ __azure_netapp_startip }}:/{{ run__namespace }}"
57+
58+
- name: Validate Azure NetApp Volume NFS protocol version
59+
ansible.builtin.assert:
60+
that: ("NFSv" + run__azure_netapp_nfs_version) in __azure_netapp_nfs_info.response | first | community.general.json_query('properties.protocolTypes')
61+
fail_msg: "Invalid NFS protocol version. 'NFSv{{ run__azure_netapp_nfs_version }}' not supported by Azure NetApp volume, '{{ __azure_netapp_nfs_info.response | map('attribute', 'id') | list | first }}'."
62+
quiet: yes
63+
64+
# ansible -m azure.azcollection.azure_rm_resource_info localhost -a "resource_group=go03-rmgp provider=NetApp resource_type='netAppAccounts' resource_name='go03-netapp-account' subresource={{ subs }}" -e '{ "subs": [{ "type": "capacityPools" }] }'

roles/runtime/tasks/setup_base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
metrics: "{{ __ml_config_item.raw.metrics | default(omit) }}"
5050
database: "{{ __ml_config_item.raw.database | default(omit) }}"
5151
nfs: "{{ __ml_config_item.nfs | default(omit) }}"
52-
nfs_version: "{{ __ml_config_item.raw.nfs_version | default(omit) }}"
52+
nfs_version: "{{ __ml_config_item.nfs_version | default(omit) }}"
5353
ip_addresses: "{{ __ml_config_item.raw.ip_addresses | default(omit) }}"
5454
public_loadbalancer: "{{ __ml_config_item.raw.public_loadbalancer | default(omit) }}"
5555
storage: "{{ __ml_config_item.raw.storage | default(omit) }}"

0 commit comments

Comments
 (0)