-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move ResourceRequirement to a separate file
Signed-off-by: Dong Beiqing <[email protected]>
- Loading branch information
1 parent
24a2a0e
commit 25e246a
Showing
5 changed files
with
38 additions
and
31 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package v1 | ||
|
||
func (cm *ClusterManager) GetResourceRequirement() *ResourceRequirement { | ||
return cm.Spec.ResourceRequirement | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package v1 | ||
|
||
func (k *Klusterlet) GetResourceRequirement() *ResourceRequirement { | ||
return k.Spec.ResourceRequirement | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package v1 | ||
|
||
import corev1 "k8s.io/api/core/v1" | ||
|
||
type ResourceRequirementAcquirer interface { | ||
GetResourceRequirement() *ResourceRequirement | ||
} | ||
|
||
// ResourceRequirement allow user override the default pod QoS classes | ||
type ResourceRequirement struct { | ||
// +kubebuilder:validation:Enum=Default;BestEffort;ResourceRequirement | ||
// +kubebuilder:default:=Default | ||
Type ResourceQosClass `json:"type"` | ||
// ResourceRequirements defines resource requests and limits when Type is ResourceQosClassResourceRequirement | ||
// +optional | ||
ResourceRequirements *corev1.ResourceRequirements `json:"resourceRequirements,omitempty"` | ||
} | ||
|
||
type ResourceQosClass string | ||
|
||
const ( | ||
// Default use resource setting in the template file (with requests but no limits in the resources) | ||
ResourceQosClassDefault ResourceQosClass = "Default" | ||
// If all containers in the pod don't set resource request and limits, the pod is treated as BestEffort. | ||
ResourceQosClassBestEffort ResourceQosClass = "BestEffort" | ||
// Configurable resource requirements with requests and limits | ||
ResourceQosClassResourceRequirement ResourceQosClass = "ResourceRequirement" | ||
) |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.