Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Fixed image handing on mutating webhook for images with all 3 components
Browse files Browse the repository at this point in the history
  • Loading branch information
Elio Marcolino committed Jul 11, 2019
1 parent 17aaddd commit 32ef22a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/kubenab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,14 @@ func handleContainer(container *v1.Container, dockerRegistryUrl string) bool {
message := fmt.Sprintf("Image is not being pulled from Private Registry: %s", container.Image)
log.Printf(message)

newImage := dockerRegistryUrl + "/" + container.Image
imageParts := strings.Split(container.Image, "/")
newImage := ""
if len(imageParts) < 3 {
newImage = dockerRegistryUrl + "/" + container.Image
} else {
imageParts[0] = dockerRegistryUrl
newImage = strings.Join(imageParts, "/")
}
log.Printf("Changing image registry to: %s", newImage)

container.Image = newImage
Expand Down

0 comments on commit 32ef22a

Please # to comment.