Skip to content

Commit

Permalink
Merge pull request #33 from matthewei/main
Browse files Browse the repository at this point in the history
✨ allow Ironic to set nodeSelector
  • Loading branch information
metal3-io-bot committed Apr 29, 2024
2 parents b24f908 + c8558e9 commit 3c87152
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
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"`
}

// 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
}

0 comments on commit 3c87152

Please sign in to comment.