Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller DEV_MODE=on #1923

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"syscall"
"time"

"github.com/minio/pkg/env"

"github.com/minio/operator/pkg"

"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -79,8 +81,21 @@ func StartOperator(kubeconfig string) {
return
}

// Look for incluster config by default
cfg, err := rest.InClusterConfig()
var cfg *rest.Config
var err error

if token := env.Get("DEV_MODE", ""); token == "on" {
klog.Info("DEV_MODE present, running dev mode")
cfg = &rest.Config{
Host: "http://localhost:8001",
TLSClientConfig: rest.TLSClientConfig{Insecure: true},
APIPath: "/",
BearerToken: "",
}
} else {
// Look for incluster config by default
cfg, err = rest.InClusterConfig()
}
// If config is passed as a flag use that instead
if kubeconfig != "" {
cfg, err = clientcmd.BuildConfigFromFlags(masterURL, kubeconfig)
Expand Down