-
Notifications
You must be signed in to change notification settings - Fork 22
/
utils.go
32 lines (27 loc) · 850 Bytes
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
package source
import (
"strings"
"github.com/gardener/controller-manager-library/pkg/resources"
)
func requireFinalizer(src resources.Object, cluster resources.Cluster) bool {
return src.GetCluster() != cluster
}
// ExtractSecretLabels extracts label key value map from annotation
func ExtractSecretLabels(objData resources.ObjectData) (secretLabels map[string]string) {
if labels, ok := resources.GetAnnotation(objData, AnnotCertSecretLabels); ok {
secretLabels = map[string]string{}
for _, pair := range strings.Split(labels, ",") {
pair = strings.TrimSpace(pair)
items := strings.SplitN(pair, "=", 2)
if len(items) == 2 {
secretLabels[items[0]] = items[1]
}
}
}
return
}