This repository was archived by the owner on Apr 17, 2025. It is now read-only.
generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 115
Import HRQ into HNC (disabled by default) #183
Merged
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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,69 @@ | ||
package v1alpha2 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
const ( | ||
// HRQLabelCleanup is added to resources created by HRQ (specifically the RQ | ||
// singletons) for easier cleanup later by a selector. | ||
HRQLabelCleanup = MetaGroup + "/hrq" | ||
|
||
// NonPropagateAnnotation is added to RQ singletons so that they are not | ||
// overwritten by ancestors. | ||
NonPropagateAnnotation = AnnotationPropagatePrefix + "/none" | ||
|
||
// EventCannotWriteResourceQuota is for events when the reconcilers cannot | ||
// write ResourceQuota from an HRQ. Usually it means the HRQ has invalid | ||
// resource quota types. The error message will point to the HRQ object. | ||
EventCannotWriteResourceQuota string = "CannotWriteResourceQuota" | ||
) | ||
|
||
// HierarchicalResourceQuotaSpec defines the desired hard limits to enforce for | ||
// a namespace and descendant namespaces | ||
type HierarchicalResourceQuotaSpec struct { | ||
// Hard is the set of desired hard limits for each named resource | ||
// +optional | ||
Hard corev1.ResourceList `json:"hard,omitempty"` | ||
} | ||
|
||
// HierarchicalResourceQuotaStatus defines the enforced hard limits and observed | ||
// use for a namespace and descendant namespaces | ||
type HierarchicalResourceQuotaStatus struct { | ||
// Hard is the set of enforced hard limits for each named resource | ||
// +optional | ||
Hard corev1.ResourceList `json:"hard,omitempty"` | ||
// Used is the current observed total usage of the resource in the namespace | ||
// and its descendant namespaces. | ||
// +optional | ||
Used corev1.ResourceList `json:"used,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=hierarchicalresourcequotas,shortName=hrq,scope=Namespaced | ||
|
||
// HierarchicalResourceQuota sets aggregate quota restrictions enforced for a | ||
// namespace and descendant namespaces | ||
type HierarchicalResourceQuota struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Spec defines the desired quota | ||
Spec HierarchicalResourceQuotaSpec `json:"spec,omitempty"` | ||
// Status defines the actual enforced quota and its current usage | ||
Status HierarchicalResourceQuotaStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// HierarchicalResourceQuotaList contains a list of HierarchicalResourceQuota | ||
type HierarchicalResourceQuotaList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []HierarchicalResourceQuota `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&HierarchicalResourceQuota{}, &HierarchicalResourceQuotaList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
85 changes: 85 additions & 0 deletions
85
config/crd/bases/hnc.x-k8s.io_hierarchicalresourcequotas.yaml
This file contains hidden or 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,85 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.8.0 | ||
creationTimestamp: null | ||
name: hierarchicalresourcequotas.hnc.x-k8s.io | ||
spec: | ||
group: hnc.x-k8s.io | ||
names: | ||
kind: HierarchicalResourceQuota | ||
listKind: HierarchicalResourceQuotaList | ||
plural: hierarchicalresourcequotas | ||
shortNames: | ||
- hrq | ||
singular: hierarchicalresourcequota | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha2 | ||
schema: | ||
openAPIV3Schema: | ||
description: HierarchicalResourceQuota sets aggregate quota restrictions enforced | ||
for a namespace and descendant namespaces | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: Spec defines the desired quota | ||
properties: | ||
hard: | ||
additionalProperties: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
description: Hard is the set of desired hard limits for each named | ||
resource | ||
type: object | ||
type: object | ||
status: | ||
description: Status defines the actual enforced quota and its current | ||
usage | ||
properties: | ||
hard: | ||
additionalProperties: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
description: Hard is the set of enforced hard limits for each named | ||
resource | ||
type: object | ||
used: | ||
additionalProperties: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
description: Used is the current observed total usage of the resource | ||
in the namespace and its descendant namespaces. | ||
type: object | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
This file contains hidden or 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 hidden or 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 hidden or 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,2 @@ | ||
This is identical to default_cc (and should probably use that as a base in the | ||
future) except that it enables hierarchical resource quotas (HRQ). |
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.
Uh oh!
There was an error while loading. Please reload this page.