vpaMinReplicas sets the VPA minimum replicas required for eviction
(obj runtime.Object)
| 445 | |
| 446 | // vpaMinReplicas sets the VPA minimum replicas required for eviction |
| 447 | func vpaMinReplicasForResource(obj runtime.Object) (*int32, bool) { |
| 448 | explicit := false |
| 449 | |
| 450 | minReplicasString := "" |
| 451 | accessor, _ := meta.Accessor(obj) |
| 452 | if val, ok := accessor.GetAnnotations()[utils.VpaMinReplicasAnnotation]; ok { |
| 453 | minReplicasString = val |
| 454 | } else if val, ok := accessor.GetLabels()[utils.VpaMinReplicasAnnotation]; ok { |
| 455 | minReplicasString = val |
| 456 | } |
| 457 | |
| 458 | if minReplicasString == "" { |
| 459 | return nil, explicit |
| 460 | } |
| 461 | |
| 462 | explicit = true |
| 463 | minReplicas, err := strconv.ParseInt(minReplicasString, 10, 32) |
| 464 | if err != nil { |
| 465 | klog.Error(err.Error()) |
| 466 | return nil, explicit |
| 467 | } |
| 468 | |
| 469 | minReplicasInt32 := int32(minReplicas) |
| 470 | |
| 471 | return &minReplicasInt32, explicit |
| 472 | } |
no outgoing calls