IsLabelSubset checks if a collection of labels is a subset of another NOTE: there are two parameters for the labels to check. The `fixed` one is for labels that certainly should be inherited (`inheritedMetadata` in the spec) The other labels may or may not be inherited depending on the configuratio
( mapSet, clusterLabels, fixedInheritedLabels map[string]string, controller InheritanceController, )
| 72 | // is for labels that certainly should be inherited (`inheritedMetadata` in the spec) |
| 73 | // The other labels may or may not be inherited depending on the configuration |
| 74 | func IsLabelSubset( |
| 75 | mapSet, |
| 76 | clusterLabels, |
| 77 | fixedInheritedLabels map[string]string, |
| 78 | controller InheritanceController, |
| 79 | ) bool { |
| 80 | mapToEvaluate := map[string]string{} |
| 81 | |
| 82 | for key, value := range fixedInheritedLabels { |
| 83 | mapToEvaluate[key] = value |
| 84 | } |
| 85 | |
| 86 | for key, value := range clusterLabels { |
| 87 | if controller.IsLabelInherited(key) { |
| 88 | mapToEvaluate[key] = value |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | return IsMapSubset(mapSet, mapToEvaluate) |
| 93 | } |
| 94 | |
| 95 | // IsAnnotationSubset checks if a collection of annotations is a subset of another |
| 96 | // |
no test coverage detected