MCPcopy Index your code
hub / github.com/cloudnative-pg/cloudnative-pg / IsAnnotationSubset

Function IsAnnotationSubset

pkg/utils/operations.go:100–117  ·  view source on GitHub ↗

IsAnnotationSubset checks if a collection of annotations is a subset of another NOTE: there are two parameters for the annotations to check. The `fixed` one is for annotations that certainly should be inherited (`inheritedMetadata` in the spec) The other annotations may or may not be inherited depe

(
	mapSet, clusterAnnotations, fixedInheritedAnnotations map[string]string,
	controller InheritanceController,
)

Source from the content-addressed store, hash-verified

98// is for annotations that certainly should be inherited (`inheritedMetadata` in the spec)
99// The other annotations may or may not be inherited depending on the configuration
100func IsAnnotationSubset(
101 mapSet, clusterAnnotations, fixedInheritedAnnotations map[string]string,
102 controller InheritanceController,
103) bool {
104 mapToEvaluate := map[string]string{}
105
106 for key, value := range fixedInheritedAnnotations {
107 mapToEvaluate[key] = value
108 }
109
110 for key, value := range clusterAnnotations {
111 if controller.IsAnnotationInherited(key) {
112 mapToEvaluate[key] = value
113 }
114 }
115
116 return IsMapSubset(mapSet, mapToEvaluate)
117}

Callers 3

newAnnotationReconcilerFunction · 0.92
updateClusterAnnotationsFunction · 0.92
operations_test.goFile · 0.85

Calls 2

IsMapSubsetFunction · 0.85
IsAnnotationInheritedMethod · 0.65

Tested by

no test coverage detected