Skip to content

Commit

Permalink
feat: add kubelocks modules
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Dec 5, 2023
1 parent 9300dee commit 8382bb0
Show file tree
Hide file tree
Showing 19 changed files with 39,587 additions and 0 deletions.
12,812 changes: 12,812 additions & 0 deletions kubeblocks/README.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions kubeblocks/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "kubeblocks"
version = "0.1.0"
description = "`kubeblocks` is the kubeblocks spec definition"

[dependencies]
k8s = "1.28"
9 changes: 9 additions & 0 deletions kubeblocks/kcl.mod.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[dependencies]
[dependencies.k8s]
name = "k8s"
full_name = "k8s_1.28"
version = "1.28"
sum = "aTxPUVZyr9MdiB3YdiY/8pCh9sC55yURnZdGlJsKG6Q="
reg = "ghcr.io"
repo = "kcl-lang/k8s"
oci_tag = "1.28"

Large diffs are not rendered by default.

893 changes: 893 additions & 0 deletions kubeblocks/v1alpha1/apps_kubeblocks_io_v1alpha1_cluster.k

Large diffs are not rendered by default.

8,396 changes: 8,396 additions & 0 deletions kubeblocks/v1alpha1/apps_kubeblocks_io_v1alpha1_cluster_definition.k

Large diffs are not rendered by default.

3,012 changes: 3,012 additions & 0 deletions kubeblocks/v1alpha1/apps_kubeblocks_io_v1alpha1_cluster_version.k

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
"""
This file was generated by the KCL auto-gen tool. DO NOT EDIT.
Editing this file might prove futile when you re-run the KCL auto-gen generate command.
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1


schema ComponentClassDefinition:
"""
ComponentClassDefinition is the Schema for the componentclassdefinitions API

Attributes
----------
apiVersion : str, default is "apps.kubeblocks.io/v1alpha1", required
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
kind : str, default is "ComponentClassDefinition", required
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
metadata : v1.ObjectMeta, default is Undefined, optional
metadata
spec : AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpec, default is Undefined, optional
spec
status : AppsKubeblocksIoV1alpha1ComponentClassDefinitionStatus, default is Undefined, optional
status
"""


apiVersion: "apps.kubeblocks.io/v1alpha1" = "apps.kubeblocks.io/v1alpha1"

kind: "ComponentClassDefinition" = "ComponentClassDefinition"

metadata?: v1.ObjectMeta

spec?: AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpec

status?: AppsKubeblocksIoV1alpha1ComponentClassDefinitionStatus


schema AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpec:
"""
ComponentClassDefinitionSpec defines the desired state of ComponentClassDefinition

Attributes
----------
groups : [AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0], default is Undefined, optional
group defines a list of class series that conform to the same constraint.
"""


groups?: [AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0]


schema AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0:
"""
apps kubeblocks io v1alpha1 component class definition spec groups items0

Attributes
----------
series : [AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0SeriesItems0], default is Undefined, optional
series is a series of class definitions.
template : str, default is Undefined, optional
template is a class definition template that uses the Go template syntax and allows for variable declaration. When defining a class in Series, specifying the variable's value is sufficient, as the complete class definition will be generated through rendering the template.
For example: template: | cpu: "{{ or .cpu 1 }}" memory: "{{ or .memory 4 }}Gi"
vars : [str], default is Undefined, optional
vars defines the variables declared in the template and will be used to generating the complete class definition by render the template.
"""


series?: [AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0SeriesItems0]

template?: str

vars?: [str]


schema AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0SeriesItems0:
"""
apps kubeblocks io v1alpha1 component class definition spec groups items0 series items0

