Skip to content

Commit

Permalink
Add method for container ID getter
Browse files Browse the repository at this point in the history
Signed-off-by: raihankhan <[email protected]>
  • Loading branch information
raihankhan committed Jun 24, 2024
1 parent f258d6e commit 7ed2c99
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/v1/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ func GetContainerByName(containers []core.Container, name string) *core.Containe
return nil
}

func GetContainerIdByName(containers []core.Container, name string) int {
for i := range containers {
if containers[i].Name == name {
return i
}
}
return -1
}

func UpsertContainer(containers []core.Container, upsert core.Container) []core.Container {
for i, container := range containers {
if container.Name == upsert.Name {
Expand Down

0 comments on commit 7ed2c99

Please sign in to comment.