mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-04-03 07:18:49 +02:00
20 lines
385 B
Go
20 lines
385 B
Go
package helm
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
|
)
|
|
|
|
// note that we do not take into account if this is or is not a hook, caller should check
|
|
func Weight(obj *unstructured.Unstructured) int {
|
|
text, ok := obj.GetAnnotations()["helm.sh/hook-weight"]
|
|
if ok {
|
|
value, err := strconv.Atoi(text)
|
|
if err == nil {
|
|
return value
|
|
}
|
|
}
|
|
return 0
|
|
}
|