Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions roles/common/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ common__azure_sp_login_from_env: "{{ infra.azure.sp_login_from_env | de
common__azure_netapp_account_name: "{{ infra.azure.netapp.account.name | default([common__namespace, common__azure_netapp_suffix, common__azure_account_suffix] | join('-'))}}"
common__azure_netapp_pool_name: "{{ infra.azure.netapp.pool.name | default([common__namespace, common__azure_netapp_suffix, common__azure_pool_suffix] | join('-')) }}"
common__azure_netapp_vol_name: "{{ infra.azure.netapp.volume.name | default([common__namespace, common__azure_netapp_suffix, common__azure_volume_suffix] | join('-')) }}"
common__azure_netapp_nfs_version: "{{ infra.azure.netapp.nfs.version | default('3') }}"

# GCP Infra
common__gcp_project: "{{ infra.gcp.project | default('gcp-se') }}"
Expand Down
1 change: 1 addition & 0 deletions roles/infrastructure/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ infra__azure_storage_kind: "{{ infra.azure.storage.type | default('Stor
infra__azure_netapp_account_name: "{{ common__azure_netapp_account_name }}"
infra__azure_netapp_pool_name: "{{ common__azure_netapp_pool_name }}"
infra__azure_netapp_vol_name: "{{ common__azure_netapp_vol_name }}"
infra__azure_netapp_nfs_version: "{{ common__azure_netapp_nfs_version }}"

infra__azure_netapp_pool_size: "{{ infra.azure.netapp.pool.size | default(1) }}" # 4TB 'chunks'
infra__azure_netapp_pool_type: "{{ infra.azure.netapp.pool.type | default('Standard') }}"
Expand Down
11 changes: 6 additions & 5 deletions roles/infrastructure/tasks/setup_azure_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
- name: Handle Azure NetApp Storage if deploying CML
when:
- infra__ml_deploy
- infra__azure_nfs_mount is undefined or infra__azure_nfs_mount == ''
- infra__azure_netapp_nfs_mount is undefined or infra__azure_netapp_nfs_mount == ''
block:
- name: Handle Netapp Storage Account
netapp.azure.azure_rm_netapp_account:
Expand Down Expand Up @@ -108,14 +108,15 @@
subnet_id: "{{ infra__vpc_svcnet_name }}"
service_level: "{{ infra__azure_netapp_vol_type }}"
size: "{{ infra__azure_netapp_vol_size }}"
protocol_types: "{{ ['NFSv' + infra__azure_netapp_nfs_version] }}"

- name: Prepare netapp vol info for submission during initial creation
when: __azure_netapp_vol_details.msg is defined
set_fact:
infra__azure_nfs_mount: "{{ __azure_netapp_vol_details.msg }}"
ansible.builtin.set_fact:
infra__azure_netapp_nfs_mount: "{{ __azure_netapp_vol_details.msg }}"

# Yay for Azure consistency
- name: Prepare netapp vol info for submission during recreation
when: __azure_netapp_vol_details.mount_path is defined
set_fact:
infra__azure_nfs_mount: "{{ __azure_netapp_vol_details.mount_path }}"
ansible.builtin.set_fact:
infra__azure_netapp_nfs_mount: "{{ __azure_netapp_vol_details.mount_path }}"
18 changes: 18 additions & 0 deletions roles/infrastructure/tasks/teardown_azure_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@
name: "{{ infra__azure_netapp_vol_name }}"
state: absent

- name: Confirm removal of Azure NetApp Volume
azure.azcollection.azure_rm_resource_info:
resource_group: "{{ infra__azure_metagroup_name }}"
provider: NetApp
resource_type: netAppAccounts
resource_name: "{{ infra__azure_netapp_account_name }}"
subresource:
- type: capacityPools
name: "{{ infra__azure_netapp_pool_name }}"
- type: volumes
name: "{{ infra__azure_netapp_vol_name }}"
register: __azure_netapp_volume_removal
until: __azure_netapp_volume_removal.failed or __azure_netapp_volume_removal.response | first | community.general.json_query(query)
delay: 15
retries: 40 # 10 mins
vars:
query: "error.code == 'ResourceNotFound'"

