From b19b88bd1c9944aec1ba96e6d8b99099d54a95f0 Mon Sep 17 00:00:00 2001 From: Dan Sneddon Date: Fri, 21 Jul 2017 14:33:33 -0700 Subject: Render VIPs dynamically based on network_data.yaml This change modifies the templates to dynamically define the VIPs based on network_data.yaml. If a network is defined and marked with "vip: true" in network_data.yaml, it will be included in the overcloud.yaml which defines the deployment-level resources. This should make it possible to create custom networks and use them for services which use high-availability through VIPs. Also, extraconfig/nova_metadata/krb-service-pricipals.yaml was modified to dynamically produce the FQDN map for VIPs on isolated networks, to match overcloud.j2.yaml. Depends-On: If074f87494a46305c990a0ea332c7b576d3c6ed8 Depends-On: Iab8aca2f1fcaba0c8f109717a4b3068f629c9aab Partially-implements: blueprint composable-networks Closes-bug: 1667104 Change-Id: I71339a6ac41133e95dbc3f93abb7a9fdeb0f2da0 --- .../nova_metadata/krb-service-principals.j2.yaml | 100 +++++++++++++++++++++ .../nova_metadata/krb-service-principals.yaml | 84 ----------------- 2 files changed, 100 insertions(+), 84 deletions(-) create mode 100644 extraconfig/nova_metadata/krb-service-principals.j2.yaml delete mode 100644 extraconfig/nova_metadata/krb-service-principals.yaml (limited to 'extraconfig') diff --git a/extraconfig/nova_metadata/krb-service-principals.j2.yaml b/extraconfig/nova_metadata/krb-service-principals.j2.yaml new file mode 100644 index 00000000..b18dba66 --- /dev/null +++ b/extraconfig/nova_metadata/krb-service-principals.j2.yaml @@ -0,0 +1,100 @@ +heat_template_version: pike +description: 'Generates the relevant service principals for a server' + +parameters: + RoleData: + type: json + description: the list containing the 'role_data' output for the ServiceChain +{%- for network in networks if network.vip|default(false) %} +{%- if network.name == 'External' %} + # Special case the External hostname param, which is CloudName + CloudName: + default: overcloud.localdomain + description: The DNS name of this cloud. E.g. ci-overcloud.tripleo.org + type: string +{%- elif network.name == 'InternalApi' %} + # Special case the Internal API hostname param, which is CloudNameInternal + CloudNameInternal: + default: overcloud.{{network.name.lower()}}.localdomain + description: > + The DNS name of this cloud's {{network.name_lower}} endpoint. E.g. + 'ci-overcloud.{{network.name.lower()}}.tripleo.org'. + type: string +{%- elif network.name == 'StorageMgmt' %} + # Special case StorageMgmt hostname param, which is CloudNameStorageManagement + CloudNameStorageManagement: + default: overcloud.{{network.name.lower()}}.localdomain + description: > + The DNS name of this cloud's {{network.name_lower}} endpoint. E.g. + 'ci-overcloud.{{network.name.lower()}}.tripleo.org'. + type: string +{%- else %} + CloudName{{network.name}}: + default: overcloud.{{network.name.lower()}}.localdomain + description: > + The DNS name of this cloud's {{network.name_lower}} endpoint. E.g. + 'ci-overcloud.{{network.name.lower()}}.tripleo.org'. + type: string +{%- endif %} +{%- endfor %} + CloudNameCtlplane: + default: overcloud.ctlplane.localdomain + description: > + The DNS name of this cloud's provisioning network endpoint. E.g. + 'ci-overcloud.ctlplane.tripleo.org'. + type: string + +resources: + + IncomingMetadataSettings: + type: OS::Heat::Value + properties: + value: + yaql: + # Filter null values and values that contain don't contain + # 'metadata_settings', get the values from that key and get the + # unique ones. + expression: list(coalesce($.data, []).where($ != null).where($.containsKey('metadata_settings')).metadata_settings.flatten().distinct()) + data: {get_param: RoleData} + + # Generates entries for nova metadata with the following format: + # 'managed_service_' : / + # Depending on the requested network + IndividualServices: + type: OS::Heat::Value + properties: + value: + yaql: + expression: let(fqdns => $.data.fqdns) -> dict(coalesce($.data.metadata, []).where($ != null and $.type = 'vip').select([concat('managed_service_', $.service, $.network), concat($.service, '/', $fqdns.get($.network))])) + data: + metadata: {get_attr: [IncomingMetadataSettings, value]} + fqdns: +{%- for network in networks if network.vip|default(false) %} +{%- if network.name == 'External' %} + external: {get_param: CloudName} +{%- elif network.name == 'InternalApi' %} + internal_api: {get_param: CloudNameInternal} +{%- elif network.name == 'StorageMgmt' %} + storage_mgmt: {get_param: CloudNameStorageManagement} +{%- else %} + {{network.name_lower}}: {get_param: CloudName{{network.name}}} +{%- endif %} +{%- endfor %} + ctlplane: {get_param: CloudNameCtlplane} + + CompactServices: + type: OS::Heat::Value + properties: + value: + yaql: + expression: dict(coalesce($.data, []).where($ != null and $.type = 'node').select([$.service, $.network.replace('_', '')]).groupBy($[0], $[1])) + data: {get_attr: [IncomingMetadataSettings, value]} + +outputs: + metadata: + description: actual metadata entries that will be passed to the server. + value: + map_merge: + - {get_attr: [IndividualServices, value]} + - compact_services: {get_attr: [CompactServices, value]} + diff --git a/extraconfig/nova_metadata/krb-service-principals.yaml b/extraconfig/nova_metadata/krb-service-principals.yaml deleted file mode 100644 index cdd4341a..00000000 --- a/extraconfig/nova_metadata/krb-service-principals.yaml +++ /dev/null @@ -1,84 +0,0 @@ -heat_template_version: pike -description: 'Generates the relevant service principals for a server' - -parameters: - RoleData: - type: json - description: the list containing the 'role_data' output for the ServiceChain - - # Coming from parameter_defaults - CloudName: - default: overcloud.localdomain - description: The DNS name of this cloud. E.g. ci-overcloud.tripleo.org - type: string - CloudNameInternal: - default: overcloud.internalapi.localdomain - description: > - The DNS name of this cloud's internal API endpoint. E.g. - 'ci-overcloud.internalapi.tripleo.org'. - type: string - CloudNameStorage: - default: overcloud.storage.localdomain - description: > - The DNS name of this cloud's storage endpoint. E.g. - 'ci-overcloud.storage.tripleo.org'. - type: string - CloudNameStorageManagement: - default: overcloud.storagemgmt.localdomain - description: > - The DNS name of this cloud's storage management endpoint. E.g. - 'ci-overcloud.storagemgmt.tripleo.org'. - type: string - CloudNameCtlplane: - default: overcloud.ctlplane.localdomain - description: > - The DNS name of this cloud's provisioning network endpoint. E.g. - 'ci-overcloud.ctlplane.tripleo.org'. - type: string - -resources: - - IncomingMetadataSettings: - type: OS::Heat::Value - properties: - value: - yaql: - # Filter null values and values that contain don't contain - # 'metadata_settings', get the values from that key and get the - # unique ones. - expression: list(coalesce($.data, []).where($ != null).where($.containsKey('metadata_settings')).metadata_settings.flatten().distinct()) - data: {get_param: RoleData} - - # Generates entries for nova metadata with the following format: - # 'managed_service_' : / - # Depending on the requested network - IndividualServices: - type: OS::Heat::Value - properties: - value: - yaql: - expression: let(fqdns => $.data.fqdns) -> dict(coalesce($.data.metadata, []).where($ != null and $.type = 'vip').select([concat('managed_service_', $.service, $.network), concat($.service, '/', $fqdns.get($.network))])) - data: - metadata: {get_attr: [IncomingMetadataSettings, value]} - fqdns: - external: {get_param: CloudName} - internal_api: {get_param: CloudNameInternal} - storage: {get_param: CloudNameStorage} - storage_mgmt: {get_param: CloudNameStorageManagement} - ctlplane: {get_param: CloudNameCtlplane} - - CompactServices: - type: OS::Heat::Value - properties: - value: - yaql: - expression: dict(coalesce($.data, []).where($ != null and $.type = 'node').select([$.service, $.network.replace('_', '')]).groupBy($[0], $[1])) - data: {get_attr: [IncomingMetadataSettings, value]} - -outputs: - metadata: - description: actual metadata entries that will be passed to the server. - value: - map_merge: - - {get_attr: [IndividualServices, value]} - - compact_services: {get_attr: [CompactServices, value]} -- cgit 1.2.3-korg