Remove auto-configuration of storage path

This was an artifact of the desire to run `make run` without any custom
configuration, rather than it being a feature of the controller. The
setup of this has now been moved to the `Makefile` itself, including the
required configuration of the `--storage-adv-addr`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This commit is contained in:
Hidde Beydals 2023-03-29 10:19:07 +02:00
parent 268db50890
commit 2701c61635
No known key found for this signature in database
GPG Key ID: 979F380FC2341744
2 changed files with 2 additions and 10 deletions

View File

@ -94,7 +94,8 @@ test-api: ## Run api tests
cd api; go test $(GO_TEST_ARGS) ./... -coverprofile cover.out
run: generate fmt vet manifests ## Run against the configured Kubernetes cluster in ~/.kube/config
go run $(GO_STATIC_FLAGS) ./main.go
@mkdir -p $(PWD)/bin/data
go run $(GO_STATIC_FLAGS) ./main.go --storage-adv-addr=:0 --storage-path=$(PWD)/bin/data
install: manifests ## Install CRDs into a cluster
kustomize build config/crd | kubectl apply -f -

View File

@ -21,7 +21,6 @@ import (
"net"
"net/http"
"os"
"path/filepath"
"time"
flag "github.com/spf13/pflag"
@ -409,14 +408,6 @@ func mustInitStorage(path string, storageAdvAddr string, artifactRetentionTTL ti
intdigest.Canonical = algo
}
if path == "" {
p, _ := os.Getwd()
// TODO(hidde): look at this default path, seems to be an artifact of
// old things.
path = filepath.Join(p, "bin")
os.MkdirAll(path, 0o700)
}
storage, err := controllers.NewStorage(path, storageAdvAddr, artifactRetentionTTL, artifactRetentionRecords)
if err != nil {
setupLog.Error(err, "unable to initialise storage")