Skip to content

Commit

Permalink
Fix compile issues...
Browse files Browse the repository at this point in the history
  • Loading branch information
nagygergo committed May 21, 2024
1 parent 5bd6099 commit eef6825
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions func/internal/podevaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"net"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -101,7 +100,7 @@ func NewPodEvaluator(namespace, wrapperServerImage string, interval, ttl time.Du
wrapperServerImage: wrapperServerImage,
podReadyCh: readyCh,
functionPodTemplateName: functionPodTemplateName,
podReadyTimeout: 60 * time.Second,
podReadyTimeout: 60 * time.Second,
},
},
}
Expand Down Expand Up @@ -643,25 +642,34 @@ func (pm *podManager) getBasePodTemplate(ctx context.Context) (*corev1.Pod, erro

// Patches the expected port, and the original entrypoint of the kpt function into the function container
func (pm *podManager) patchNewPodArgs(pod *corev1.Pod, de digestAndEntrypoint) error {
slices.IndexFunc(pod.Spec.Containers, func(c corev1.Container)))
var patchedContainer bool
for _, container := range pod.Spec.Containers {
if container.Name == functionContainerName {
container.Args = append(container.Args,
"--port", defaultWrapperServerPort,
"--",
)
container.Args = append(container.Args, de.entrypoint...)
patchedContainer = true
}
}
if !patchedContainer {
return fmt.Errorf("haven't found the function container in the pod")
}
return nil
}

//
func (pm *podManager) patchNewPodImage(pod corev1.Pod, image string) error {
func (pm *podManager) patchNewPodImage(pod *corev1.Pod, image string) error {
var patchedContainer bool
for _, container := range pod.Spec.Containers {
if container.Name == functionContainerName {
container.Image = image
}
}
if !patchedContainer {
return fmt.Errorf("haven't found the function container in the pod")
}
return nil
}

// Patch labels and annotations so the cache manager can keep track of the pod
Expand Down

0 comments on commit eef6825

Please sign in to comment.