Feat: upgrade cluster-gateway to use v1.8.0-alpha.3 & fix time metrics bug (#5593)

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
This commit is contained in:
Somefive
2023-03-02 14:49:48 +08:00
committed by GitHub
parent 5ed67d7bec
commit 4596aac043
6 changed files with 17 additions and 7 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ helm install --create-namespace -n vela-system kubevela kubevela/vela-core --wai
| `multicluster.clusterGateway.replicaCount` | ClusterGateway replica count | `1` |
| `multicluster.clusterGateway.port` | ClusterGateway port | `9443` |
| `multicluster.clusterGateway.image.repository` | ClusterGateway image repository | `oamdev/cluster-gateway` |
| `multicluster.clusterGateway.image.tag` | ClusterGateway image tag | `v1.7.0` |
| `multicluster.clusterGateway.image.tag` | ClusterGateway image tag | `v1.8.0-alpha.3` |
| `multicluster.clusterGateway.image.pullPolicy` | ClusterGateway image pull policy | `IfNotPresent` |
| `multicluster.clusterGateway.resources.limits.cpu` | ClusterGateway cpu limit | `100m` |
| `multicluster.clusterGateway.resources.limits.memory` | ClusterGateway memory limit | `200Mi` |
+1 -1
View File
@@ -150,7 +150,7 @@ multicluster:
port: 9443
image:
repository: oamdev/cluster-gateway
tag: v1.7.0
tag: v1.8.0-alpha.3
pullPolicy: IfNotPresent
resources:
limits:
@@ -290,7 +290,9 @@ func (r *Reconciler) stateKeep(logCtx monitorContext.Context, handler *AppHandle
return
}
t := time.Now()
defer metrics.AppReconcileStageDurationHistogram.WithLabelValues("state-keep").Observe(time.Since(t).Seconds())
defer func() {
metrics.AppReconcileStageDurationHistogram.WithLabelValues("state-keep").Observe(time.Since(t).Seconds())
}()
if err := handler.resourceKeeper.StateKeep(logCtx); err != nil {
logCtx.Error(err, "Failed to run prevent-configuration-drift")
r.Recorder.Event(app, event.Warning(velatypes.ReasonFailedStateKeep, err))
@@ -413,7 +413,9 @@ type garbageCollectFunc func(ctx context.Context, h *AppHandler) error
// - clean up legacy component revisions
func garbageCollection(ctx context.Context, h *AppHandler) error {
t := time.Now()
defer metrics.AppReconcileStageDurationHistogram.WithLabelValues("gc-rev").Observe(time.Since(t).Seconds())
defer func() {
metrics.AppReconcileStageDurationHistogram.WithLabelValues("gc-rev").Observe(time.Since(t).Seconds())
}()
collectFuncs := []garbageCollectFunc{
garbageCollectFunc(cleanUpApplicationRevision),
garbageCollectFunc(cleanUpWorkflowComponentRevision),
@@ -89,7 +89,9 @@ func (h *AppHandler) GenerateApplicationSteps(ctx monitorContext.Context,
appRev *v1beta1.ApplicationRevision) (*wfTypes.WorkflowInstance, []wfTypes.TaskRunner, error) {
t := time.Now()
defer metrics.AppReconcileStageDurationHistogram.WithLabelValues("generate-app-steps").Observe(time.Since(t).Seconds())
defer func() {
metrics.AppReconcileStageDurationHistogram.WithLabelValues("generate-app-steps").Observe(time.Since(t).Seconds())
}()
appLabels := map[string]string{
oam.LabelAppName: app.Name,
@@ -908,7 +908,9 @@ func cleanUpApplicationRevision(ctx context.Context, h *AppHandler) error {
return nil
}
t := time.Now()
defer metrics.AppReconcileStageDurationHistogram.WithLabelValues("gc-rev.apprev").Observe(time.Since(t).Seconds())
defer func() {
metrics.AppReconcileStageDurationHistogram.WithLabelValues("gc-rev.apprev").Observe(time.Since(t).Seconds())
}()
sortedRevision, err := GetSortedAppRevisions(ctx, h.r.Client, h.app.Name, h.app.Namespace)
if err != nil {
return err
@@ -962,7 +964,9 @@ func cleanUpWorkflowComponentRevision(ctx context.Context, h *AppHandler) error
return nil
}
t := time.Now()
defer metrics.AppReconcileStageDurationHistogram.WithLabelValues("gc-rev.comprev").Observe(time.Since(t).Seconds())
defer func() {
metrics.AppReconcileStageDurationHistogram.WithLabelValues("gc-rev.comprev").Observe(time.Since(t).Seconds())
}()
// collect component revision in use
compRevisionInUse := map[string]map[string]struct{}{}
ctx = auth.ContextWithUserInfo(ctx, h.app)