Skip to content

Commit

Permalink
Merge pull request #383 from duanmengkk/add_clusterpodconvertpolicy_api
Browse files Browse the repository at this point in the history
add clusterpodconvertpolicy api
  • Loading branch information
kosmos-robot authored Jan 29, 2024
2 parents b2ac11d + b4b2dd1 commit dcdc6a4
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 dcdc6a4

Please sign in to comment.