Skip to content

Commit 3463723

Browse files
committed
init
1 parent fcd0f17 commit 3463723

33 files changed

+789
-522
lines changed

apis/workloads/v1/instanceset_types.go

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,32 @@ type InstanceSetSpec struct {
9191
// For example, if Ordinals is {ranges: [{start: 0, end: 1}], discrete: [7]},
9292
// then the instance names generated under the default template would be
9393
// $(cluster.name)-$(component.name)-0、$(cluster.name)-$(component.name)-1 and $(cluster.name)-$(component.name)-7
94+
//
95+
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.1.0"
96+
// +optional
9497
DefaultTemplateOrdinals kbappsv1.Ordinals `json:"defaultTemplateOrdinals,omitempty"`
9598

99+
// Specifies the desired Ordinals.
100+
// The Ordinals used to specify the ordinal of the instance (pod) names to be generated under the InstanceSet.
101+
// If Ordinals are defined, their number must be equal to or more than the corresponding replicas.
102+
//
103+
// +optional
104+
Ordinals Ordinals `json:"ordinals,omitempty"`
105+
106+
// AssignedOrdinals is the set of ordinals assigned to the current replicas.
107+
//
108+
// IMPORTANT: This field is managed automatically by the InstanceSet controller.
109+
// Users should NOT manually modify this field.
110+
//
111+
// This field represents the authoritative set of ordinal identifiers currently in use by the workload.
112+
// It enables support for non-contiguous ordinals, allowing any instance to be terminated without affecting others.
113+
//
114+
// The controller uses this list to maintain identity consistency and to decide which specific ordinal
115+
// to allocate next during scaling up, or which identity is preserved during a restart.
116+
//
117+
// +optional
118+
AssignedOrdinals Ordinals `json:"assignedOrdinals,omitempty"`
119+
96120
// Defines the minimum number of seconds a newly created pod should be ready
97121
// without any of its container crashing to be considered available.
98122
// Defaults to 0, meaning the pod will be considered available as soon as it is ready.
@@ -236,6 +260,12 @@ type InstanceSetSpec struct {
236260
// +optional
237261
Paused bool `json:"paused,omitempty"`
238262

263+
// Stop the InstanceSet.
264+
// If set, all the computing resources will be released.
265+
//
266+
// +optional
267+
Stop *bool `json:"stop,omitempty"`
268+
239269
// Describe the configs to be reconfigured.
240270
//
241271
// +optional
@@ -283,11 +313,6 @@ type InstanceSetStatus struct {
283313
// replicas is the number of instances created by the InstanceSet controller.
284314
Replicas int32 `json:"replicas"`
285315

286-
// Ordinals is the ordinals used by the instances of the InstanceSet except the template instances.
287-
//
288-
// +optional
289-
Ordinals []int32 `json:"ordinals,omitempty"`
290-
291316
// readyReplicas is the number of instances created for this InstanceSet with a Ready Condition.
292317
//
293318
// +optional
@@ -402,8 +427,24 @@ type InstanceTemplate struct {
402427
// then the instance names generated under this InstanceTemplate would be
403428
// $(cluster.name)-$(component.name)-$(template.name)-0、$(cluster.name)-$(component.name)-$(template.name)-1 and
404429
// $(cluster.name)-$(component.name)-$(template.name)-7
430+
//
431+
// +optional
405432
Ordinals Ordinals `json:"ordinals,omitempty"`
406433

434+
// AssignedOrdinals is the set of ordinals assigned to the current replicas of this InstanceTemplate.
435+
//
436+
// IMPORTANT: This field is managed automatically by the InstanceSet controller.
437+
// Users should NOT manually modify this field.
438+
//
439+
// This field represents the authoritative set of ordinal identifiers currently in use by the workload.
440+
// It enables support for non-contiguous ordinals, allowing any instance to be terminated without affecting others.
441+
//
442+
// The controller uses this list to maintain identity consistency and to decide which specific ordinal
443+
// to allocate next during scaling up, or which identity is preserved during a restart.
444+
//
445+
// +optional
446+
AssignedOrdinals Ordinals `json:"assignedOrdinals,omitempty"`
447+
407448
// Specifies a map of key-value pairs to be merged into the Pod's existing annotations.
408449
// Existing keys will have their values overwritten, while new keys will be added to the annotations.
409450
//
@@ -579,10 +620,6 @@ type InstanceTemplateStatus struct {
579620
// +optional
580621
Replicas int32 `json:"replicas,omitempty"`
581622

582-
// Ordinals is the ordinals used by the instances of the InstanceTemplate.
583-
// +optional
584-
Ordinals []int32 `json:"ordinals,omitempty"`
585-
586623
// ReadyReplicas is the number of Pods that have a Ready Condition.
587624
// +optional
588625
ReadyReplicas int32 `json:"readyReplicas,omitempty"`

apis/workloads/v1/zz_generated.deepcopy.go

Lines changed: 9 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/workloads.kubeblocks.io_instancesets.yaml

Lines changed: 112 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,45 @@ spec:
6565
description: Defines the desired state of the state machine. It includes
6666
the configuration details for the state machine.
6767
properties:
68+
assignedOrdinals:
69+
description: |-
70+
AssignedOrdinals is the set of ordinals assigned to the current replicas.
71+
72+
73+
IMPORTANT: This field is managed automatically by the InstanceSet controller.
74+
Users should NOT manually modify this field.
75+
76+
77+
This field represents the authoritative set of ordinal identifiers currently in use by the workload.
78+
It enables support for non-contiguous ordinals, allowing any instance to be terminated without affecting others.
79+
80+
81+
The controller uses this list to maintain identity consistency and to decide which specific ordinal
82+
to allocate next during scaling up, or which identity is preserved during a restart.
83+
properties:
84+
discrete:
85+
items:
86+
format: int32
87+
type: integer
88+
type: array
89+
ranges:
90+
items:
91+
description: |-
92+
Range represents a range with a start and an end value. Both start and end are included.
93+
It is used to define a continuous segment.
94+
properties:
95+
end:
96+
format: int32
97+
type: integer
98+
start:
99+
format: int32
100+
type: integer
101+
required:
102+
- end
103+
- start
104+
type: object
105+
type: array
106+
type: object
68107
configs:
69108
description: Describe the configs to be reconfigured.
70109
items:
@@ -727,6 +766,45 @@ spec:
727766
Specifies a map of key-value pairs to be merged into the Pod's existing annotations.
728767
Existing keys will have their values overwritten, while new keys will be added to the annotations.
729768
type: object
769+
assignedOrdinals:
770+
description: |-
771+
AssignedOrdinals is the set of ordinals assigned to the current replicas of this InstanceTemplate.
772+
773+
774+
IMPORTANT: This field is managed automatically by the InstanceSet controller.
775+
Users should NOT manually modify this field.
776+
777+
778+
This field represents the authoritative set of ordinal identifiers currently in use by the workload.
779+
It enables support for non-contiguous ordinals, allowing any instance to be terminated without affecting others.
780+
781+
782+
The controller uses this list to maintain identity consistency and to decide which specific ordinal
783+
to allocate next during scaling up, or which identity is preserved during a restart.
784+
properties:
785+
discrete:
786+
items:
787+
format: int32
788+
type: integer
789+
type: array
790+
ranges:
791+
items:
792+
description: |-
793+
Range represents a range with a start and an end value. Both start and end are included.
794+
It is used to define a continuous segment.
795+
properties:
796+
end:
797+
format: int32
798+
type: integer
799+
start:
800+
format: int32
801+
type: integer
802+
required:
803+
- end
804+
- start
805+
type: object
806+
type: array
807+
type: object
730808
env:
731809
description: |-
732810
Defines Env to override.
@@ -3482,6 +3560,35 @@ spec:
34823560
items:
34833561
type: string
34843562
type: array
3563+
ordinals:
3564+
description: |-
3565+
Specifies the desired Ordinals.
3566+
The Ordinals used to specify the ordinal of the instance (pod) names to be generated under the InstanceSet.
3567+
If Ordinals are defined, their number must be equal to or more than the corresponding replicas.
3568+
properties:
3569+
discrete:
3570+
items:
3571+
format: int32
3572+
type: integer
3573+
type: array
3574+
ranges:
3575+
items:
3576+
description: |-
3577+
Range represents a range with a start and an end value. Both start and end are included.
3578+
It is used to define a continuous segment.
3579+
properties:
3580+
end:
3581+
format: int32
3582+
type: integer
3583+
start:
3584+
format: int32
3585+
type: integer
3586+
required:
3587+
- end
3588+
- start
3589+
type: object
3590+
type: array
3591+
type: object
34853592
parallelPodManagementConcurrency:
34863593
anyOf:
34873594
- type: integer
@@ -3663,6 +3770,11 @@ spec:
36633770
type: object
36643771
type: object
36653772
x-kubernetes-map-type: atomic
3773+
stop:
3774+
description: |-
3775+
Stop the InstanceSet.
3776+
If set, all the computing resources will be released.
3777+
type: boolean
36663778
template:
36673779
description: PodTemplateSpec describes the data a pod should have
36683780
when created from a template
@@ -11750,13 +11862,6 @@ spec:
1175011862
InstanceSet's generation, which is updated on mutation by the API Server.
1175111863
format: int64
1175211864
type: integer
11753-
ordinals:
11754-
description: Ordinals is the ordinals used by the instances of the
11755-
InstanceSet except the template instances.
11756-
items:
11757-
format: int32
11758-
type: integer
11759-
type: array
1176011865
readyInitReplicas:
1176111866
description: |-
1176211867
Represents the number of instances that have already reached the InstanceStatus during the cluster initialization stage.
@@ -11794,13 +11899,6 @@ spec:
1179411899
name:
1179511900
description: Name, the name of the InstanceTemplate.
1179611901
type: string
11797-
ordinals:
11798-
description: Ordinals is the ordinals used by the instances
11799-
of the InstanceTemplate.
11800-
items:
11801-
format: int32
11802-
type: integer
11803-
type: array
1180411902
readyReplicas:
1180511903
description: ReadyReplicas is the number of Pods that have a
1180611904
Ready Condition.

0 commit comments

Comments
 (0)