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

✨ allow Ironic to set nodeSelector #33

Merged
merged 1 commit into from
Apr 29, 2024
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
5 changes: 5 additions & 0 deletions api/v1alpha1/ironic_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ type IronicSpec struct {
// RamdiskSSHKey is the contents of the public key to inject into the ramdisk for debugging purposes.
// +optional
RamdiskSSHKey string `json:"ramdiskSSHKey,omitempty"`
// NodeSelector is a selector which must be true for the Ironic pod to fit on a node.
// Selector which must match a node's labels for the vmi to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how this will work with the future distributed architecture... I guess it depends on how this architecture looks like.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact that the native kubernetes daemonset controller also support to config nodeSelector.

}

// IronicStatus defines the observed state of Ironic
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions config/crd/bases/metal3.io_ironics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ spec:
type: string
type: array
type: object
nodeSelector:
additionalProperties:
type: string
description: |-
NodeSelector is a selector which must be true for the Ironic pod to fit on a node.
Selector which must match a node's labels for the vmi to be scheduled on that node.
More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
type: object
ramdiskExtraKernelParams:
description: |-
RamdiskExtraKernelParams is a string with kernel parameters to pass to the provisioning/inspection ramdisk.
Expand Down
5 changes: 3 additions & 2 deletions pkg/ironic/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,9 @@ func newIronicPodTemplate(ironic *metal3api.Ironic, db *metal3api.IronicDatabase
InitContainers: initContainers,
Volumes: volumes,
// Ironic needs to be accessed by external machines
HostNetwork: true,
DNSPolicy: corev1.DNSClusterFirstWithHostNet,
HostNetwork: true,
DNSPolicy: corev1.DNSClusterFirstWithHostNet,
NodeSelector: ironic.Spec.NodeSelector,
},
}, nil
}
Loading