Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shalberd committed Aug 2, 2024
1 parent 12e6631 commit 8f2102e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const (
// OpenshiftNotebookReconciler holds the controller configuration.
type OpenshiftNotebookReconciler struct {
client.Client
Namespace: string
Namespace string
Scheme *runtime.Scheme
Log logr.Logger
}
Expand Down
21 changes: 0 additions & 21 deletions components/odh-notebook-controller/controllers/notebook_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"k8s.io/client-go/rest"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"
ctrlruntime "sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

Expand Down Expand Up @@ -458,26 +457,6 @@ func InjectCertConfig(notebook *nbv1.Notebook, configMapName string) error {
return nil
}

func getControllerNamespace() (string, error) {
// Check if running inside a Kubernetes cluster
// GetConfig(): If KUBECONFIG env variable is set, it is used to create
// the client, else the inClusterConfig() is used.
// Lastly if none of them are set, it uses $HOME/.kube/config to create the client.
_, err := ctrlruntime.GetConfig()
if err != nil {
return "", fmt.Errorf("error creating the config object, not running inside a Kubernetes/Openshift Cluster %v", err)
}

// Try to get the namespace from the service account secret
if data, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil {
if ns := string(data); len(ns) > 0 {
return ns, nil
}
}

return "", fmt.Errorf("unable to determine the namespace")
}

// SetContainerImageFromRegistry checks if there is an internal registry and takes the corresponding actions to set the container.image value.
// If an internal registry is detected, it uses the default values specified in the Notebook Custom Resource (CR).
// Otherwise, it checks the last-image-selection annotation to find the image stream and fetches the image from status.dockerImageReference,
Expand Down

0 comments on commit 8f2102e

Please sign in to comment.