Enhance RPM build 22/622/6
authorKrisztian Lengyel <krisztian.lengyel@nokia.com>
Mon, 29 Apr 2019 13:03:49 +0000 (15:03 +0200)
committerKrisztian Lengyel <krisztian.lengyel@nokia.com>
Wed, 15 May 2019 16:29:20 +0000 (12:29 -0400)
- Replace hardcoded paths with variables
- Set CM CaaS config variables by rpm build variables

Change-Id: Ia0226735253412ea9fd1a25517716ac22734bebc
Depends-On: I2969223948218155aff121c20731eb336c13fca6
Signed-off-by: Krisztian Lengyel <krisztian.lengyel@nokia.com>
.gitreview [new file with mode: 0644]
SPECS/infra-charts.spec
SPECS/instantiate.spec
SPECS/utils.spec
ansible/roles/install_caas_infra/tasks/main.yaml
ansible/roles/pre_config_all/tasks/main.yml
cm_config/caas.yaml

diff --git a/.gitreview b/.gitreview
new file mode 100644 (file)
index 0000000..ca28c68
--- /dev/null
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.akraino.org
+port=29418
+project=ta/caas-install
+defaultremote=origin
index d5986cb..5c3d714 100644 (file)
@@ -16,7 +16,6 @@
 %define RPM_NAME caas-%{COMPONENT}
 %define RPM_MAJOR_VERSION 1.0.0
 %define RPM_MINOR_VERSION 1
-%define CHART_DIR /var/lib/caas/infra-charts/
 
 Name:           %{RPM_NAME}
 Version:        %{RPM_MAJOR_VERSION}
@@ -43,13 +42,13 @@ 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}/
 
