Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apis/apps/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ type InstanceTemplate struct {
// then the instance names generated under this InstanceTemplate would be
// $(cluster.name)-$(component.name)-$(template.name)-0、$(cluster.name)-$(component.name)-$(template.name)-1 and
// $(cluster.name)-$(component.name)-$(template.name)-7
//
// +optional
Ordinals Ordinals `json:"ordinals,omitempty"`

// Specifies a map of key-value pairs to be merged into the Pod's existing annotations.
Expand Down
2 changes: 1 addition & 1 deletion apis/operations/v1alpha1/opsrequest_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ func (r *OpsRequest) getSCNameByPvcAndCheckStorageSize(ctx context.Context,
}
var pvc *corev1.PersistentVolumeClaim
for _, pvcItem := range pvcList.Items {
if targetInsTPLName == pvcItem.Labels[constant.KBAppComponentInstanceTemplateLabelKey] {
if targetInsTPLName == pvcItem.Labels[constant.KBAppInstanceTemplateLabelKey] {
pvc = &pvcItem
break
}
Expand Down
7 changes: 5 additions & 2 deletions apis/workloads/v1/instanceset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ const (
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas
// +kubebuilder:storageversion
// +kubebuilder:resource:categories={kubeblocks},shortName=its
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.readyReplicas",description="ready replicas."
// +kubebuilder:printcolumn:name="DESIRED",type="string",JSONPath=".spec.replicas",description="desired replicas."
// +kubebuilder:printcolumn:name="UP-TO-DATE",type="string",JSONPath=".status.updatedReplicas",description="updated replicas."
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.readyReplicas",description="ready replicas."
// +kubebuilder:printcolumn:name="AVAILABLE",type="string",JSONPath=".status.availableReplicas",description="available replicas, which are ready for at least minReadySeconds."
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"

Expand Down Expand Up @@ -266,11 +266,14 @@ type InstanceSetStatus struct {
Replicas int32 `json:"replicas"`

// Ordinals is the ordinals used by the instances of the InstanceSet except the template instances.
//
// +optional
Ordinals []int32 `json:"ordinals,omitempty"`

// readyReplicas is the number of instances created for this InstanceSet with a Ready Condition.
ReadyReplicas int32 `json:"readyReplicas,omitempty"`
//
// +optional
ReadyReplicas int32 `json:"readyReplicas"`

// currentReplicas is the number of instances created by the InstanceSet controller from the InstanceSet version
// indicated by CurrentRevisions.
Expand Down
8 changes: 4 additions & 4 deletions config/crd/bases/workloads.kubeblocks.io_instancesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: ready replicas.
jsonPath: .status.readyReplicas
name: READY
type: string
- description: desired replicas.
jsonPath: .spec.replicas
name: DESIRED
Expand All @@ -32,6 +28,10 @@ spec:
jsonPath: .status.updatedReplicas
name: UP-TO-DATE
type: string
- description: ready replicas.
jsonPath: .status.readyReplicas
name: READY
type: string
- description: available replicas, which are ready for at least minReadySeconds.
jsonPath: .status.availableReplicas
name: AVAILABLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ func copyAndMergeComponent(oldCompObj, newCompObj *appsv1.Component) *appsv1.Com
compObjCopy.Spec.SchedulingPolicy = compProto.Spec.SchedulingPolicy
compObjCopy.Spec.TLSConfig = compProto.Spec.TLSConfig
compObjCopy.Spec.Instances = compProto.Spec.Instances
compObjCopy.Spec.FlatInstanceOrdinal = compProto.Spec.FlatInstanceOrdinal
compObjCopy.Spec.OfflineInstances = compProto.Spec.OfflineInstances
compObjCopy.Spec.RuntimeClassName = compProto.Spec.RuntimeClassName
compObjCopy.Spec.DisableExporter = compProto.Spec.DisableExporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ func copyAndMergeITS(oldITS, newITS *workloads.InstanceSet) *workloads.InstanceS
itsObjCopy.Spec.MembershipReconfiguration = itsProto.Spec.MembershipReconfiguration
itsObjCopy.Spec.TemplateVars = itsProto.Spec.TemplateVars
itsObjCopy.Spec.Instances = itsProto.Spec.Instances
itsObjCopy.Spec.FlatInstanceOrdinal = itsProto.Spec.FlatInstanceOrdinal
itsObjCopy.Spec.OfflineInstances = itsProto.Spec.OfflineInstances
itsObjCopy.Spec.MinReadySeconds = itsProto.Spec.MinReadySeconds
itsObjCopy.Spec.VolumeClaimTemplates = itsProto.Spec.VolumeClaimTemplates
Expand Down
1 change: 0 additions & 1 deletion controllers/apps/shardingdefinition_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func (r *ShardingDefinitionReconciler) Reconcile(ctx context.Context, req ctrl.R
}

if err := r.validate(r.Client, reqCtx, shardingDef); err != nil {
fmt.Printf("error: %v\n", err)
if err1 := r.unavailable(reqCtx, shardingDef, err); err1 != nil {
return intctrlutil.CheckedRequeueWithError(err1, reqCtx.Log, "")
}
Expand Down
8 changes: 4 additions & 4 deletions deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: ready replicas.
jsonPath: .status.readyReplicas
name: READY
type: string
- description: desired replicas.
jsonPath: .spec.replicas
name: DESIRED
Expand All @@ -32,6 +28,10 @@ spec:
jsonPath: .status.updatedReplicas
name: UP-TO-DATE
type: string
- description: ready replicas.
jsonPath: .status.readyReplicas
name: READY
type: string
- description: available replicas, which are ready for at least minReadySeconds.
jsonPath: .status.availableReplicas
name: AVAILABLE
Expand Down
2 changes: 2 additions & 0 deletions docs/developer_docs/api-reference/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -7964,6 +7964,7 @@ Ordinals
</em>
</td>
<td>
<em>(Optional)</em>
<p>Specifies the desired Ordinals of this InstanceTemplate.
The Ordinals used to specify the ordinal of the instance (pod) names to be generated under this InstanceTemplate.
If Ordinals are defined, their number must be equal to or more than the corresponding replicas.</p>
Expand Down Expand Up @@ -30538,6 +30539,7 @@ int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>readyReplicas is the number of instances created for this InstanceSet with a Ready Condition.</p>
</td>
</tr>
Expand Down
8 changes: 4 additions & 4 deletions pkg/constant/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ const (
KBAppComponentLabelKey = "apps.kubeblocks.io/component-name"
KBAppShardingNameLabelKey = "apps.kubeblocks.io/sharding-name"

KBAppComponentInstanceTemplateLabelKey = "apps.kubeblocks.io/instance-template"
PVCNameLabelKey = "apps.kubeblocks.io/pvc-name"
VolumeClaimTemplateNameLabelKey = "apps.kubeblocks.io/vct-name"
KBAppPodNameLabelKey = "apps.kubeblocks.io/pod-name"
KBAppInstanceTemplateLabelKey = "apps.kubeblocks.io/instance-template"
PVCNameLabelKey = "apps.kubeblocks.io/pvc-name"
VolumeClaimTemplateNameLabelKey = "apps.kubeblocks.io/vct-name"
KBAppPodNameLabelKey = "apps.kubeblocks.io/pod-name"

RoleLabelKey = "kubeblocks.io/role" // RoleLabelKey consensusSet and replicationSet role label key
KBAppServiceVersionKey = "apps.kubeblocks.io/service-version"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/factory/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func BuildPersistentVolumeClaimLabels(component *component.SynthesizedComponent,
}
pvc.Labels[constant.VolumeClaimTemplateNameLabelKey] = pvcTplName
if templateName != "" {
pvc.Labels[constant.KBAppComponentInstanceTemplateLabelKey] = templateName
pvc.Labels[constant.KBAppInstanceTemplateLabelKey] = templateName
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/instanceset/instance_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ func buildInstancePVCByTemplate(name string, template *instancetemplate.Instance
SetSpec(*claimTemplate.Spec.DeepCopy()).
GetObject()
if template.Name != "" {
pvc.Labels[constant.KBAppComponentInstanceTemplateLabelKey] = template.Name
pvc.Labels[constant.KBAppInstanceTemplateLabelKey] = template.Name
}
pvcs = append(pvcs, pvc)
}
Expand Down