Skip to content

Commit

Permalink
chore: remove fallbacks (featureconfig, envtest), panic if undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
dushanpantic committed Dec 18, 2024
1 parent 5583fae commit 2f2a44d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
10 changes: 6 additions & 4 deletions pkg/feature/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ package feature

import (
"context"
"errors"
"fmt"
"log/slog"
"os"
"time"

"github.com/go-logr/logr"
"github.com/kyma-project/cloud-manager/pkg/common/abstractions"
"github.com/kyma-project/cloud-manager/pkg/feature/types"
ffclient "github.com/thomaspoignant/go-feature-flag"
"github.com/thomaspoignant/go-feature-flag/retriever"
"github.com/thomaspoignant/go-feature-flag/retriever/fileretriever"
"github.com/thomaspoignant/go-feature-flag/retriever/httpretriever"
"log/slog"
"os"
"time"
)

var provider types.Provider
Expand Down Expand Up @@ -52,7 +54,7 @@ func Initialize(ctx context.Context, logger logr.Logger, opts ...ProviderOption)
o.filename = os.Getenv("FEATURE_FLAG_CONFIG_FILE")
}
if len(o.filename) == 0 {
o.url = "https://raw.githubusercontent.com/kyma-project/cloud-manager/main/config/featureToggles/featureToggles.yaml"
panic(errors.New("unable to locate feature flag config file. Use env vars FEATURE_FLAG_CONFIG_URL or FEATURE_FLAG_CONFIG_FILE to specify its url/path"))
}
}
var rtvr retriever.Retriever
Expand Down
11 changes: 6 additions & 5 deletions pkg/testinfra/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ package testinfra
import (
"errors"
"fmt"
"os"
"path/filepath"
goruntime "runtime"
"time"

"github.com/kyma-project/cloud-manager/pkg/common/abstractions"
"github.com/kyma-project/cloud-manager/pkg/config"
"github.com/kyma-project/cloud-manager/pkg/feature"
Expand All @@ -24,13 +29,9 @@ import (
"github.com/onsi/gomega"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"os"
"path/filepath"
goruntime "runtime"
ctrl "sigs.k8s.io/controller-runtime"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"time"
)

func Start() (Infra, error) {
Expand All @@ -40,7 +41,7 @@ func Start() (Infra, error) {
}
envtestK8sVersion := os.Getenv("ENVTEST_K8S_VERSION")
if len(envtestK8sVersion) == 0 {
envtestK8sVersion = "1.31.0"
panic(errors.New("unable to resolve envtest version. Use env var ENVTEST_K8S_VERSION to specify it"))
}

ginkgo.By("Preparing CRDs")
Expand Down

0 comments on commit 2f2a44d

Please sign in to comment.