TenantConfig moved to post infra chart installation.
Change-Id: I40a5d2ca5c3ec8eb6cd82385bde41e6760611aff
Signed-off-by: Krisztian Lengyel <krisztian.lengyel@nokia.com>
%define COMPONENT infra-charts
%define RPM_NAME caas-%{COMPONENT}
%define RPM_MAJOR_VERSION 1.0.0
-%define RPM_MINOR_VERSION 29
+%define RPM_MINOR_VERSION 30
Name: %{RPM_NAME}
Version: %{RPM_MAJOR_VERSION}
mkdir -p %{buildroot}/%{_roles_path}/
rsync -av ansible/roles/install_caas_infra %{buildroot}/%{_roles_path}/
rsync -av ansible/roles/pre_install_caas_infra %{buildroot}/%{_roles_path}/
+rsync -av ansible/roles/post_install_caas_infra %{buildroot}/%{_roles_path}/
rsync -av ansible/roles/infra_chart_reconfig %{buildroot}/%{_roles_path}/
mkdir -p %{buildroot}/%{_caas_chart_path}/
%define COMPONENT instantiate
%define RPM_NAME caas-%{COMPONENT}
%define RPM_MAJOR_VERSION 1.0.0
-%define RPM_MINOR_VERSION 17
+%define RPM_MINOR_VERSION 18
Name: %{RPM_NAME}
Version: %{RPM_MAJOR_VERSION}
become_user: "{{ users.admin_user_name }}"
roles:
- install_caas_infra
+
+- hosts: caas_master
+ strategy: free
+ become: true
+ become_user: "{{ users.admin_user_name }}"
+ roles:
+ - post_install_caas_infra
--- /dev/null
+---
+# Copyright 2019 Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+caas_provider_network_profiles: "{{ network_profiles | filter_network_profiles_by_type('provider_network_interfaces', 'caas') }}"
+caas_sriov_network_profiles: "{{ network_profiles | filter_network_profiles_by_type('sriov_provider_networks', 'caas') }}"
+
+attached_caas_provider_network_profiles: "{{ hosts[hostname]['network_profiles'] | intersect(caas_provider_network_profiles.keys()) }}"
+attached_caas_sriov_network_profiles: "{{ hosts[hostname]['network_profiles'] | intersect(caas_sriov_network_profiles.keys()) }}"
+all_attached_caas_provider_network_profiles: "{{ attached_caas_provider_network_profiles | union(attached_caas_sriov_network_profiles) }}"
--- /dev/null
+---
+# Copyright 2019 Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+- name: template DANM tenant configs
+ template:
+ src: "danm_tenant_config.yaml.j2"
+ dest: "{{ caas.manifests_directory }}/danm-tenant-config.yaml"
+
+- name: create DANM tenant configs
+ kubectl:
+ manifest: "{{ caas.manifests_directory }}/danm-tenant-config.yaml"
+ state: present
--- /dev/null
+#jinja2: lstrip_blocks: True
+{#
+Copyright 2019 Nokia
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+#}
+{%- macro make_host_devices(devices, provider_network) %}
+ {% for device in devices %}
+- name: {{ device }}
+ {{ make_vni_config(provider_network) | indent(2) }}
+ {% endfor %}
+{% endmacro -%}
+
+{%- macro make_vni_config(provider_network) %}
+ {% set vlan_ranges = provider_network.get('vlan_ranges', '') %}
+ {% set vxlan_ranges = provider_network.get('vxlan_ranges', '') %}
+ {% if vlan_ranges %}
+vniType: vlan
+vniRange: {{ vlan_ranges | replace(':', '-') }}
+ {% elif vxlan_ranges %}
+vniType: vxlan
+vniRange: {{ vxlan_ranges | replace(':', '-') }}
+ {% endif %}
+{% endmacro -%}
+
+---
+apiVersion: danm.k8s.io/v1
+kind: TenantConfig
+metadata:
+ name: danm-tenant-config
+hostDevices:
+{% caas_tenant_networks = caas.get('tenant_networks', []) %}
+{% if all_attached_caas_provider_network_profiles and caas_tenant_networks %}
+ {% for profile_name in all_attached_caas_provider_network_profiles %}
+ {% set profile = network_profiles[profile_name] %}
+ {% set caas_provider_networks = profile.get('provider_network_interfaces', {}) | filter_provider_networks_by_type('caas') %}
+ {% set caas_sriov_provider_networks = profile.get('sriov_provider_networks', {}) | filter_provider_networks_by_type('caas') %}
+ {% for tenant_network in caas_tenant_networks %}
+ {% if tenant_network in caas_provider_networks | get_provider_networks %}
+ {{ make_host_devices(caas_provider_networks.keys(), networking['provider_networks'][tenant_network]) | indent(2) -}}
+ {% elif tenant_network in caas_sriov_provider_networks %}
+ {% set sriov_interaces = caas_sriov_provider_networks | extract_sriov_provider_network_interfaces %}
+ {% set sriov_device_pools = sriov_interaces | map('regex_replace', '(.*)', 'nokia.k8s.io/sriov_\\1') | list %}
+ {{ make_host_devices(sriov_device_pools, networking['provider_networks'][tenant_network]) | indent(2) -}}
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+{%- else %}
+ []
+{% endif %}
+networkIds:
+ flannel: flannel