Skip to content

Commit cab1d3d

Browse files
larainemamnaserclaude
authored
feat: Set node selector for ORC components (#206)
* feat: Set node selector for ORC components Signed-off-by: Dong Ma <[email protected]> * update patch with kustomization Signed-off-by: Dong Ma <[email protected]> * refactor: Use kustomize module and strategic merge patch for node selector Replace shell command with vexxhost.kubernetes.kustomize module for better change detection and idempotency. Switch from JSON patch to strategic merge patch, which is the idiomatic kustomize approach for modifying Kubernetes resources. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Mohammed Naser <[email protected]> * refactor: Remove unnecessary metadata.name from patch Since we're using a target selector, the metadata.name field is not needed in the strategic merge patch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Mohammed Naser <[email protected]> * fix: Add placeholder name to strategic merge patch Kustomize requires a metadata.name field in strategic merge patches to properly recognize the patch format, even when using target selectors. Tested: Verified that nodeSelector is correctly applied to Deployment resources. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Mohammed Naser <[email protected]> * refactor: Move patches key outside conditional block Move the patches: key outside the if block to allow for adding other patches in the future while still conditionally including the node selector patch only when needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Mohammed Naser <[email protected]> --------- Signed-off-by: Dong Ma <[email protected]> Signed-off-by: Mohammed Naser <[email protected]> Co-authored-by: Mohammed Naser <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 26eaa1e commit cab1d3d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

roles/openstack_resource_controller/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ openstack_resource_controller_kustomize_directory: /usr/local/src/openstack-reso
1010

1111
openstack_resource_controller_build_directory: "/usr/local/src/openstack-resource-controller-{{ openstack_resource_controller_version }}"
1212
openstack_resource_controller_build_file: "{{ openstack_resource_controller_build_directory }}/manifests.yaml"
13+
14+
openstack_resource_controller_node_selector: {}

roles/openstack_resource_controller/templates/kustomization.yaml.j2

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,19 @@ images:
55
- name: controller
66
newName: {{ openstack_resource_controller_image }}
77
newTag: {{ openstack_resource_controller_image_tag }}
8+
9+
patches:
10+
{% if openstack_resource_controller_node_selector %}
11+
- target:
12+
kind: Deployment
13+
patch: |-
14+
apiVersion: apps/v1
15+
kind: Deployment
16+
metadata:
17+
name: placeholder
18+
spec:
19+
template:
20+
spec:
21+
nodeSelector:
22+
{{ openstack_resource_controller_node_selector | to_nice_yaml | indent(14, first=True) }}
23+
{% endif %}

0 commit comments

Comments
 (0)