diff --git a/internal/dashboard/business/oceanbase/obcluster.go b/internal/dashboard/business/oceanbase/obcluster.go index b22a1fd8..f471db43 100644 --- a/internal/dashboard/business/oceanbase/obcluster.go +++ b/internal/dashboard/business/oceanbase/obcluster.go @@ -77,6 +77,7 @@ func buildOBClusterOverview(ctx context.Context, obcluster *v1alpha1.OBCluster) clusterMode := modelcommon.ClusterModeNormal annotations := obcluster.GetAnnotations() deletionProtection := false + pvcIndependent := false if annotations != nil { if mode, ok := annotations[oceanbaseconst.AnnotationsMode]; ok { switch mode { @@ -88,6 +89,7 @@ func buildOBClusterOverview(ctx context.Context, obcluster *v1alpha1.OBCluster) } } deletionProtection = annotations[oceanbaseconst.AnnotationsIgnoreDeletion] == "true" + pvcIndependent = annotations[oceanbaseconst.AnnotationsIndependentPVCLifecycle] == "true" } return &response.OBClusterOverview{ OBClusterMeta: response.OBClusterMeta{ @@ -99,6 +101,7 @@ func buildOBClusterOverview(ctx context.Context, obcluster *v1alpha1.OBCluster) Mode: clusterMode, SupportStaticIP: obcluster.SupportStaticIP(), DeletionProtection: deletionProtection, + PvcIndependent: pvcIndependent, }, Status: getStatisticStatus(obcluster), StatusDetail: obcluster.Status.Status, @@ -169,6 +172,16 @@ func buildOBClusterResponse(ctx context.Context, obcluster *v1alpha1.OBCluster) }, } } + if obcluster.Annotations != nil { + annotations := make([]modelcommon.KVPair, 0) + for k, v := range obcluster.Annotations { + annotations = append(annotations, modelcommon.KVPair{ + Key: k, + Value: v, + }) + } + respCluster.OBClusterExtra.Annotations = annotations + } return respCluster, nil } diff --git a/internal/dashboard/business/oceanbase/obtenant.go b/internal/dashboard/business/oceanbase/obtenant.go index 188a8a3e..f6c28915 100644 --- a/internal/dashboard/business/oceanbase/obtenant.go +++ b/internal/dashboard/business/oceanbase/obtenant.go @@ -33,6 +33,7 @@ import ( "github.com/oceanbase/ob-operator/internal/clients/schema" oceanbaseconst "github.com/oceanbase/ob-operator/internal/const/oceanbase" "github.com/oceanbase/ob-operator/internal/const/status/tenantstatus" + "github.com/oceanbase/ob-operator/internal/dashboard/model/common" "github.com/oceanbase/ob-operator/internal/dashboard/model/param" "github.com/oceanbase/ob-operator/internal/dashboard/model/response" oberr "github.com/oceanbase/ob-operator/pkg/errors" @@ -193,6 +194,16 @@ func buildDetailFromApiType(t *v1alpha1.OBTenant) *response.OBTenantDetail { rt.RestoreSource.Until = *t.Spec.Source.Restore.Until.Timestamp } } + if t.Annotations != nil { + annotations := make([]common.KVPair, 0, len(t.Annotations)) + for k, v := range t.Annotations { + annotations = append(annotations, common.KVPair{ + Key: k, + Value: v, + }) + } + rt.Annotations = annotations + } return rt } diff --git a/internal/dashboard/model/response/obcluster.go b/internal/dashboard/model/response/obcluster.go index 5e62b356..9a103270 100644 --- a/internal/dashboard/model/response/obcluster.go +++ b/internal/dashboard/model/response/obcluster.go @@ -61,6 +61,7 @@ type OBClusterMeta struct { SupportStaticIP bool `json:"supportStaticIP" binding:"required"` DeletionProtection bool `json:"deletionProtection" binding:"required"` + PvcIndependent bool `json:"pvcIndependent" binding:"required"` } type OBClusterOverview struct { @@ -100,6 +101,7 @@ type OBClusterExtra struct { Parameters []ParameterSpec `json:"parameters" binding:"required"` Monitor *MonitorSpec `json:"monitor"` BackupVolume *NFSVolumeSpec `json:"backupVolume"` + Annotations []common.KVPair `json:"annotations"` } type MonitorSpec struct { diff --git a/internal/dashboard/model/response/obtenant.go b/internal/dashboard/model/response/obtenant.go index 29daf341..57ee4d99 100644 --- a/internal/dashboard/model/response/obtenant.go +++ b/internal/dashboard/model/response/obtenant.go @@ -12,6 +12,8 @@ See the Mulan PSL v2 for more details. package response +import "github.com/oceanbase/ob-operator/internal/dashboard/model/common" + // @Description Brief information about OBTenant type OBTenantOverview struct { UID string `json:"uid" binding:"required"` // Unique identifier of the resource @@ -37,8 +39,9 @@ type OBTenantDetail struct { StandbyROCredential string `json:"standbyROCredential"` Version string `json:"version"` - PrimaryTenant string `json:"primaryTenant"` - RestoreSource *RestoreSource `json:"restoreSource,omitempty"` + PrimaryTenant string `json:"primaryTenant"` + RestoreSource *RestoreSource `json:"restoreSource,omitempty"` + Annotations []common.KVPair `json:"annotations"` } type OBTenantReplica struct {