Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Add PriorityClass support to ComputeClasses #1815

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

tylerslaton
Copy link
Contributor

@tylerslaton tylerslaton commented Jun 20, 2023

With this PR, ComputeClasses now come with a new field, PriorityClassName. This allows users create ComputeClasses to define a PriorityClass that will get set on all Pods using the ComputeClass.

Checklist

  • The title of this PR would make a good line in Acorn's Release Note's Changelog
  • The title of this PR ends with a link to the main issue being address in parentheses, like: This is a title (#1216). Here's an example
  • All relevant issues are referenced in the PR description. NOTE: don't use GitHub keywords that auto-close issues
  • Commits follow contributing guidance
  • Automated tests added to cover the changes. If tests couldn't be added, an explanation is provided in the Verification and Testing section
  • Changes to user-facing functionality, API, CLI, and upgrade impacts are clearly called out in PR description
  • PR has at least two approvals before merging (or a reasonable exception, like it's just a docs change)

@tylerslaton tylerslaton force-pushed the priority-class-support branch 3 times, most recently from dca4b09 to a5a7bb7 Compare June 20, 2023 16:42
@tylerslaton tylerslaton marked this pull request as ready for review June 20, 2023 17:24
pkg/install/role.yaml Outdated Show resolved Hide resolved
Comment on lines 43 to 48
// If a PriorityClass is specified, validate it exists
if cc.PriorityClassName != "" {
if err := s.client.Get(ctx, kclient.ObjectKey{Name: cc.PriorityClassName, Namespace: ""}, &schedulingv1.PriorityClass{}); err != nil {
return append(result, field.Invalid(field.NewPath("spec", "priorityClassName"), cc.PriorityClassName, err.Error()))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to validate this on create? There are other instances where we don't validate such things. For example, we don't validate that a storage class exists when a volume class is created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah so I had a similar thought. My thought process went slightly different so please let me know what you think.

If the PriorityClass isn't validated here, it is validated on App creation (like memory, cpu, etc is now). What felt different about that situation is that it felt off for an App to fail creation because a ComputeClass references a non-existent/misconfigured PriorityClass. What does feel weird about this is if a PriorityClass gets deleted after a ComputeClass gets created. In that event I added some controller logic on the App to verify that PriorityClass exists.

Copy link
Contributor

Choose a reason for hiding this comment

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

Volume classes are similar. A volume class can reference any storage class it wants; we don't validate that on creation of the volume class.

If the storage class doesn't exist, then the app will fail when it is created because Kubernetes won't be able to find the storage class. It may not return an error, but it will hang forever because the volume won't be created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I agree with you here then. I've removed the API Server validation. The controller already had logic to check if the PriorityClass exists, do you think that should be removed as well in favor of just letting the Pods create?

Signed-off-by: tylerslaton <mtslaton1@gmail.com>
@tylerslaton tylerslaton merged commit 63cbf08 into acorn-io:main Jun 23, 2023
3 checks passed
@tylerslaton tylerslaton deleted the priority-class-support branch June 23, 2023 15:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants