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

Add support for Kubernetes arbitrary node selector #1370

Merged
merged 6 commits into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions bin/cml/runner/launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ const runCloud = async (opts) => {
cloudStartupScript: startupScript,
cloudAwsSecurityGroup: awsSecurityGroup,
cloudAwsSubnet: awsSubnet,
cloudKubernetesNodeSelector: kubernetesNodeSelector,
cloudImage: image,
workdir
} = opts;
Expand Down Expand Up @@ -172,6 +173,7 @@ const runCloud = async (opts) => {
startupScript,
awsSecurityGroup,
awsSubnet,
kubernetesNodeSelector,
image,
dockerVolumes
});
Expand Down Expand Up @@ -588,6 +590,20 @@ exports.options = kebabcaseKeys({
description: 'Specifies the subnet to use within AWS',
alias: 'cloud-aws-subnet-id'
},
cloudKubernetesNodeSelector: {
type: 'string',
dacbd marked this conversation as resolved.
Show resolved Hide resolved
default: 'accelerator=inferred',
dacbd marked this conversation as resolved.
Show resolved Hide resolved
description:
'Specifies the node selector to use within Kubernetes. By default, the node selector is inferred from the GPU configuration',
coerce: (val) => {
const [key, value] = val.split(/=(.+)/);

return {
key,
value
};
}
},
cloudImage: {
type: 'string',
description: 'Custom machine/container image',
Expand Down
6 changes: 5 additions & 1 deletion src/terraform.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ const iterativeCmlRunnerTpl = (opts = {}) => {
...(opts.sshPrivate && { ssh_private: opts.sshPrivate }),
...(opts.startupScript && { startup_script: opts.startupScript }),
...(opts.token && { token: opts.token }),
...(opts.type && { instance_type: opts.type })
...(opts.type && { instance_type: opts.type }),
...(opts.kubernetesNodeSelector && {
kubernetes_node_selector_key: opts.kubernetesNodeSelector.key,
kubernetes_node_selector_value: opts.kubernetesNodeSelector.value
})
}
}
}
Expand Down