Skip to content

Commit

Permalink
Allow running locally
Browse files Browse the repository at this point in the history
  • Loading branch information
ramondeklein committed Aug 29, 2024
1 parent 7352650 commit 76f0dd2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/minio.min.io/v2/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func GetPrivateKeyFilePath(serviceName string) string {
func GetNSFromFile() string {
namespace, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
if err != nil {
return "minio-operator"
return os.Getenv("DEV_NAMESPACE")
}
return string(namespace)
}
Expand Down
16 changes: 15 additions & 1 deletion sidecar/pkg/sidecar/sidecar_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,21 @@ func init() {
// StartSideCar instantiates kube clients and starts the side-car controller
func StartSideCar(tenantName string, secretName string) {
log.Println("Starting Sidecar")
cfg, err := rest.InClusterConfig()
var cfg *rest.Config
var err error

if os.Getenv("DEV_NAMESPACE") != "" {
klog.Info("DEV_NAMESPACE present, running dev mode")
cfg = &rest.Config{
Host: "http://localhost:8001",
TLSClientConfig: rest.TLSClientConfig{Insecure: true},
APIPath: "/",
}
} else {
// Look for incluster config by default
cfg, err = rest.InClusterConfig()
}

if err != nil {
panic(err)
}
Expand Down

0 comments on commit 76f0dd2

Please sign in to comment.