- name: Remove NetApp Capacity Pool
netapp.azure.azure_rm_netapp_capacity_pool:
resource_group: "{{ infra__azure_metagroup_name }}"
Expand Down
4 changes: 0 additions & 4 deletions roles/platform/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,5 @@ plat__azure_storageowner_datalakeadmin_data_assn_name: "{{ env.azure.role.assig
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 )}}"
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 )}}"

plat__azure_netapp_account_name: "{{ common__azure_netapp_account_name }}"
plat__azure_netapp_pool_name: "{{ common__azure_netapp_pool_name }}"
plat__azure_netapp_vol_name: "{{ common__azure_netapp_vol_name }}"

plat__azure_stor_logs_uri: "{{ env.azure.storage.path.logs | default('abfs://' + plat__logs_path + '@' + plat__azure_storage_name + '.dfs.core.windows.net') }}"
plat__azure_stor_data_uri: "{{ env.azure.storage.path.data | default('abfs://' + plat__data_path + '@' + plat__azure_storage_name + '.dfs.core.windows.net') }}"
20 changes: 0 additions & 20 deletions roles/platform/tasks/initialize_azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,6 @@
jq_log_rl_uri: "[?name=='{{ plat__azure_log_identity_name }}'].id"
jq_rngr_rl_uri: "[?name=='{{ plat__azure_ranger_audit_identity_name }}'].id"

- name: Get Azure Netapp NFS Info
register: __azure_netapp_nfs_info
command: >
az netappfiles volume show \
--resource-group "{{ plat__azure_metagroup_name |quote }}" \
--account-name "{{ plat__azure_netapp_account_name |quote }}" \
--pool-name "{{ plat__azure_netapp_pool_name |quote }}" \
--volume-name "{{ plat__azure_netapp_vol_name |quote }}"
ignore_errors: true

- name: Set Azure NetApp Volume Start IP if exists
when: __azure_netapp_nfs_info.stdout != ''
ansible.builtin.set_fact:
__azure_netapp_startip: "{{ __azure_netapp_nfs_info.stdout | from_json | community.general.json_query('mountTargets[0].ipAddress') }}"

- name: Set Azure NetApp Volume Info if exists
when: __azure_netapp_startip is defined
ansible.builtin.set_fact:
infra__azure_nfs_mount: "{{ __azure_netapp_startip }}:/{{ plat__namespace }}"

- name: Generate Public Subnet details
ansible.builtin.set_fact:
plat__vpc_public_subnets_info: "{{ plat__vpc_public_subnets_info | default([]) | union([entry]) }}"
Expand Down
7 changes: 7 additions & 0 deletions roles/runtime/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,10 @@ run__include_opdb: "{{ common__include_opdb }}"
run__aws_vpc_id: "{{ common__aws_vpc_id }}"
run__aws_public_subnet_ids: "{{ common__aws_public_subnet_ids }}"
run__aws_private_subnet_ids: "{{ common__aws_private_subnet_ids }}"