Attributes
----------
classes : [AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0SeriesItems0ClassesItems0], default is Undefined, optional
classes are definitions of classes that come in two forms. In the first form, only ComponentClass.Args need to be defined, and the complete class definition is generated by rendering the ComponentClassGroup.Template and Name. In the second form, the Name, CPU and Memory must be defined.
namingTemplate : str, default is Undefined, optional
namingTemplate is a template that uses the Go template syntax and allows for referencing variables defined in ComponentClassGroup.Template. This enables dynamic generation of class names. For example: name: "general-{{ .cpu }}c{{ .memory }}g"
"""


classes?: [AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0SeriesItems0ClassesItems0]

namingTemplate?: str


schema AppsKubeblocksIoV1alpha1ComponentClassDefinitionSpecGroupsItems0SeriesItems0ClassesItems0:
"""
apps kubeblocks io v1alpha1 component class definition spec groups items0 series items0 classes items0

Attributes
----------
args : [str], default is Undefined, optional
args are variable's value
cpu : int | str, default is Undefined, optional
the CPU of the class
memory : int | str, default is Undefined, optional
the memory of the class
name : str, default is Undefined, optional
name is the class name
"""


args?: [str]

cpu?: int | str

memory?: int | str

name?: str


check:
regex.match(str(cpu), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if cpu
regex.match(str(memory), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if memory


schema AppsKubeblocksIoV1alpha1ComponentClassDefinitionStatus:
"""
ComponentClassDefinitionStatus defines the observed state of ComponentClassDefinition

Attributes
----------
classes : [AppsKubeblocksIoV1alpha1ComponentClassDefinitionStatusClassesItems0], default is Undefined, optional
classes is the list of classes that have been observed for this ComponentClassDefinition
observedGeneration : int, default is Undefined, optional
observedGeneration is the most recent generation observed for this ComponentClassDefinition. It corresponds to the ComponentClassDefinition's generation, which is updated on mutation by the API Server.
"""


classes?: [AppsKubeblocksIoV1alpha1ComponentClassDefinitionStatusClassesItems0]

observedGeneration?: int


schema AppsKubeblocksIoV1alpha1ComponentClassDefinitionStatusClassesItems0:
"""
apps kubeblocks io v1alpha1 component class definition status classes items0

Attributes
----------
args : [str], default is Undefined, optional
args are variable's value
cpu : int | str, default is Undefined, optional
the CPU of the class
memory : int | str, default is Undefined, optional
the memory of the class
name : str, default is Undefined, optional
name is the class name
"""


args?: [str]

cpu?: int | str

memory?: int | str

name?: str


check:
regex.match(str(cpu), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if cpu
regex.match(str(memory), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if memory


Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
"""
This file was generated by the KCL auto-gen tool. DO NOT EDIT.
Editing this file might prove futile when you re-run the KCL auto-gen generate command.
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1


schema ComponentResourceConstraint:
"""
ComponentResourceConstraint is the Schema for the componentresourceconstraints API

Attributes
----------
apiVersion : str, default is "apps.kubeblocks.io/v1alpha1", required
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
kind : str, default is "ComponentResourceConstraint", required
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
metadata : v1.ObjectMeta, default is Undefined, optional
metadata
spec : AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpec, default is Undefined, optional
spec
"""


apiVersion: "apps.kubeblocks.io/v1alpha1" = "apps.kubeblocks.io/v1alpha1"

kind: "ComponentResourceConstraint" = "ComponentResourceConstraint"

metadata?: v1.ObjectMeta

spec?: AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpec


schema AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpec:
"""
ComponentResourceConstraintSpec defines the desired state of ComponentResourceConstraint

Attributes
----------
rules : [AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0], default is Undefined, required
Component resource constraint rules.
selector : [AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecSelectorItems0], default is Undefined, optional
selector is used to bind the resource constraint to cluster definitions.
"""


rules: [AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0]

selector?: [AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecSelectorItems0]


schema AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0:
"""
apps kubeblocks io v1alpha1 component resource constraint spec rules items0

Attributes
----------
cpu : AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0CPU, default is Undefined, required
cpu
memory : AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0Memory, default is Undefined, required
memory
name : str, default is Undefined, required
The name of the constraint.
storage : AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0Storage, default is Undefined, optional
storage
"""


cpu: AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0CPU

memory: AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0Memory

name: str

storage?: AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0Storage


