Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pluralsh/deployment-operator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.5.11
Choose a base ref
...
head repository: pluralsh/deployment-operator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.5.12
Choose a head ref
  • 2 commits
  • 4 files changed
  • 3 contributors

Commits on Feb 11, 2025

  1. Updated chart to release v0.5.11 (#369)

    Co-authored-by: michaeljguarino <michaeljguarino@users.noreply.github.com>
    github-actions[bot] and michaeljguarino authored Feb 11, 2025
    Copy the full SHA
    b7101a3 View commit details

Commits on Feb 12, 2025

  1. Only apply stale-if-fail health checks to whitelisted gvks (#370)

    This can prevent the ui from overfailing resources/services
    michaeljguarino authored Feb 12, 2025
    Copy the full SHA
    b55a3c6 View commit details
Showing with 26 additions and 4 deletions.
  1. +2 −2 charts/deployment-operator/Chart.yaml
  2. +2 −1 pkg/common/common.go
  3. +20 −1 pkg/common/health.go
  4. +2 −0 pkg/common/health_test.go
4 changes: 2 additions & 2 deletions charts/deployment-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: deployment-operator
description: creates a new instance of the plural deployment operator
appVersion: 0.5.10
version: 0.5.10
appVersion: 0.5.11
version: 0.5.11
maintainers:
- name: Plural
url: https://www.plural.sh
3 changes: 2 additions & 1 deletion pkg/common/common.go
Original file line number Diff line number Diff line change
@@ -22,7 +22,8 @@ func ToUnstructured(obj runtime.Object) (*unstructured.Unstructured, error) {
return nil, err
}

return &unstructured.Unstructured{Object: objMap}, nil
unstructured := &unstructured.Unstructured{Object: objMap}
return unstructured, nil
}

func Unmarshal(s string) (map[string]interface{}, error) {
21 changes: 20 additions & 1 deletion pkg/common/health.go
Original file line number Diff line number Diff line change
@@ -76,6 +76,13 @@ var (
Status: HealthStatusProgressing,
Message: "Waiting to Autoscale",
}

nonstaleGvks = []schema.GroupVersionKind{
{Group: "cert-manager.io", Kind: "Certificate"},
{Group: "deployments.plural.sh", Kind: "MetricsAggregate"},
{Group: "deployments.plural.sh", Kind: "KubecostExtractor"},
{Group: "deployments.plural.sh", Kind: "UpgradeInsights"},
}
)

type hpaCondition struct {
@@ -902,7 +909,7 @@ func GetOtherHealthStatus(obj *unstructured.Unstructured) (*HealthStatus, error)

// status older than 5min
cutoffTime := metav1.NewTime(time.Now().Add(-5 * time.Minute))
if cond.LastTransitionTime.Before(&cutoffTime) {
if cond.LastTransitionTime.Before(&cutoffTime) && staleIsFailing(obj) {
status = HealthStatusDegraded
}

@@ -918,3 +925,15 @@ func GetOtherHealthStatus(obj *unstructured.Unstructured) (*HealthStatus, error)

return defaultReadyStatus, nil
}

func staleIsFailing(obj *unstructured.Unstructured) bool {
gvk := obj.GetObjectKind().GroupVersionKind()

for _, val := range nonstaleGvks {
if val.Group == gvk.Group && val.Kind == gvk.Kind {
return true
}
}

return false
}
2 changes: 2 additions & 0 deletions pkg/common/health_test.go
Original file line number Diff line number Diff line change
@@ -81,6 +81,8 @@ var _ = Describe("Health Test", Ordered, func() {
},
}
obj, err := common.ToUnstructured(customResource)
obj.SetAPIVersion("deployments.plural.sh/v1alpha1")
obj.SetKind("MetricsAggregate")
Expect(err).NotTo(HaveOccurred())
status, err := common.GetResourceHealth(obj)
Expect(err).NotTo(HaveOccurred())