Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To automate Region and Zone labels #163

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/install_vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ fips_compliant: false

rsct_image: "quay.io/powercloud/rsct-ppc64le:latest"

node_labels: {}

chronyconfig:
enabled: false
content:
Expand Down
6 changes: 5 additions & 1 deletion playbooks/roles/ocp-customization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Use this to modify kernel tunables for nodes/pods via [tuned operator](https://d
Use this to deploy containerized version of [RSCT](https://www.ibm.com/support/knowledgecenter/SGVKBA) on every OCP node running on PowerVM infrastructure.
This is enabled by default when deploying OCP in PowerVM or PowerVS. Follow the instructions provided [here](/docs/rsct-deploy.md) to deploy RSCT on an existing OCP cluster.

**4. Automate setting of Node Labels**

Use this to automate setting of Node Labels on PowerVS. This refers to the [Well-known Labels document](https://kubernetes.io/docs/reference/labels-annotations-taints).

Requirements
------------

Expand All @@ -32,7 +36,7 @@ Role Variables
| sysctl_tuned_options | no | false | Set to true to apply sysctl options via tuned operator |
| powervm_rmc | no | true | Set to true to deploy RMC daemonset on Node with arch ppc64le |
| rsct_image | no | quay.io/powercloud/rsct-ppc64le:latest | Change to your own registry if you install without internet connection |

| node_labels | no | {} | Map of node labels and its values |

If `sysctl_tuned_options` is true then the following variables are must and should be set in [vars/tuned.yaml](./vars/tuned.yaml)

Expand Down
1 change: 1 addition & 0 deletions playbooks/roles/ocp-customization/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ rhcos_kernel_options: []
sysctl_tuned_options: false
powervm_rmc: true
rsct_image: "quay.io/powercloud/rsct-ppc64le:latest"
node_labels: {}
4 changes: 4 additions & 0 deletions playbooks/roles/ocp-customization/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@
loop:
- master
- worker

- name: Automate Node Labels
when: node_labels
import_tasks: node-label.yaml
14 changes: 14 additions & 0 deletions playbooks/roles/ocp-customization/tasks/node-label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Get all Nodes
shell: "oc get nodes | awk '(NR>1) { print $1 }'"
register: node_names

- name: Automate Node labels
k8s:
state: present
kind: Node
name: "{{ item }}"
definition:
metadata:
labels: "{{ node_labels }}"
with_items: "{{ node_names.stdout_lines }}"