forked from kosmos-io/kosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: duanmengkk <[email protected]>
- Loading branch information
1 parent
640e9a6
commit a677dc2
Showing
15 changed files
with
808 additions
and
0 deletions.
There are no files selected for viewing
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,77 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.11.0 | ||
creationTimestamp: null | ||
name: virtualclusters.kosmos.io | ||
spec: | ||
group: kosmos.io | ||
names: | ||
kind: VirtualCluster | ||
listKind: VirtualClusterList | ||
plural: virtualclusters | ||
singular: virtualcluster | ||
scope: Cluster | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
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 is the specification for the behaviour of the VirtualCluster. | ||
properties: | ||
kubeconfig: | ||
description: Kubeconfig is the kubeconfig of the virtual kubernetes's | ||
control plane | ||
type: string | ||
promoteResources: | ||
description: PromoteResources definites the resources for promote | ||
to the kubernetes's control plane, the resources can be nodes or | ||
just cpu,memory or gpu resources | ||
properties: | ||
nodes: | ||
description: Nodes is the names of node to promote to the kubernetes's | ||
control plane | ||
items: | ||
type: string | ||
type: array | ||
resources: | ||
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: Resources is the resources to promote to the kubernetes's | ||
control plane | ||
type: object | ||
type: object | ||
required: | ||
- promoteResources | ||
type: object | ||
status: | ||
description: Status describes the current status of a VirtualCluster. | ||
properties: | ||
phase: | ||
description: Phase is the phase of kosmos-operator handling the VirtualCluster | ||
type: string | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
served: true | ||
storage: true |
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,62 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type Phase string | ||
|
||
const ( | ||
// Preparing means kubernetes control plane is preparing,and kubeconfig is not ready | ||
Preparing Phase = "Preparing" | ||
// Initialized means kubernetes control plane is ready,and kubeconfig is ready for use | ||
Initialized Phase = "Initialized" | ||
// Completed means kubernetes control plane is ready,kosmos is joined, and resource is promoted | ||
Completed Phase = "Completed" | ||
) | ||
|
||
// +genclient | ||
// +genclient:nonNamespaced | ||
// +kubebuilder:resource:scope="Cluster" | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
type VirtualCluster struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Spec is the specification for the behaviour of the VirtualCluster. | ||
// +required | ||
Spec VirtualClusterSpec `json:"spec"` | ||
|
||
// Status describes the current status of a VirtualCluster. | ||
// +optional | ||
Status VirtualClusterStatus `json:"status,omitempty"` | ||
} | ||
|
||
type VirtualClusterSpec struct { | ||
// Kubeconfig is the kubeconfig of the virtual kubernetes's control plane | ||
// +optional | ||
Kubeconfig string `json:"kubeconfig,omitempty"` | ||
|
||
// PromoteResources definites the resources for promote to the kubernetes's control plane, | ||
// the resources can be nodes or just cpu,memory or gpu resources | ||
// +required | ||
PromoteResources PromoteResources `json:"promoteResources"` | ||
} | ||
|
||
type PromoteResources struct { | ||
// Nodes is the names of node to promote to the kubernetes's control plane | ||
// +optional | ||
Nodes []string `json:"nodes,omitempty"` | ||
|
||
// Resources is the resources to promote to the kubernetes's control plane | ||
// +optional | ||
Resources corev1.ResourceList `json:"resources,omitempty"` | ||
} | ||
|
||
type VirtualClusterStatus struct { | ||
// Phase is the phase of kosmos-operator handling the VirtualCluster | ||
// +optional | ||
Phase Phase `json:"phase,omitempty"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_kosmos_client.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
117 changes: 117 additions & 0 deletions
117
pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_virtualcluster.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/generated_expansion.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.