Skip to content

Commit

Permalink
Added update to knative backend
Browse files Browse the repository at this point in the history
  • Loading branch information
catttam committed Oct 28, 2024
1 parent 82fc3ab commit 7955a03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 0 additions & 5 deletions pkg/backends/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"log"
"os"
"strings"

"github.com/goccy/go-yaml"
Expand All @@ -33,8 +32,6 @@ import (

const ConfigMapNameOSCAR = "additional-oscar-config"

var k8sLogger = log.New(os.Stdout, "[BACKEND-INFO] ", log.Flags())

// KubeBackend struct to represent a Kubernetes client to store services as podTemplates
type KubeBackend struct {
kubeClientset kubernetes.Interface
Expand Down Expand Up @@ -133,7 +130,6 @@ func (k *KubeBackend) CreateService(service types.Service) error {
}
//Create deaemonset to cache the service image on all the nodes
if service.ImagePrefetch {
k8sLogger.Println("Updating service image on all working nodes")
err = imagepuller.CreateDaemonset(k.config, service, k.kubeClientset)
if err != nil {
return err
Expand Down Expand Up @@ -222,7 +218,6 @@ func (k *KubeBackend) UpdateService(service types.Service) error {

//Create deaemonset to cache the service image on all the nodes
if service.ImagePrefetch {

err = imagepuller.CreateDaemonset(k.config, service, k.kubeClientset)
if err != nil {
return err
Expand Down
8 changes: 8 additions & 0 deletions pkg/backends/knative.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ func (kn *KnativeBackend) UpdateService(service types.Service) error {
}
}

//Create deaemonset to cache the service image on all the nodes
if service.ImagePrefetch {
err = imagepuller.CreateDaemonset(kn.config, service, kn.kubeClientset)
if err != nil {
return err
}
}

return nil
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/imagepuller/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ func CreateDaemonset(cfg *types.Config, service types.Service, kubeClientset kub
if err != nil {
DaemonSetLoggerInfo.Println(err)
return fmt.Errorf("failed to create daemonset: %s", err.Error())
} else {
DaemonSetLoggerInfo.Println("Created daemonset for service:", service.Name)
}

//Set watcher informer
Expand Down

0 comments on commit 7955a03

Please sign in to comment.