Skip to content

Commit

Permalink
Merge branch 'main' into gh_action_markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Disper authored Oct 24, 2024
2 parents 0db3d5c + e26c11e commit 8bb951a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_kim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ jobs:
path: ${{ env.trivy-table }}

- name: Print trivy table
if: success() || failure()
run: test -f ${{ env.trivy-table }} && cat ${{ env.trivy-table }} || echo ':: no data ::'
if: success() || failure()
run: "test -f ${{ env.trivy-table }} && cat ${{ env.trivy-table }} || echo ':: no data ::'"

build-image:
needs: setup
Expand Down
12 changes: 11 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package main

import (
"context"
"encoding/json"
"flag"
"fmt"
Expand All @@ -27,7 +28,7 @@ import (
"github.com/gardener/gardener/pkg/apis/core/v1beta1"
gardener_apis "github.com/gardener/gardener/pkg/client/core/clientset/versioned/typed/core/v1beta1"
gardener_oidc "github.com/gardener/oidc-webhook-authenticator/apis/authentication/v1alpha1"
"github.com/go-playground/validator/v10"
validator "github.com/go-playground/validator/v10"
infrastructuremanagerv1 "github.com/kyma-project/infrastructure-manager/api/v1"
"github.com/kyma-project/infrastructure-manager/internal/auditlogging"
kubeconfig_controller "github.com/kyma-project/infrastructure-manager/internal/controller/kubeconfig"
Expand Down Expand Up @@ -182,6 +183,15 @@ func main() {
os.Exit(1)
}

// refresh runtime metrics
metrics.ResetRuntimeMetrics()
var runtimeList infrastructuremanagerv1.RuntimeList
if err = mgr.GetClient().List(context.TODO(), &runtimeList); err != nil {
for _, rt := range runtimeList.Items {
metrics.SetRuntimeStates(rt)
}
}

cfg := fsm.RCCfg{
GardenerRequeueDuration: defaultGardenerRequeueDuration,
ControlPlaneRequeueDuration: defaultControlPlaneRequeueDuration,
Expand Down
5 changes: 5 additions & 0 deletions internal/controller/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (
type Metrics interface {
SetRuntimeStates(runtime v1.Runtime)
CleanUpRuntimeGauge(runtimeID string)
ResetRuntimeMetrics()
IncRuntimeFSMStopCounter()
SetGardenerClusterStates(cluster v1.GardenerCluster)
CleanUpGardenerClusterGauge(runtimeID string)
Expand Down Expand Up @@ -100,6 +101,10 @@ func (m metricsImpl) CleanUpRuntimeGauge(runtimeID string) {
})
}

func (m metricsImpl) ResetRuntimeMetrics() {
m.runtimeStateGauge.Reset()
}

func (m metricsImpl) IncRuntimeFSMStopCounter() {
m.runtimeFSMUnexpectedStopsCnt.Inc()
}
Expand Down
5 changes: 5 additions & 0 deletions internal/controller/metrics/mocks/Metrics.go

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

0 comments on commit 8bb951a

Please sign in to comment.