-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(overcommit):add nodeOvercommitConfig crd
- Loading branch information
Showing
25 changed files
with
1,262 additions
and
15 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
config/crd/bases/overcommit.katalyst.kubewharf.io_nodeovercommitconfigs.yaml
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,116 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.9.0 | ||
creationTimestamp: null | ||
name: nodeovercommitconfigs.overcommit.katalyst.kubewharf.io | ||
spec: | ||
group: overcommit.katalyst.kubewharf.io | ||
names: | ||
kind: NodeOvercommitConfig | ||
listKind: NodeOvercommitConfigList | ||
plural: nodeovercommitconfigs | ||
shortNames: | ||
- noc | ||
singular: nodeovercommitconfig | ||
scope: Cluster | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .spec.resourceOvercommitRatioConfig | ||
name: OVERCOMMITRATIO | ||
type: string | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: NodeOvercommitConfig is the Schema for the nodeovercommitconfigs | ||
API | ||
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: NodeOvercommitConfigSpec is a description of a NodeOvercommitConfig | ||
properties: | ||
nodeList: | ||
description: NodeList decides whether to check and update nodes if | ||
node in NodeList when Type equals to NodeList | ||
items: | ||
type: string | ||
type: array | ||
nodeSelector: | ||
description: Selector decides whether to update Nodes if the Node | ||
matches the selector when Type equals to LabelSelector | ||
properties: | ||
matchExpressions: | ||
description: matchExpressions is a list of label selector requirements. | ||
The requirements are ANDed. | ||
items: | ||
description: A label selector requirement is a selector that | ||
contains values, a key, and an operator that relates the key | ||
and values. | ||
properties: | ||
key: | ||
description: key is the label key that the selector applies | ||
to. | ||
type: string | ||
operator: | ||
description: operator represents a key's relationship to | ||
a set of values. Valid operators are In, NotIn, Exists | ||
and DoesNotExist. | ||
type: string | ||
values: | ||
description: values is an array of string values. If the | ||
operator is In or NotIn, the values array must be non-empty. | ||
If the operator is Exists or DoesNotExist, the values | ||
array must be empty. This array is replaced during a strategic | ||
merge patch. | ||
items: | ||
type: string | ||
type: array | ||
required: | ||
- key | ||
- operator | ||
type: object | ||
type: array | ||
matchLabels: | ||
additionalProperties: | ||
type: string | ||
description: matchLabels is a map of {key,value} pairs. A single | ||
{key,value} in the matchLabels map is equivalent to an element | ||
of matchExpressions, whose key field is "key", the operator | ||
is "In", and the values array contains only "value". The requirements | ||
are ANDed. | ||
type: object | ||
type: object | ||
resourceOvercommitRatioConfig: | ||
additionalProperties: | ||
type: string | ||
description: ResourceOvercommitRatioConfig describes the resource | ||
overcommit ratio that needs to inject into Node.Annotations cpu,memory | ||
are supported. | ||
type: object | ||
type: object | ||
status: | ||
properties: | ||
matchedNodeList: | ||
description: NodeList which the nodeOvercommitConfig rules matched | ||
items: | ||
type: string | ||
type: array | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Copyright 2022 The Katalyst Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// +k8s:deepcopy-gen=package | ||
// +groupName=overcommit.katalyst.kubewharf.io | ||
// +k8s:openapi-gen=true | ||
|
||
// Package v1alpha1 provides alpha API for Katalyst Overcommit API objects. | ||
package v1alpha1 // import "github.com/kubewharf/katalyst-api/pkg/apis/overcommit/v1alpha1" |
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,58 @@ | ||
/* | ||
Copyright 2022 The Katalyst Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
const ( | ||
// GroupName is the group name used in this package | ||
GroupName string = "overcommit.katalyst.kubewharf.io" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} | ||
|
||
const ( | ||
ResourceNameNodeOvercommitConfigs = "nodeovercommitconfigs" | ||
) | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
var ( | ||
// SchemeBuilder collects schemas to build. | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
// AddToScheme is used by generated client to add this scheme to the generated client. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) | ||
|
||
// Adds the list of known types to the given scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&NodeOvercommitConfig{}, | ||
&NodeOvercommitConfigList{}, | ||
) | ||
|
||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
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,70 @@ | ||
/* | ||
Copyright 2022 The Katalyst Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// NodeOvercommitConfigSpec is a description of a NodeOvercommitConfig | ||
type NodeOvercommitConfigSpec struct { | ||
// Selector decides whether to update Nodes if the Node matches the selector when Type equals to LabelSelector | ||
// +optional | ||
Selector *metav1.LabelSelector `json:"nodeSelector,omitempty"` | ||
|
||
// NodeList decides whether to check and update nodes if node in NodeList when Type equals to NodeList | ||
// +optional | ||
NodeList []string `json:"nodeList,omitempty"` | ||
|
||
// ResourceOvercommitRatioConfig describes the resource overcommit ratio that needs to inject into Node.Annotations | ||
// cpu,memory are supported. | ||
// +optional | ||
ResourceOvercommitRatioConfig map[v1.ResourceName]string `json:"resourceOvercommitRatioConfig,omitempty"` | ||
} | ||
|
||
type NodeOvercommitConfigStatus struct { | ||
// NodeList which the nodeOvercommitConfig rules matched | ||
MatchedNodeList []string `json:"matchedNodeList,omitempty"` | ||
} | ||
|
||
// +genclient | ||
// +genclient:nonNamespaced | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:resource:scope=Cluster,shortName=noc | ||
// +kubebuilder:printcolumn:name="OVERCOMMITRATIO",type=string,JSONPath=".spec.resourceOvercommitRatioConfig" | ||
|
||
// NodeOvercommitConfig is the Schema for the nodeovercommitconfigs API | ||
type NodeOvercommitConfig struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec NodeOvercommitConfigSpec `json:"spec,omitempty"` | ||
Status NodeOvercommitConfigStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
//+kubebuilder:object:root=true | ||
|
||
// NodeOvercommitConfigList contains a list of NodeOvercommitConfig | ||
type NodeOvercommitConfigList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []NodeOvercommitConfig `json:"items"` | ||
} |
Oops, something went wrong.