From 600b8a137035034e7716a1fec564ca8338fbf755 Mon Sep 17 00:00:00 2001 From: Balazs Szekeres Date: Mon, 7 Oct 2019 11:59:18 +0200 Subject: [PATCH] Set node role for kubernetes cluster members Change-Id: I8c5acf9d828b888511f8a57289c34f84f03cf758 Signed-off-by: Balazs Szekeres --- ansible/playbooks/set_nodes_label.yaml | 22 ++++++++++++++++++++++ ansible/roles/set_nodes_label/tasks/main.yml | 18 ++++++++++++++++++ caas-kubernetes.spec | 4 +++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 ansible/playbooks/set_nodes_label.yaml create mode 100644 ansible/roles/set_nodes_label/tasks/main.yml diff --git a/ansible/playbooks/set_nodes_label.yaml b/ansible/playbooks/set_nodes_label.yaml new file mode 100644 index 0000000..e5110b1 --- /dev/null +++ b/ansible/playbooks/set_nodes_label.yaml @@ -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 index 0000000..2592084 --- /dev/null +++ b/ansible/roles/set_nodes_label/tasks/main.yml @@ -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 }}" + diff --git a/caas-kubernetes.spec b/caas-kubernetes.spec index d665a83..762f775 100644 --- a/caas-kubernetes.spec +++ b/caas-kubernetes.spec @@ -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 -- 2.16.6