Skip to content

Commit

Permalink
Added logs to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
catttam committed Nov 24, 2023
1 parent f6839a9 commit b7a4106
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/backends/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"log"
"os"

"github.com/goccy/go-yaml"
"github.com/grycap/oscar/v2/pkg/imagepuller"
Expand All @@ -30,6 +31,8 @@ import (
"k8s.io/client-go/kubernetes"
)

var K8sLoggerInfo = 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 @@ -77,6 +80,7 @@ func (k *KubeBackend) ListServices() ([]*types.Service, error) {

// CreateService creates a new service as a k8s podTemplate
func (k *KubeBackend) CreateService(service types.Service) error {
K8sLoggerInfo.Println("Creating service with K8s backend")
// Validate the input variables of the service
service = utils.ValidateService(service)
// Create the configMap with FDL and user-script
Expand Down
4 changes: 4 additions & 0 deletions pkg/backends/knative.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"log"
"net/http"
"os"
"strconv"

"github.com/grycap/oscar/v2/pkg/imagepuller"
Expand All @@ -33,6 +34,8 @@ import (
knclientset "knative.dev/serving/pkg/client/clientset/versioned"
)

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

// KnativeBackend struct to represent a Knative client
type KnativeBackend struct {
kubeClientset kubernetes.Interface
Expand Down Expand Up @@ -94,6 +97,7 @@ func (kn *KnativeBackend) ListServices() ([]*types.Service, error) {

// CreateService creates a new service as a Knative service
func (kn *KnativeBackend) CreateService(service types.Service) error {
KnativeLoggerInfo.Println("Creating service with Knative backend")
// Validate the input variables of the service
service = utils.ValidateService(service)
// Create the configMap with FDL and user-script
Expand Down

0 comments on commit b7a4106

Please sign in to comment.