Skip to content

Commit

Permalink
feat: add completion timestamp for bench (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengluodb authored May 6, 2024
1 parent 00e9339 commit e06a9c8
Show file tree
Hide file tree
Showing 34 changed files with 130 additions and 2 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha1/fio_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ type FioStatus struct {
// total is the number of pgbench runs
Total int `json:"total,omitempty"`

// the completion timestamp of the test
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`

// Describes the current state of benchmark conditions.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/pgbench_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ type PgbenchStatus struct {
// Describes the current state of benchmark conditions.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// the completion timestamp of the test
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/redisbench_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ type RedisBenchStatus struct {
// Describes the current state of benchmark conditions.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// the completion timestamp of the test
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/sysbench_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ type SysbenchStatus struct {
// Describes the current state of benchmark conditions.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// the completion timestamp of the test
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/tpcc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ type TpccStatus struct {
// Describes the current state of benchmark conditions.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// the completion timestamp of the test
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/tpcds_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ type TpcdsStatus struct {
// Describes the current state of benchmark conditions.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// the completion timestamp of the test
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/tpch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type TpchStatus struct {
// Describes the current state of benchmark conditions.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// the completion timestamp of the test
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/ycsb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ type YcsbStatus struct {
// Describes the current state of benchmark conditions.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// the completion timestamp of the test
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
32 changes: 32 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_fios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_pgbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_redisbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_sysbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_tpccs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_tpcds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_tpches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_ycsbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_fios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_pgbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_redisbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_sysbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_tpccs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_tpcds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_tpches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_ycsbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ spec:
type: object
status:
properties:
completionTimestamp:
format: date-time
type: string
completions:
type: string
conditions:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ image:
pullPolicy: IfNotPresent
registry: registry.cn-hangzhou.aliyuncs.com
# Overrides the image tag whose default is the chart appVersion.
tag: "0.0.7"
tag: "0.0.8"

imagePullSecrets: []
nameOverride: ""
Expand Down
3 changes: 3 additions & 0 deletions internal/controller/fio_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ package controller
import (
"context"
"fmt"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -76,6 +78,7 @@ func (r *FioReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R

if fio.Status.Succeeded >= fio.Status.Total {
fio.Status.Phase = benchmarkv1alpha1.Completed
fio.Status.CompletionTimestamp = &metav1.Time{Time: time.Now()}
} else {
job := jobs[fio.Status.Succeeded]

Expand Down
3 changes: 3 additions & 0 deletions internal/controller/pgbench_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import (
"context"
"fmt"
"strings"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -76,6 +78,7 @@ func (r *PgbenchReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct

if pgbench.Status.Succeeded >= pgbench.Status.Total {
pgbench.Status.Phase = benchmarkv1alpha1.Completed
pgbench.Status.CompletionTimestamp = &metav1.Time{Time: time.Now()}
} else {
job := jobs[pgbench.Status.Succeeded]

Expand Down
3 changes: 3 additions & 0 deletions internal/controller/redisbench_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import (
"context"
"fmt"
"strings"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -77,6 +79,7 @@ func (r *RedisbenchReconciler) Reconcile(ctx context.Context, req ctrl.Request)
if redisbench.Status.Succeeded >= redisbench.Status.Total {
l.Info("redisbench complete", "redisbench", redisbench.Name)
redisbench.Status.Phase = benchmarkv1alpha1.Completed
redisbench.Status.CompletionTimestamp = &metav1.Time{Time: time.Now()}
} else {
job := jobs[redisbench.Status.Succeeded]

Expand Down
Loading

0 comments on commit e06a9c8

Please sign in to comment.