Skip to content

Commit

Permalink
add clusterpodconvertpolicy api
Browse files Browse the repository at this point in the history
Signed-off-by: duanmengkk <[email protected]>
  • Loading branch information
duanmengkk committed Jan 22, 2024
1 parent 5d73e7b commit b4b2dd1
Show file tree
Hide file tree
Showing 17 changed files with 2,047 additions and 5 deletions.
1,374 changes: 1,374 additions & 0 deletions deploy/crds/kosmos.io_clusterpodconvertpolicies.yaml

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions deploy/crds/kosmos.io_podconvertpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ spec:
plural: podconvertpolicies
shortNames:
- pc
- pcs
singular: podconvertpolicy
scope: Namespaced
versions:
Expand All @@ -35,7 +34,7 @@ spec:
metadata:
type: object
spec:
description: Spec is the specification for the behaviour of the podConversion.
description: Spec is the specification for the behaviour of the PodConvertPolicy.
properties:
converters:
description: Converters are some converter for convert pod when pod
Expand Down
46 changes: 46 additions & 0 deletions pkg/apis/kosmos/v1alpha1/clusterpodconvertpolicy_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +genclient
// +genclient:nonNamespaced
// +kubebuilder:resource:scope="Cluster"
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=pc
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type ClusterPodConvertPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec is the specification for the behaviour of the PodConvertPolicy.
// +required
Spec ClusterPodConvertPolicySpec `json:"spec"`
}

type ClusterPodConvertPolicySpec struct {
// A label query over a set of resources.
// If name is not empty, labelSelector will be ignored.
// +required
LabelSelector metav1.LabelSelector `json:"labelSelector"`

// A label query over a set of resources.
// If name is not empty, LeafNodeSelector will be ignored.
// +option
LeafNodeSelector *metav1.LabelSelector `json:"leafNodeSelector,omitempty"`

// Converters are some converter for convert pod when pod synced from root cluster to leaf cluster
// pod will use these converters to scheduled in leaf cluster
// +optional
Converters *Converters `json:"converters,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type ClusterPodConvertPolicyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []ClusterPodConvertPolicy `json:"items"`
}
4 changes: 2 additions & 2 deletions pkg/apis/kosmos/v1alpha1/podconvertpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (

// +genclient
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=pc;pcs
// +kubebuilder:resource:shortName=pc
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type PodConvertPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec is the specification for the behaviour of the podConversion.
// Spec is the specification for the behaviour of the PodConvertPolicy.
// +required
Spec PodConvertPolicySpec `json:"spec"`
}
Expand Down
87 changes: 87 additions & 0 deletions pkg/apis/kosmos/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/apis/kosmos/v1alpha1/zz_generated.register.go

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.

Loading

0 comments on commit b4b2dd1

Please sign in to comment.