mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-02-14 09:59:57 +00:00
* feat: functional appsets * feat(api): add resourcepools api Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: fix gomod Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: correct webhooks Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: fix harpoon image Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: improve e2e Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: add labels to e2e test Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: fix status handling Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: fix racing conditions Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: make values compatible Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: fix custom resources test Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: correct metrics Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> --------- Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
46 lines
862 B
Go
46 lines
862 B
Go
// Copyright 2020-2023 Project Capsule Authors.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package meta
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
)
|
|
|
|
const (
|
|
FreezeLabel = "projectcapsule.dev/freeze"
|
|
FreezeLabelTrigger = "true"
|
|
)
|
|
|
|
func FreezeLabelTriggers(obj client.Object) bool {
|
|
return labelTriggers(obj, FreezeLabel, FreezeLabelTrigger)
|
|
}
|
|
|
|
func FreezeLabelRemove(obj client.Object) {
|
|
labelRemove(obj, FreezeLabel)
|
|
}
|
|
|
|
func labelRemove(obj client.Object, anno string) {
|
|
annotations := obj.GetLabels()
|
|
|
|
if _, ok := annotations[anno]; ok {
|
|
delete(annotations, anno)
|
|
|
|
obj.SetLabels(annotations)
|
|
}
|
|
}
|
|
|
|
func labelTriggers(obj client.Object, anno string, trigger string) bool {
|
|
annotations := obj.GetLabels()
|
|
|
|
if val, ok := annotations[anno]; ok {
|
|
if strings.ToLower(val) == trigger {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|