-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
Signed-off-by: qiuming520 <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright 2020 The Kubernetes 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 v1beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +k8s:defaulter-gen=true | ||
|
||
// LeafNodeWorkloadArgs defines the scheduling parameters for WorkloadPolicy plugin. | ||
type LeafNodeWorkloadArgs struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// KubeConfigPath is the path of kubeconfig. | ||
KubeConfigPath *string `json:"kubeConfigPath,omitempty"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +genclient | ||
// +kubebuilder:resource:shortName=wlp,categories={kosmos-io} | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." | ||
|
||
type WorkloadPolicy struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// Standard object's metadata. | ||
// +optional | ||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
||
// Spec represents the desired behavior of WorkloadPolicyPolicy. | ||
// +required | ||
Spec WorkloadPolicySpec `json:"spec,omitempty"` | ||
} | ||
|
||
// WorkloadPolicySpec represents the desired behavior of WorkloadPolicyPolicy. | ||
type WorkloadPolicySpec struct { | ||
// TopologyKey is used when match node topologyKey | ||
// +required | ||
TopologyKey string `json:"topologyKey"` | ||
|
||
// AllocationType sets the scheduling constraint to schedule pods for a WorkloadPolicy. | ||
// Valid options are Required or Preferred. | ||
// Required means that the pods will get scheduled only on nodes that has a topologyKey=topologyValue label. | ||
// Preferred means that the pods will prefer nodes that has a topologyKey=topologyValue label. | ||
// +kubebuilder:default="Preferred" | ||
// +kubebuilder:validation:Enum=Preferred;Required | ||
// +required | ||
AllocationType string `json:"allocationType"` | ||
|
||
// AllocationMethod sets the scheduling method to schedule pods for a WorkloadPolicy. | ||
// Valid options are Fill or Balance. | ||
// Fill schedules pods in high load priority mode between topologies. | ||
// Balance schedules pods in load balance between different topologies. | ||
// +kubebuilder:default="Balance" | ||
// +kubebuilder:validation:Enum=Fill;Balance | ||
// +required | ||
AllocationMethod string `json:"allocationMethod"` | ||
|
||
// AllocationPolicy describes the allocation policy when scheduling pods. | ||
// +required | ||
AllocationPolicy []AllocationPolicy `json:"allocationPolicy"` | ||
|
||
// LabelSelector is used to filter matching pods. | ||
// +required | ||
LabelSelector *metav1.LabelSelector `json:"labelSelector"` | ||
} | ||
|
||
// AllocationPolicy set the topologyValue required replicas | ||
type AllocationPolicy struct { | ||
// Name is the topology value | ||
// +required | ||
Name string `json:"name"` | ||
|
||
// Replicas is the desired the replicas for the topology value | ||
// +required | ||
Replicas int32 `json:"replicas"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
type WorkloadPolicyList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
Items []WorkloadPolicy `json:"items"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.