-mkdir -p %{buildroot}/%{CHART_DIR}/
-rsync -av infra-charts/* %{buildroot}/%{CHART_DIR}/
+mkdir -p %{buildroot}/%{_caas_chart_path}/
+rsync -av infra-charts/* %{buildroot}/%{_caas_chart_path}/
 
 %files
 %{_playbooks_path}/*
 %{_roles_path}/*
-%{CHART_DIR}/*
+%{_caas_chart_path}/*
 
 
 %preun
index 2465b0f..f08e048 100644 (file)
@@ -57,26 +57,37 @@ rsync -av ansible/roles/manifests %{buildroot}/%{_roles_path}/
 rsync -av ansible/roles/nodeconf %{buildroot}/%{_roles_path}/
 rsync -av ansible/roles/pre_config_all %{buildroot}/%{_roles_path}/
 
-mkdir -p %{buildroot}%_platform_etc_path/playbooks/bootstrapping/
+mkdir -p %{buildroot}%/%{_bootstrapping_path}/
 
-mkdir -p %{buildroot}%/etc/lcm/playbooks/installation/provisioning/
+mkdir -p %{buildroot}%/%{_provisioning_path}/
 
-mkdir -p %{buildroot}/etc/ansible/roles/plugins/filter/
-rsync -av ansible/filter_plugins/* %{buildroot}/etc/ansible/roles/plugins/filter/
+mkdir -p %{buildroot}/%{_ansible_filter_plugins_path}/
+rsync -av ansible/filter_plugins/* %{buildroot}/%{_ansible_filter_plugins_path}/
 
-mkdir -p %{buildroot}/etc/ansible/roles/plugins/library/
-rsync -av ansible/library/* %{buildroot}/etc/ansible/roles/plugins/library/
+mkdir -p %{buildroot}/%{_ansible_modules_path}/
+rsync -av ansible/library/* %{buildroot}/%{_ansible_modules_path}/
 
-mkdir -p %{buildroot}/etc/cmframework/config
-rsync -av cm_config/caas.yaml %{buildroot}/etc/cmframework/config/caas.yaml
+mkdir -p %{buildroot}/%{_cm_config_dir}
+rsync -av cm_config/caas.yaml %{buildroot}/%{_cm_caas_config_file}
 
+# Set build variable to CaaS config
+## Rename variable
+sed -ri 's/^crf_chart_path/caas_chart_path/' %{buildroot}/%{_cm_caas_config_file}
+
+## Set config values
+sed -ri '/^caas_base_directory/{s|:.*|: %{_caas_path}|}'                       %{buildroot}/%{_cm_caas_config_file}
+sed -ri '/^infra_containers_directory/{s|:.*|: %{_caas_container_tar_path}|}'  %{buildroot}/%{_cm_caas_config_file}
+sed -ri '/^manifests_directory/{s|:.*|: %{_caas_manifest_path}|}'              %{buildroot}/%{_cm_caas_config_file}
+sed -ri '/^rbac_manifests_directory/{s|:.*|: %{_caas_rbac_manifests_path}|}'   %{buildroot}/%{_cm_caas_config_file}
+sed -ri '/^caas_chart_path/{s|:.*|: %{_caas_chart_path}|}'                     %{buildroot}/%{_cm_caas_config_file}
+sed -ri '/^libexec_dir/{s|:.*|: %{_caas_libexec_path}|}'                       %{buildroot}/%{_cm_caas_config_file}
 
 %files
 %{_playbooks_path}/*
 %{_roles_path}/*
-/etc/ansible/roles/plugins/filter/*
-/etc/ansible/roles/plugins/library/*
-/etc/cmframework/config/*
+%{_ansible_filter_plugins_path}/*
+%{_ansible_modules_path}/*
+%{_cm_config_dir}/*
 
 
 %preun
index d504dfe..9b60216 100644 (file)
@@ -16,7 +16,6 @@
 %define RPM_NAME caas-%{COMPONENT}
 %define RPM_MAJOR_VERSION 1.0.0
 %define RPM_MINOR_VERSION 1
-%define LIBEXEC_DIR /usr/libexec/nokia/
 %define KUBELET_PLUGINS_LOGDIR /var/log/kubelet-plugins/
 
 Name:           %{RPM_NAME}
@@ -40,24 +39,24 @@ This rpm contains the supplementary utils for caas subsystem.
 %build
 
 %install
-mkdir -p %{buildroot}/%{LIBEXEC_DIR}/
+mkdir -p %{buildroot}/%{_caas_libexec_path}/
 # --------------------------- LOG
 mkdir -p %{buildroot}/etc/logrotate.d/
 install -m 0640 utils/log/kubelet-plugins %{buildroot}/etc/logrotate.d/
 sed -i -e 's|{{ kubelet_plugings_log_dir }}|%{KUBELET_PLUGINS_LOGDIR}|g' %{buildroot}/etc/logrotate.d/kubelet-plugins
 # --------------------------- DEPLOY
-install -m 0700 utils/deploy/merge_image.sh %{buildroot}/%{LIBEXEC_DIR}/
+install -m 0700 utils/deploy/merge_image.sh %{buildroot}/%{_caas_libexec_path}/
 mkdir -p %{buildroot}/etc/systemd/system/
 # --------------------------- COMMON
 mkdir -p %{buildroot}/etc/profile.d/
 install -m 0644 utils/common/aliases.sh %{buildroot}/etc/profile.d/
 
 %files
-%{LIBEXEC_DIR}/merge_image.sh
+%{_caas_libexec_path}/merge_image.sh
 /etc/profile.d/aliases.sh
 /etc/logrotate.d/kubelet-plugins
-%exclude %{LIBEXEC_DIR}/*pyc
-%exclude %{LIBEXEC_DIR}/*pyo
+%exclude %{_caas_libexec_path}/*pyc
+%exclude %{_caas_libexec_path}/*pyo
 
 %preun
 
index f2378f0..b8c69a9 100644 (file)
@@ -25,7 +25,7 @@
     chart_file: "{{ lookup('file', '{{ caas.caas_chart_path}}/Chart.yaml') | from_yaml }}"
 
 - name: create chart tgz
-  shell: "tar -C {{ caas.caas_chart_path | dirname }} -cvzf {{ infra_chart_name }}-{{ chart_file.version }}.tgz {{ caas.caas_chart_path | basename }}"
+  shell: "tar -C {{ caas.caas_chart_path.rstrip('/') | dirname }} -cvzf {{ infra_chart_name }}-{{ chart_file.version }}.tgz {{ caas.caas_chart_path.rstrip('/') | basename }}"
 
 - name: upload individual charts to chart repo
   shell: "curl -sS -XPOST -H 'Content-Type: application/gzip' --data-binary @{{ infra_chart_name }}-{{ chart_file.version }}.tgz {{ caas.chart_repo }}/charts/{{ infra_chart_name }}-{{ chart_file.version }}.tgz"
index 596f721..f074452 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-- name: create nokia directory
-  file:
-    path: /usr/libexec/nokia/tmp
-    state: directory
-    mode: 0700
-  become: true
-  become_user: "root"
-
 - name: create the /etc/openssl directory
   file:
     path: "/etc/openssl"
     state: present
   become_user: "root"
 
-- name: adding acl for cloud_admin_user for /usr/libexec/nokia/merge_image.sh
+- name: adding acl for cloud_admin_user for merge_image.sh
   acl:
     entity: "{{ users.admin_user_name }}"
     etype: user
-    path: "/usr/libexec/nokia/merge_image.sh"
+    path: "{{ caas.libexec_dir }}/merge_image.sh"
     permissions: "rx"
     recursive: yes
     state: present
index e88f40d..75c85df 100644 (file)
@@ -23,6 +23,7 @@ caas_base_directory: "/var/lib/caas"
 infra_containers_directory: "{{ caas_base_directory }}/images"
 manifests_directory: "{{ caas_base_directory }}/manifests"
 registry_directory: /var/lib/registry
+libexec_dir: /usr/libexec/caas
 apiserver_in_hosts: apiserver.{{ dns_domain }}
 etcd_api_port: 4111
 etcd_peer_port: 4112