Skip to content

[WIP] converter: only enable tar-rafs conversion by env NYDUS_ENABLE_TAR2RAFS #635

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 7 additions & 8 deletions pkg/converter/tool/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
type Feature string
type Features map[Feature]struct{}

const envNydusDisableTar2Rafs string = "NYDUS_DISABLE_TAR2RAFS"
const envNydusEnableTar2Rafs string = "NYDUS_ENABLE_TAR2RAFS"

const (
// The option `--type tar-rafs` enables converting OCI tar blob
Expand All @@ -40,7 +40,6 @@ const (
var requiredFeatures Features
var detectedFeatures Features
var detectFeaturesOnce sync.Once
var disableTar2Rafs = os.Getenv(envNydusDisableTar2Rafs) != ""

func NewFeatures(items ...Feature) Features {
features := Features{}
Expand Down Expand Up @@ -124,13 +123,13 @@ func DetectFeatures(builder string, required Features, getHelp func(string) []by
// The feature is supported by current version of nydus-image.
supported := detectFeature(helpMsg, feature)
if supported {
// It is an experimental feature, so we still provide an env
// variable to allow users to disable it.
if feature == FeatureTar2Rafs && disableTar2Rafs {
logrus.Warnf("the feature '%s' is disabled by env '%s'", FeatureTar2Rafs, envNydusDisableTar2Rafs)
continue
// It is an experimental feature, we provide an env variable
// to allow users to enable it.
enableTar2Rafs := os.Getenv(envNydusEnableTar2Rafs) != ""
if enableTar2Rafs && feature == FeatureTar2Rafs {
logrus.Warnf("the feature '%s' is enabled by env '%s'", FeatureTar2Rafs, envNydusEnableTar2Rafs)
detectedFeatures.Add(feature)
}
detectedFeatures.Add(feature)
} else {
logrus.Warnf("the feature '%s' is ignored, it requires higher version of nydus-image", feature)
}
Expand Down
Loading