Skip to content

Commit

Permalink
Merge pull request #45 from vexxhost/set-node-selector-capi
Browse files Browse the repository at this point in the history
feat: Set node selector for CAPI components
  • Loading branch information
mnaser authored Jul 26, 2023
2 parents 4f4f687 + 14f1159 commit ca9a335
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions molecule/cluster-api/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ provisioner:
operator:
replicas: 1
controllers:
cluster_api_node_selector:
kubernetes.io/os: linux
keepalived_interface: "{{ ansible_facts['default_ipv4'].interface }}"
keepalived_vip: 172.17.0.100
keepalived_vrid: 42
Expand Down
2 changes: 2 additions & 0 deletions roles/cluster_api/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ cluster_api_control_plane_version: 1.4.4

cluster_api_infrastructure_provider: openstack
cluster_api_infrastructure_version: 0.7.1

cluster_api_node_selector: {}
3 changes: 3 additions & 0 deletions roles/cluster_api/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@
- name: Upgrade Cluster API
ansible.builtin.import_tasks: upgrade.yml
when: cluster_api_providers.resources | length != 0

- name: Patch Cluster API
ansible.builtin.import_tasks: patch.yml
36 changes: 36 additions & 0 deletions roles/cluster_api/tasks/patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2023 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.

- name: Set node selector for Cluster API components
kubernetes.core.k8s:
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ item.name }}"
namespace: "{{ item.namespace }}"
spec:
template:
spec:
nodeSelector: "{{ cluster_api_node_selector }}"
wait: true
loop:
- namespace: capi-kubeadm-bootstrap-system
name: capi-kubeadm-bootstrap-controller-manager
- namespace: capi-kubeadm-control-plane-system
name: capi-kubeadm-control-plane-controller-manager
- namespace: capi-system
name: capi-controller-manager
- namespace: capo-system
name: capo-controller-manager

0 comments on commit ca9a335

Please sign in to comment.