-
Notifications
You must be signed in to change notification settings - Fork 71
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
feat: Add ACI Spot virtual nodes support to virtual kubelet #192
Open
telotlik
wants to merge
28
commits into
virtual-kubelet:master
Choose a base branch
from
telotlik:telotlik/VKACISpotContainers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
63da061
Add priority as annotation to use spot containers for virtual kubelet
telotlik 151530d
Add new test to validate null priority
telotlik d8fda88
Updating priority check in pod annotation
telotlik 74fd22c
Update tests and add priority annotation const
telotlik 3f23906
Update priority string check
telotlik d803498
Iterate on ACI Spot CG on Virtual Kubelets - new function for propert…
suselva b3bc432
Merge pull request #1 from telotlik/users/suselva/aci-spot
suselva cc15b33
api version when using priority
fnuarnav c0e15d8
update: set apiVersion based on extensible list of Tags
fnuarnav fb1a943
use VersioProvider to check ContainerGroupProperties
fnuarnav bbc2355
fix indentation; validate version format
fnuarnav c4c3b0a
Revert "fix indentation; validate version format"
fnuarnav bc57388
version set in code follows correct format
fnuarnav 49c3e26
added unit tests for versioning
fnuarnav 2843053
update logging; use more c# style documentation comments
fnuarnav f2a006a
remove print stmt; log uri in create
fnuarnav 7f42078
fix indents
fnuarnav 2b1c322
use virtual-kubelet.io/priority; update comment
fnuarnav a35c90a
use tag name virtual-kubelet.io-proprity
fnuarnav b75b772
fix typo
fnuarnav bd6bc81
set priority Tag with correct values only when priority annotaiton is…
fnuarnav e222422
clean up code
fnuarnav d780b79
define priorityTagNae as a constant
fnuarnav 35334f6
Merge pull request #3 from telotlik/users/arnav/review-comments
fnuarnav 7c147e3
Merge remote-tracking branch 'upstream/master' into telotlik/VKACISpo…
fnuarnav 79ce469
Merge branch 'telotlik/VKACISpotContainers' into users/arnav/api-version
fnuarnav 9613c46
fixed typo in comment
fnuarnav 122d8bc
try adding parallelism to avoid timeout
fnuarnav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,10 @@ const ( | |
gpuTypeAnnotation = "virtual-kubelet.io/gpu-type" | ||
) | ||
|
||
const ( | ||
priorityTypeAnnotation = "priority" | ||
) | ||
|
||
const ( | ||
statusReasonPodDeleted = "NotFound" | ||
statusMessagePodDeleted = "The pod may have been deleted from the provider" | ||
|
@@ -657,6 +661,19 @@ func (p *ACIProvider) CreatePod(ctx context.Context, pod *v1.Pod) error { | |
containerGroup.Location = p.region | ||
containerGroup.RestartPolicy = aci.ContainerGroupRestartPolicy(pod.Spec.RestartPolicy) | ||
containerGroup.ContainerGroupProperties.OsType = aci.OperatingSystemTypes(p.operatingSystem) | ||
if pod.Annotations != nil { | ||
priority, priorityExists := pod.Annotations[priorityTypeAnnotation] | ||
if priorityExists { | ||
|
||
if strings.EqualFold(priority, string(aci.Spot)) { | ||
containerGroup.ContainerGroupProperties.Priority = aci.Spot | ||
} else if strings.EqualFold(priority, string(aci.Regular)) { | ||
containerGroup.ContainerGroupProperties.Priority = aci.Regular | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. won't this fail all the existing ones? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Validated that this change does not affect existing behavior |
||
return fmt.Errorf("The pod requires either Regular or Spot priority. Invalid value %s", priority) | ||
} | ||
} | ||
} | ||
|
||
// get containers | ||
containers, err := p.getContainers(pod) | ||
|
@@ -716,6 +733,7 @@ func (p *ACIProvider) CreatePod(ctx context.Context, pod *v1.Pod) error { | |
"Namespace": pod.Namespace, | ||
"UID": podUID, | ||
"CreationTimestamp": podCreationTimestamp, | ||
"Priority": pod.Annotations["priority"], | ||
} | ||
|
||
p.amendVnetResources(&containerGroup, pod) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string should be prefixed in some way in order to not conflict with potential annotations already in use by a customer pod for maximum compatibility with customers' existing pods. I suspect
priority
is a reasonably frequent "private" annotation.See for example
virtualKubeletDNSNameLabel
orgpuTypeAnnotation
.I'd say that an argument can be made that given how ACI-specific this is, we could "namespace" it even more specifically than just virtual kubelet, but at the very least, IMO, it should match the other annotation-based extensions here.