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

Function InheritLabels

pkg/utils/labels_annotations.go:450–469  ·  view source on GitHub ↗

InheritLabels puts into the object metadata the passed labels if the labels are supposed to be inherited. The passed configuration is used to determine whenever a certain label is inherited or not

(
	object *metav1.ObjectMeta,
	labels map[string]string,
	fixedLabels map[string]string,
	controller InheritanceController,
)

Source from the content-addressed store, hash-verified

448// the labels are supposed to be inherited. The passed configuration is
449// used to determine whenever a certain label is inherited or not
450func InheritLabels(
451 object *metav1.ObjectMeta,
452 labels map[string]string,
453 fixedLabels map[string]string,
454 controller InheritanceController,
455) {
456 if object.Labels == nil {
457 object.Labels = make(map[string]string)
458 }
459
460 for key, value := range fixedLabels {
461 object.Labels[key] = value
462 }
463
464 for key, value := range labels {
465 if controller.IsLabelInherited(key) {
466 object.Labels[key] = value
467 }
468 }
469}
470
471func getAnnotationAppArmor(spec *corev1.PodSpec, annotations map[string]string) map[string]string {
472 containsContainerWithName := func(name string, containers ...corev1.Container) bool {

Callers 7

createMajorUpgradeJobFunction · 0.92
newLabelReconcilerFunction · 0.92
updateClusterLabelsFunction · 0.92
inheritJobMetadataFunction · 0.92
SetInheritedDataMethod · 0.92

Calls 1

IsLabelInheritedMethod · 0.65

Tested by

no test coverage detected