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, )
| 448 | // the labels are supposed to be inherited. The passed configuration is |
| 449 | // used to determine whenever a certain label is inherited or not |
| 450 | func 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 | |
| 471 | func getAnnotationAppArmor(spec *corev1.PodSpec, annotations map[string]string) map[string]string { |
| 472 | containsContainerWithName := func(name string, containers ...corev1.Container) bool { |
no test coverage detected