Set node role for kubernetes cluster members 43/1743/2
authorBalazs Szekeres <balazs.szekeres@nokia.com>
Mon, 7 Oct 2019 09:59:18 +0000 (11:59 +0200)
committerBalazs Szekeres <balazs.szekeres@nokia.com>
Tue, 8 Oct 2019 07:53:55 +0000 (09:53 +0200)
Change-Id: I8c5acf9d828b888511f8a57289c34f84f03cf758
Signed-off-by: Balazs Szekeres <balazs.szekeres@nokia.com>
ansible/playbooks/set_nodes_label.yaml [new file with mode: 0644]
ansible/roles/set_nodes_label/tasks/main.yml [new file with mode: 0644]
caas-kubernetes.spec

diff --git a/ansible/playbooks/set_nodes_label.yaml b/ansible/playbooks/set_nodes_label.yaml
new file mode 100644 (file)
index 0000000..e5110b1
--- /dev/null
@@ -0,0 +1,22 @@
+---
+# 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.
+
+# cmframework.requires:  bootstrap_kube_proxy.yaml
+- hosts: caas_nodes
+  strategy: free
+  become: true
+  become_user: "root"
+  roles:
+    - role: set_nodes_label
diff --git a/ansible/roles/set_nodes_label/tasks/main.yml b/ansible/roles/set_nodes_label/tasks/main.yml
new file mode 100644 (file)
index 0000000..2592084
--- /dev/null
@@ -0,0 +1,18 @@
+---
+# 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: set node role for cluster member
+  shell: "kubectl label node {{ networking.infra_internal.ip }} kubernetes.io/role={{ noderole }}"
+
index d665a83..762f775 100644 (file)
@@ -15,7 +15,7 @@
 %define COMPONENT kubernetes
 %define RPM_NAME caas-%{COMPONENT}
 %define RPM_MAJOR_VERSION 1.16.0
-%define RPM_MINOR_VERSION 5
+%define RPM_MINOR_VERSION 6
 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION}
 %define KUBERNETESPAUSE_VERSION 3.1
 
@@ -160,6 +160,7 @@ ln -s %{_playbooks_path}/master_kube_proxy.yaml             %{_postconfig_path}/
 ln -s %{_playbooks_path}/master_kubelet.yaml                %{_postconfig_path}/
 ln -s %{_playbooks_path}/service_account_creation.yaml      %{_postconfig_path}/
 ln -s %{_playbooks_path}/service_account_distribution.yaml  %{_postconfig_path}/
+ln -s %{_playbooks_path}/set_nodes_label.yaml               %{_postconfig_path}/
 
 %postun
 if [ $1 -eq 0 ]; then
@@ -175,6 +176,7 @@ if [ $1 -eq 0 ]; then
   rm -f %{_postconfig_path}/master_kubelet.yaml
   rm -f %{_postconfig_path}/service_account_creation.yaml
   rm -f %{_postconfig_path}/service_account_distribution.yaml
+  rm -f %{_postconfig_path}/set_nodes_label.yaml
 fi
 
 %clean