Skip to content

Commit edbdeda

Browse files
committed
update
1 parent 7859617 commit edbdeda

File tree

10 files changed

+158
-32
lines changed

10 files changed

+158
-32
lines changed

apis/workloads/v1/instance_types.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,25 @@ type InstanceStatus2 struct {
183183
// +optional
184184
Role string `json:"role,omitempty"`
185185

186+
// Represents whether the instance is provisioned.
187+
//
188+
// +optional
189+
Provisioned bool `json:"provisioned,omitempty"`
190+
191+
// Represents whether the instance data is loaded.
192+
//
193+
// +optional
194+
DataLoaded *bool `json:"dataLoaded,omitempty"`
195+
196+
// Represents whether the instance is joined the cluster.
197+
//
198+
// +optional
199+
MemberJoined *bool `json:"memberJoined,omitempty"`
200+
186201
// Represents whether the instance is in volume expansion.
187202
//
188203
// +optional
189-
VolumeExpansion bool `json:"volumeExpansion,omitempty"`
204+
InVolumeExpansion bool `json:"inVolumeExpansion,omitempty"`
190205
}
191206

192207
type InstanceAssistantObject struct {

apis/workloads/v1/instanceset_types.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,25 @@ type InstanceStatus struct {
562562
// +optional
563563
Configs []InstanceConfigStatus `json:"configs,omitempty"`
564564

565+
// Represents whether the instance is provisioned.
566+
//
567+
// +optional
568+
Provisioned bool `json:"provisioned,omitempty"`
569+
570+
// Represents whether the instance data is loaded.
571+
//
572+
// +optional
573+
DataLoaded *bool `json:"dataLoaded,omitempty"`
574+
565575
// Represents whether the instance is joined the cluster.
566576
//
567577
// +optional
568-
Joined *bool `json:"joined,omitempty"`
578+
MemberJoined *bool `json:"memberJoined,omitempty"`
569579

570580
// Represents whether the instance is in volume expansion.
571581
//
572582
// +optional
573-
VolumeExpansion bool `json:"volumeExpansion,omitempty"`
583+
InVolumeExpansion bool `json:"inVolumeExpansion,omitempty"`
574584
}
575585

576586
type InstanceConfigStatus struct {

apis/workloads/v1/zz_generated.deepcopy.go

Lines changed: 17 additions & 2 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_instances.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10814,12 +10814,24 @@ spec:
1081410814
description: currentRevision, if not empty, indicates the version
1081510815
of the Instance used to generate pod.
1081610816
type: string
10817+
dataLoaded:
10818+
description: Represents whether the instance data is loaded.
10819+
type: boolean
10820+
inVolumeExpansion:
10821+
description: Represents whether the instance is in volume expansion.
10822+
type: boolean
10823+
memberJoined:
10824+
description: Represents whether the instance is joined the cluster.
10825+
type: boolean
1081710826
observedGeneration:
1081810827
description: |-
1081910828
observedGeneration is the most recent generation observed for this InstanceSet. It corresponds to the
1082010829
InstanceSet's generation, which is updated on mutation by the API Server.
1082110830
format: int64
1082210831
type: integer
10832+
provisioned:
10833+
description: Represents whether the instance is provisioned.
10834+
type: boolean
1082310835
ready:
1082410836
description: Represents whether the instance is in ready condition.
1082510837
type: boolean
@@ -10833,9 +10845,6 @@ spec:
1083310845
description: updateRevision, if not empty, indicates the version of
1083410846
the Instance used to generate pod.
1083510847
type: string
10836-
volumeExpansion:
10837-
description: Represents whether the instance is in volume expansion.
10838-
type: boolean
1083910848
type: object
1084010849
type: object
1084110850
served: true

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12579,19 +12579,25 @@ spec:
1257912579
- name
1258012580
type: object
1258112581
type: array
12582-
joined:
12582+
dataLoaded:
12583+
description: Represents whether the instance data is loaded.
12584+
type: boolean
12585+
inVolumeExpansion:
12586+
description: Represents whether the instance is in volume expansion.
12587+
type: boolean
12588+
memberJoined:
1258312589
description: Represents whether the instance is joined the cluster.
1258412590
type: boolean
1258512591
podName:
1258612592
default: Unknown
1258712593
description: Represents the name of the pod.
1258812594
type: string
12595+
provisioned:
12596+
description: Represents whether the instance is provisioned.
12597+
type: boolean
1258912598
role:
1259012599
description: Represents the role of the instance observed.
1259112600
type: string
12592-
volumeExpansion:
12593-
description: Represents whether the instance is in volume expansion.
12594-
type: boolean
1259512601
required:
1259612602
- podName
1259712603
type: object

deploy/helm/crds/workloads.kubeblocks.io_instances.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10814,12 +10814,24 @@ spec:
1081410814
description: currentRevision, if not empty, indicates the version
1081510815
of the Instance used to generate pod.
1081610816
type: string
10817+
dataLoaded:
10818+
description: Represents whether the instance data is loaded.
10819+
type: boolean
10820+
inVolumeExpansion:
10821+
description: Represents whether the instance is in volume expansion.
10822+
type: boolean
10823+
memberJoined:
10824+
description: Represents whether the instance is joined the cluster.
10825+
type: boolean
1081710826
observedGeneration:
1081810827
description: |-
1081910828
observedGeneration is the most recent generation observed for this InstanceSet. It corresponds to the
1082010829
InstanceSet's generation, which is updated on mutation by the API Server.
1082110830
format: int64
1082210831
type: integer
10832+
provisioned:
10833+
description: Represents whether the instance is provisioned.
10834+
type: boolean
1082310835
ready:
1082410836
description: Represents whether the instance is in ready condition.
1082510837
type: boolean
@@ -10833,9 +10845,6 @@ spec:
1083310845
description: updateRevision, if not empty, indicates the version of
1083410846
the Instance used to generate pod.
1083510847
type: string
10836-
volumeExpansion:
10837-
description: Represents whether the instance is in volume expansion.
10838-
type: boolean
1083910848
type: object
1084010849
type: object
1084110850
served: true

deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12579,19 +12579,25 @@ spec:
1257912579
- name
1258012580
type: object
1258112581
type: array
12582-
joined:
12582+
dataLoaded:
12583+
description: Represents whether the instance data is loaded.
12584+
type: boolean
12585+
inVolumeExpansion:
12586+
description: Represents whether the instance is in volume expansion.
12587+
type: boolean
12588+
memberJoined:
1258312589
description: Represents whether the instance is joined the cluster.
1258412590
type: boolean
1258512591
podName:
1258612592
default: Unknown
1258712593
description: Represents the name of the pod.
1258812594
type: string
12595+
provisioned:
12596+
description: Represents whether the instance is provisioned.
12597+
type: boolean
1258912598
role:
1259012599
description: Represents the role of the instance observed.
1259112600
type: string
12592-
volumeExpansion:
12593-
description: Represents whether the instance is in volume expansion.
12594-
type: boolean
1259512601
required:
1259612602
- podName
1259712603
type: object

docs/developer_docs/api-reference/cluster.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33308,7 +33308,31 @@ string
3330833308
</tr>
3330933309
<tr>
3331033310
<td>
33311-
<code>joined</code><br/>
33311+
<code>provisioned</code><br/>
33312+
<em>
33313+
bool
33314+
</em>
33315+
</td>
33316+
<td>
33317+
<em>(Optional)</em>
33318+
<p>Represents whether the instance is provisioned.</p>
33319+
</td>
33320+
</tr>
33321+
<tr>
33322+
<td>
33323+
<code>dataLoaded</code><br/>
33324+
<em>
33325+
bool
33326+
</em>
33327+
</td>
33328+
<td>
33329+
<em>(Optional)</em>
33330+
<p>Represents whether the instance data is loaded.</p>
33331+
</td>
33332+
</tr>
33333+
<tr>
33334+
<td>
33335+
<code>memberJoined</code><br/>
3331233336
<em>
3331333337
bool
3331433338
</em>
@@ -33320,7 +33344,7 @@ bool
3332033344
</tr>
3332133345
<tr>
3332233346
<td>
33323-
<code>volumeExpansion</code><br/>
33347+
<code>inVolumeExpansion</code><br/>
3332433348
<em>
3332533349
bool
3332633350
</em>
@@ -33450,7 +33474,43 @@ string
3345033474
</tr>
3345133475
<tr>
3345233476
<td>
33453-
<code>volumeExpansion</code><br/>
33477+
<code>provisioned</code><br/>
33478+
<em>
33479+
bool
33480+
</em>
33481+
</td>
33482+
<td>
33483+
<em>(Optional)</em>
33484+
<p>Represents whether the instance is provisioned.</p>
33485+
</td>
33486+
</tr>
33487+
<tr>
33488+
<td>
33489+
<code>dataLoaded</code><br/>
33490+
<em>
33491+
bool
33492+
</em>
33493+
</td>
33494+
<td>
33495+
<em>(Optional)</em>
33496+
<p>Represents whether the instance data is loaded.</p>
33497+
</td>
33498+
</tr>
33499+
<tr>
33500+
<td>
33501+
<code>memberJoined</code><br/>
33502+
<em>
33503+
bool
33504+
</em>
33505+
</td>
33506+
<td>
33507+
<em>(Optional)</em>
33508+
<p>Represents whether the instance is joined the cluster.</p>
33509+
</td>
33510+
</tr>
33511+
<tr>
33512+
<td>
33513+
<code>inVolumeExpansion</code><br/>
3345433514
<em>
3345533515
bool
3345633516
</em>

pkg/controller/component/workload_utils.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ func ListOwnedPods(ctx context.Context, cli client.Reader, namespace, clusterNam
4848
return listPods(ctx, cli, namespace, clusterName, compName, nil, opts...)
4949
}
5050

51-
func ListOwnedPodsWithRole(ctx context.Context, cli client.Reader, namespace, clusterName, compName, role string,
52-
opts ...client.ListOption) ([]*corev1.Pod, error) {
53-
roleLabel := map[string]string{constant.RoleLabelKey: role}
54-
return listPods(ctx, cli, namespace, clusterName, compName, roleLabel, opts...)
55-
}
56-
5751
func ListOwnedServices(ctx context.Context, cli client.Reader, namespace, clusterName, compName string,
5852
opts ...client.ListOption) ([]*corev1.Service, error) {
5953
labels := constant.GetCompLabels(clusterName, compName)

pkg/operations/custom/utils.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"bytes"
2424
"context"
2525
"fmt"
26+
"slices"
2627
"sort"
2728
"strconv"
2829
"strings"
@@ -375,10 +376,11 @@ func getTargetPods(
375376
pods = append(pods, &podList.Items[i])
376377
}
377378
} else {
378-
if podSelector.Role != "" {
379-
pods, err = component.ListOwnedPodsWithRole(ctx, cli, cluster.Namespace, cluster.Name, compName, podSelector.Role)
380-
} else {
381-
pods, err = component.ListOwnedPods(ctx, cli, cluster.Namespace, cluster.Name, compName)
379+
pods, err = component.ListOwnedPods(ctx, cli, cluster.Namespace, cluster.Name, compName)
380+
if podSelector.Role != "" && err == nil {
381+
pods = slices.DeleteFunc(pods, func(pod *corev1.Pod) bool {
382+
return pod.Labels[constant.RoleLabelKey] != podSelector.Role
383+
})
382384
}
383385
}
384386
if err != nil {

0 commit comments

Comments
 (0)