Skip to content

Commit 5b80702

Browse files
authored
Windows workers (#23)
* feat: pushed windows ansible roles * fix: truncate windows hostname * added windows nodes docs * remove unused playbooks * fix: fixed spacing
1 parent 65cbb5f commit 5b80702

File tree

2 files changed

+100
-2
lines changed

2 files changed

+100
-2
lines changed

docs/adding-windows-nodes.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Adding Windows Worker nodes to an openCenter Kubernetes cluster
2+
3+
## Requirements
4+
* A working openCenter cluster with at least 1 linux worker node.
5+
* Windows servers added to the oc_windows_workers group in the ansible inventory. Must be accessible via `SSH`. Yes SSH.
6+
*
7+
8+
9+
The main.tf file will require additional local variables and variables passed to the openTofu modules.
10+
11+
| Option | Default | Type | Description |
12+
| :------- | :------: | :-------: | -------: |
13+
| image_id_windows | "" | string | Glance image ID for Windows Server |
14+
| flavor_worker_windows | "" | string | Openstack Flavor name |
15+
| windows_user | "Administrator" | string | Admin user for Windows Server |
16+
| windows_admin_password | "" | String | Password for Admin user of Windows Server|
17+
| worker_node_bfv_size_windows | 0 | number | Volume Size of root disk for Windows Server |
18+
| worker_node_bfv_type_windows | "local" | string | Volume type. Can be either "local" or "volume" |
19+
20+
21+
The Openstack Nova module needs to get the values passed
22+
23+
```
24+
25+
source = "github.com/rackerlabs/openCenter-gitops-base.git//iac/cloud/openstack/openstack-nova?ref=main" {
26+
...
27+
size_worker_windows = {
28+
count = local.worker_count_windows
29+
flavor = local.flavor_worker_windows
30+
}
31+
windows_admin_password = local.windows_admin_password
32+
windows_user = local.windows_user
33+
worker_node_bfv_type_windows = local.worker_node_bfv_type_windows
34+
worker_node_bfv_size_windows = local.worker_node_bfv_size_windows
35+
}
36+
```
37+
38+
There is an ansible collection in `github.com/rackerlabs/opencenter-windows.git` that can be used to configure the windows nodes as workers and have them join the cluster.
39+
40+
Set the collections path to the local cluster inventory file.
41+
42+
```bash
43+
44+
source venv/bin/activate
45+
export ANSIBLE_COLLECTIONS_PATHS=${PWD}/inventory/
46+
export ANSIBLE_INVENTORY=${PWD}/inventory/inventory.yaml
47+
48+
```
49+
50+
requirements.yml
51+
52+
```yaml
53+
---
54+
collections:
55+
- name: https://github.com/rackerlabs/opencenter-windows.git
56+
type: git
57+
version: main
58+
```
59+
60+
Install the collection
61+
62+
```bash
63+
ansible-galaxy collection install -r requirements.yml
64+
```
65+
66+
windows-worker.yaml
67+
68+
```yaml
69+
- name: Join Windows to Kubernetes cluster
70+
hosts: oc_windows_nodes
71+
gather_facts: yes
72+
collections:
73+
- rackerlabs.opencenter_windows_workers
74+
tasks:
75+
- name: Gather variables for each operating system
76+
ansible.builtin.import_role:
77+
name: kubespray/roles/kubespray_defaults
78+
79+
- name: Setup win-containerd
80+
ansible.builtin.include_role:
81+
name: win-containerd
82+
83+
- name: Setup win-kubeadm
84+
ansible.builtin.include_role:
85+
name: win-kubeadm
86+
```
87+
88+
`ansible-playbook windows-workers.yaml`
89+
90+
## Post Join steps
91+
Taint the nodes to avoid confusing the scheduler
92+
`kubectl taint node mig-dev-win0 node.kubernetes.io/os=windows:NoSchedule`
93+
94+
95+
Once Calico has been deployed via the Tigera Operator the IPAM Config must get patched.
96+
97+
`kubectl patch ipamconfigurations default --type merge --patch='{"spec": {"strictAffinity": true}}'`
98+

iac/cloud/openstack/lib/openstack-compute-windows/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "openstack_networking_port_v2" "node" {
2-
name = "${var.naming_prefix}${var.node_type}${count.index}"
2+
name = "${substr(var.naming_prefix, 0, 8)}${var.node_type}${count.index}"
33
count = var.node_count
44
network_id = var.network_id
55

@@ -18,7 +18,7 @@ resource "openstack_networking_port_v2" "node" {
1818
}
1919

2020
resource "openstack_compute_instance_v2" "node" {
21-
name = "${var.naming_prefix}${var.node_type}${count.index}"
21+
name = "${substr(var.naming_prefix, 0, 8)}${var.node_type}${count.index}"
2222
config_drive = true # Windows needs config drive
2323
count = var.node_count
2424
flavor_name = var.flavor_name

0 commit comments

Comments
 (0)