schema AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0CPU:
"""
The constraint for vcpu cores.

Attributes
----------
max : int | str, default is Undefined, optional
The maximum count of vcpu cores, [Min, Max] defines a range for valid vcpu cores, and the value in this range must be multiple times of Step. It's useful to define a large number of valid values without defining them one by one. Please see the documentation for Step for some examples. If Slots is specified, Max, Min, and Step are ignored
min : int | str, default is Undefined, optional
The minimum count of vcpu cores, [Min, Max] defines a range for valid vcpu cores, and the value in this range must be multiple times of Step. It's useful to define a large number of valid values without defining them one by one. Please see the documentation for Step for some examples. If Slots is specified, Max, Min, and Step are ignored
slots : [int | str], default is Undefined, optional
The valid vcpu cores, it's useful if you want to define valid vcpu cores explicitly. If Slots is specified, Max, Min, and Step are ignored
step : int | str, default is Undefined, optional
The minimum granularity of vcpu cores, [Min, Max] defines a range for valid vcpu cores and the value in this range must be multiple times of Step. For example: 1. Min is 2, Max is 8, Step is 2, and the valid vcpu core is {2, 4, 6, 8}. 2. Min is 0.5, Max is 2, Step is 0.5, and the valid vcpu core is {0.5, 1, 1.5, 2}.
"""


max?: int | str

min?: int | str

slots?: [int | str]

step?: int | str


check:
regex.match(str(max), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if max
regex.match(str(min), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if min
regex.match(str(step), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if step


schema AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0Memory:
"""
The constraint for memory size.

Attributes
----------
maxPerCPU : int | str, default is Undefined, optional
The maximum size of memory per vcpu core, [MinPerCPU, MaxPerCPU] defines a range for valid memory size per vcpu core. It is useful on GCP as the ratio between the CPU and memory may be a range. If SizePerCPU is specified, MinPerCPU and MaxPerCPU are ignored. Reference: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types
minPerCPU : int | str, default is Undefined, optional
The minimum size of memory per vcpu core, [MinPerCPU, MaxPerCPU] defines a range for valid memory size per vcpu core. It is useful on GCP as the ratio between the CPU and memory may be a range. If SizePerCPU is specified, MinPerCPU and MaxPerCPU are ignored. Reference: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types
sizePerCPU : int | str, default is Undefined, optional
The size of memory per vcpu core. For example: 1Gi, 200Mi. If SizePerCPU is specified, MinPerCPU and MaxPerCPU are ignore.
"""


maxPerCPU?: int | str

minPerCPU?: int | str

sizePerCPU?: int | str


check:
regex.match(str(maxPerCPU), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if maxPerCPU
regex.match(str(minPerCPU), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if minPerCPU
regex.match(str(sizePerCPU), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if sizePerCPU


schema AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecRulesItems0Storage:
"""
The constraint for storage size.

Attributes
----------
max : int | str, default is "10Ti", optional
The maximum size of storage.
min : int | str, default is "20Gi", optional
The minimum size of storage.
"""


max?: int | str = "10Ti"

min?: int | str = "20Gi"


check:
regex.match(str(max), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if max
regex.match(str(min), r"(^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if min


schema AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecSelectorItems0:
"""
apps kubeblocks io v1alpha1 component resource constraint spec selector items0

Attributes
----------
clusterDefRef : str, default is Undefined, required
clusterDefRef is the name of the cluster definition.
components : [AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecSelectorItems0ComponentsItems0], default is Undefined, required
selector is used to bind the resource constraint to components.
"""


clusterDefRef: str

components: [AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecSelectorItems0ComponentsItems0]


schema AppsKubeblocksIoV1alpha1ComponentResourceConstraintSpecSelectorItems0ComponentsItems0:
"""
apps kubeblocks io v1alpha1 component resource constraint spec selector items0 components items0

Attributes
----------
componentDefRef : str, default is Undefined, required
componentDefRef is the name of the component definition in the cluster definition.
rules : [str], default is Undefined, required
rules are the constraint rules that will be applied to the component.
"""


componentDefRef: str

rules: [str]


Loading

0 comments on commit 8382bb0

Please sign in to comment.