mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
util: use slices package for contains
use slices package to check whether the slice contains the element or not. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
86b5db90bc
commit
1e0254daba
@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
@ -349,17 +350,6 @@ func waitForDeploymentUpdate(
|
||||
return nil
|
||||
}
|
||||
|
||||
// contains check if slice contains string.
|
||||
func contains(s []string, e string) bool {
|
||||
for _, a := range s {
|
||||
if a == e {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func waitForContainersArgsUpdate(
|
||||
c kubernetes.Interface,
|
||||
ns,
|
||||
@ -398,7 +388,7 @@ func waitForContainersArgsUpdate(
|
||||
}
|
||||
cid := deployment.Spec.Template.Spec.Containers // cid: read as containers in deployment
|
||||
for i := range cid {
|
||||
if contains(containers, cid[i].Name) {
|
||||
if slices.Contains(containers, cid[i].Name) {
|
||||
match := false
|
||||
for j, ak := range cid[i].Args {
|
||||
if ak == key {
|
||||
|
Reference in New Issue
Block a user