12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
- package collector
15
+ package manifestutils
16
16
17
17
import (
18
18
"crypto/sha256"
@@ -23,7 +23,7 @@ import (
23
23
)
24
24
25
25
// Annotations return the annotations for OpenTelemetryCollector pod.
26
- func Annotations (instance v1beta1.OpenTelemetryCollector ) (map [string ]string , error ) {
26
+ func Annotations (instance v1beta1.OpenTelemetryCollector , filterAnnotations [] string ) (map [string ]string , error ) {
27
27
// new map every time, so that we don't touch the instance's annotations
28
28
annotations := map [string ]string {}
29
29
@@ -36,9 +36,11 @@ func Annotations(instance v1beta1.OpenTelemetryCollector) (map[string]string, er
36
36
}
37
37
38
38
// allow override of prometheus annotations
39
- if nil != instance .Annotations {
40
- for k , v := range instance .Annotations {
41
- annotations [k ] = v
39
+ if nil != instance .ObjectMeta .Annotations {
40
+ for k , v := range instance .ObjectMeta .Annotations {
41
+ if ! IsFilteredSet (k , filterAnnotations ) {
42
+ annotations [k ] = v
43
+ }
42
44
}
43
45
}
44
46
@@ -54,16 +56,18 @@ func Annotations(instance v1beta1.OpenTelemetryCollector) (map[string]string, er
54
56
}
55
57
56
58
// PodAnnotations return the spec annotations for OpenTelemetryCollector pod.
57
- func PodAnnotations (instance v1beta1.OpenTelemetryCollector ) (map [string ]string , error ) {
59
+ func PodAnnotations (instance v1beta1.OpenTelemetryCollector , filterAnnotations [] string ) (map [string ]string , error ) {
58
60
// new map every time, so that we don't touch the instance's annotations
59
61
podAnnotations := map [string ]string {}
60
-
61
- // allow override of pod annotations
62
- for k , v := range instance .Spec .PodAnnotations {
63
- podAnnotations [k ] = v
62
+ if nil != instance .Spec .PodAnnotations {
63
+ for k , v := range instance .Spec .PodAnnotations {
64
+ if ! IsFilteredSet (k , filterAnnotations ) {
65
+ podAnnotations [k ] = v
66
+ }
67
+ }
64
68
}
65
69
66
- annotations , err := Annotations (instance )
70
+ annotations , err := Annotations (instance , filterAnnotations )
67
71
if err != nil {
68
72
return nil , err
69
73
}
0 commit comments