# Azure
run__azure_metagroup_name: "{{ common__azure_metagroup_name }}"
run__azure_netapp_account_name: "{{ common__azure_netapp_account_name }}"
run__azure_netapp_pool_name: "{{ common__azure_netapp_pool_name }}"
run__azure_netapp_vol_name: "{{ common__azure_netapp_vol_name }}"
run__azure_netapp_nfs_version: "{{ common__azure_netapp_nfs_version }}"
3 changes: 2 additions & 1 deletion roles/runtime/tasks/initialize_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@
base_instance_group: "{{ run__ml_k8s_request_base }}"
config:
name: "{{ __ml_config.name | default([run__namespace_cdp, __ml_config.suffix | default(include.suffix) | default(run__ml_suffix)] | join('-')) }}"
nfs: "{{ __ml_config.nfs | default(run__azure_nfs_mount | default(omit)) }}"
nfs: "{{ __ml_config.nfs | default(run__azure_netapp_nfs_mount | default(omit)) }}"
nfs_version: "{{ __ml_config.nfs_version | default((__ml_config.nfs is defined or run__azure_netapp_nfs_mount is defined) | ternary(run__azure_netapp_nfs_version, omit)) }}"
k8s_request:
environmentName: "{{ run__env_name }}"
instanceGroups: "{{ overlay_instance_groups | map('cloudera.exe.combine_onto', base_instance_group, recursive=True) | list }}"
Expand Down
46 changes: 43 additions & 3 deletions roles/runtime/tasks/initialize_setup_azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,47 @@
ansible.builtin.set_fact:
run__datahub_subnet_ids: "{{ infra__azure_subnets }}"

- name: Set fact for Azure NFS Mount
when: infra__azure_nfs_mount is defined
# TODO Discover an existing NFS mount (shared) if not created upstream
# This might not exist. If so, then the ML configs MUST declare their own location
# If it does exist, then the ML configs can use it as a default if not set explicitly

- name: Set fact for Azure NFS mount path if established by Infrastructure
when: infra__azure_netapp_nfs_mount is defined
ansible.builtin.set_fact:
run__azure_nfs_mount: "{{ infra__azure_nfs_mount }}"
run__azure_netapp_nfs_mount: "{{ infra__azure_netapp_nfs_mount }}"

- name: Discover Azure NetApp NFS mount path
when: run__azure_netapp_nfs_mount is undefined
block:
- name: Get Azure NetApp NFS volume details
register: __azure_netapp_nfs_info
azure.azcollection.azure_rm_resource_info:
resource_group: "{{ run__azure_metagroup_name }}"
provider: NetApp
resource_type: netAppAccounts
resource_name: "{{ run__azure_netapp_account_name }}"
subresource:
- type: capacityPools
name: "{{ run__azure_netapp_pool_name }}"
- type: volumes
name: "{{ run__azure_netapp_vol_name }}"

- name: Set Azure NetApp Volume Start IP if exists
when: __azure_netapp_nfs_info.response | length > 0
ansible.builtin.set_fact:
__azure_netapp_startip: "{{ __azure_netapp_nfs_info.response | first | community.general.json_query('properties.mountTargets[0].ipAddress') }}"

- name: Set Azure NetApp Volume Info and Protocol if exists
when: __azure_netapp_startip is defined
block:
- name: Set Azure NetApp Volume NFS mount path
ansible.builtin.set_fact:
run__azure_netapp_nfs_mount: "{{ __azure_netapp_startip }}:/{{ run__namespace }}"

- name: Validate Azure NetApp Volume NFS protocol version
ansible.builtin.assert:
that: ("NFSv" + run__azure_netapp_nfs_version) in __azure_netapp_nfs_info.response | first | community.general.json_query('properties.protocolTypes')
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 }}'."
quiet: yes

# 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" }] }'
2 changes: 1 addition & 1 deletion roles/runtime/tasks/setup_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
metrics: "{{ __ml_config_item.raw.metrics | default(omit) }}"
database: "{{ __ml_config_item.raw.database | default(omit) }}"
nfs: "{{ __ml_config_item.nfs | default(omit) }}"
nfs_version: "{{ __ml_config_item.raw.nfs_version | default(omit) }}"
nfs_version: "{{ __ml_config_item.nfs_version | default(omit) }}"
ip_addresses: "{{ __ml_config_item.raw.ip_addresses | default(omit) }}"
public_loadbalancer: "{{ __ml_config_item.raw.public_loadbalancer | default(omit) }}"
storage: "{{ __ml_config_item.raw.storage | default(omit) }}"
Expand Down