helm-charts/playbooks/node-labeler/run.yaml
okozachenko d3f81d5c4a Add node-labeler helm chart
Change-Id: I286c283272a86eff81b479a9dad29eb2d958fecc
2020-07-21 18:27:15 +03:00

41 lines
1.4 KiB
YAML
Executable File

---
# Copyright (c) 2020 VEXXHOST, Inc.
#
# 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.
- hosts: all
tasks:
- name: Get node name
shell: kubectl get nodes -o=name | head -1
register: _node_name
until: _node_name is success
retries: 60
delay: 5
failed_when: |
{{ _node_name.stdout_lines | length == 0 }}
- name: Get the node labels
shell: kubectl label {{ _node_name.stdout }} --list
register: _node_labels
- name: Check the label node.vexxhost.com/vendor is set
fail:
msg: node.vexxhost.com/vendor label is missing.
when: (_node_labels.stdout is search('node.vexxhost.com/vendor'))==False
- name: Check the label node.vexxhost.com/product is set
fail:
msg: node.vexxhost.com/product label is missing.
when: (_node_labels.stdout is search('node.vexxhost.com/product'))==False