mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Removing all the checks for oci experimental flag
Signed-off-by: David Peraza <dperaza@redhat.com>
This commit is contained in:
parent
91a46ad14f
commit
9f869c6b21
17 changed files with 17 additions and 85 deletions
|
|
@ -50,11 +50,6 @@ func TestDependencyBuildCmd(t *testing.T) {
|
|||
}
|
||||
ociSrv.Run(t, repotest.WithDependingChart(c))
|
||||
|
||||
err = os.Setenv("HELM_EXPERIMENTAL_OCI", "1")
|
||||
if err != nil {
|
||||
t.Fatal("failed to set environment variable enabling OCI support")
|
||||
}
|
||||
|
||||
dir := func(p ...string) string {
|
||||
return filepath.Join(append([]string{srv.Root()}, p...)...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,11 +51,6 @@ func TestDependencyUpdateCmd(t *testing.T) {
|
|||
}
|
||||
ociSrv.Run(t, repotest.WithDependingChart(c))
|
||||
|
||||
err = os.Setenv("HELM_EXPERIMENTAL_OCI", "1")
|
||||
if err != nil {
|
||||
t.Fatal("failed to set environment variable enabling OCI support")
|
||||
}
|
||||
|
||||
if err := srv.LinkIndices(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,16 +31,12 @@ import (
|
|||
|
||||
"helm.sh/helm/v3/pkg/action"
|
||||
"helm.sh/helm/v3/pkg/cli"
|
||||
"helm.sh/helm/v3/pkg/gates"
|
||||
"helm.sh/helm/v3/pkg/kube"
|
||||
kubefake "helm.sh/helm/v3/pkg/kube/fake"
|
||||
"helm.sh/helm/v3/pkg/release"
|
||||
"helm.sh/helm/v3/pkg/storage/driver"
|
||||
)
|
||||
|
||||
// FeatureGateOCI is the feature gate for checking if `helm chart` and `helm registry` commands should work
|
||||
const FeatureGateOCI = gates.Gate("HELM_EXPERIMENTAL_OCI")
|
||||
|
||||
var settings = cli.New()
|
||||
|
||||
func init() {
|
||||
|
|
@ -95,15 +91,6 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
func checkOCIFeatureGate() func(_ *cobra.Command, _ []string) error {
|
||||
return func(_ *cobra.Command, _ []string) error {
|
||||
if !FeatureGateOCI.IsEnabled() {
|
||||
return FeatureGateOCI.Error()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// This function loads releases into the memory storage if the
|
||||
// environment variable is properly set.
|
||||
func loadReleasesInMemory(actionConfig *action.Configuration) {
|
||||
|
|
|
|||
|
|
@ -187,10 +187,6 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options
|
|||
}
|
||||
client.ReleaseName = name
|
||||
|
||||
if err := checkOCI(chart); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cp, err := client.ChartPathOptions.LocateChart(chart, settings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -64,10 +64,6 @@ func newPullCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|||
client.Version = ">0.0.0-0"
|
||||
}
|
||||
|
||||
if err := checkOCI(args[0]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(args); i++ {
|
||||
output, err := client.Run(args[i])
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ func TestPullCmd(t *testing.T) {
|
|||
}
|
||||
defer srv.Stop()
|
||||
|
||||
os.Setenv("HELM_EXPERIMENTAL_OCI", "1")
|
||||
ociSrv, err := repotest.NewOCIServer(t, srv.Root())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
|||
|
|
@ -38,12 +38,10 @@ func newPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|||
client := experimental.NewPushWithOpts(experimental.WithPushConfig(cfg))
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "push [chart] [remote]",
|
||||
Short: "push a chart to remote",
|
||||
Long: pushDesc,
|
||||
Hidden: !FeatureGateOCI.IsEnabled(),
|
||||
PersistentPreRunE: checkOCIFeatureGate(),
|
||||
Args: require.MinimumNArgs(2),
|
||||
Use: "push [chart] [remote]",
|
||||
Short: "push a chart to remote",
|
||||
Long: pushDesc,
|
||||
Args: require.MinimumNArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
chartRef := args[0]
|
||||
remote := args[1]
|
||||
|
|
|
|||
|
|
@ -29,11 +29,9 @@ This command consists of multiple subcommands to interact with registries.
|
|||
|
||||
func newRegistryCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "registry",
|
||||
Short: "login to or logout from a registry",
|
||||
Long: registryHelp,
|
||||
Hidden: !FeatureGateOCI.IsEnabled(),
|
||||
PersistentPreRunE: checkOCIFeatureGate(),
|
||||
Use: "registry",
|
||||
Short: "login to or logout from a registry",
|
||||
Long: registryHelp,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newRegistryLoginCmd(cfg, out),
|
||||
|
|
|
|||
|
|
@ -42,11 +42,10 @@ func newRegistryLoginCmd(cfg *action.Configuration, out io.Writer) *cobra.Comman
|
|||
var passwordFromStdinOpt, insecureOpt bool
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "login [host]",
|
||||
Short: "login to a registry",
|
||||
Long: registryLoginDesc,
|
||||
Args: require.MinimumNArgs(1),
|
||||
Hidden: !FeatureGateOCI.IsEnabled(),
|
||||
Use: "login [host]",
|
||||
Short: "login to a registry",
|
||||
Long: registryLoginDesc,
|
||||
Args: require.MinimumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
hostname := args[0]
|
||||
|
||||
|
|
|
|||
|
|
@ -32,11 +32,10 @@ Remove credentials stored for a remote registry.
|
|||
|
||||
func newRegistryLogoutCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "logout [host]",
|
||||
Short: "logout from a registry",
|
||||
Long: registryLogoutDesc,
|
||||
Args: require.MinimumNArgs(1),
|
||||
Hidden: !FeatureGateOCI.IsEnabled(),
|
||||
Use: "logout [host]",
|
||||
Short: "logout from a registry",
|
||||
Long: registryLogoutDesc,
|
||||
Args: require.MinimumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
hostname := args[0]
|
||||
return experimental.NewRegistryLogout(cfg).Run(out, hostname)
|
||||
|
|
|
|||
|
|
@ -258,12 +258,3 @@ func checkForExpiredRepos(repofile string) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// When dealing with OCI-based charts, ensure that the user has
|
||||
// enabled the experimental feature gate prior to continuing
|
||||
func checkOCI(ref string) error {
|
||||
if registry.IsOCI(ref) && !FeatureGateOCI.IsEnabled() {
|
||||
return FeatureGateOCI.Error()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,10 +198,6 @@ func runShow(args []string, client *action.Show) (string, error) {
|
|||
client.Version = ">0.0.0-0"
|
||||
}
|
||||
|
||||
if err := checkOCI(args[0]); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
cp, err := client.ChartPathOptions.LocateChart(args[0], settings)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
|
|||
|
|
@ -87,10 +87,6 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|||
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := checkOCI(args[1]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
client.Namespace = settings.Namespace()
|
||||
|
||||
// Fixes #7002 - Support reading values from STDIN for `upgrade` command
|
||||
|
|
|
|||
|
|
@ -29,15 +29,12 @@ import (
|
|||
|
||||
"helm.sh/helm/v3/pkg/chart"
|
||||
"helm.sh/helm/v3/pkg/chart/loader"
|
||||
"helm.sh/helm/v3/pkg/gates"
|
||||
"helm.sh/helm/v3/pkg/helmpath"
|
||||
"helm.sh/helm/v3/pkg/provenance"
|
||||
"helm.sh/helm/v3/pkg/registry"
|
||||
"helm.sh/helm/v3/pkg/repo"
|
||||
)
|
||||
|
||||
const FeatureGateOCI = gates.Gate("HELM_EXPERIMENTAL_OCI")
|
||||
|
||||
// Resolver resolves dependencies from semantic version ranges to a particular version.
|
||||
type Resolver struct {
|
||||
chartpath string
|
||||
|
|
@ -138,11 +135,6 @@ func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string
|
|||
found = false
|
||||
} else {
|
||||
version = d.Version
|
||||
if !FeatureGateOCI.IsEnabled() {
|
||||
return nil, errors.Wrapf(FeatureGateOCI.Error(),
|
||||
"repository %s is an OCI registry", d.Repository)
|
||||
}
|
||||
|
||||
// Retrieve list of tags for repository
|
||||
ref := fmt.Sprintf("%s/%s", strings.TrimPrefix(d.Repository, fmt.Sprintf("%s://", registry.OCIScheme)), d.Name)
|
||||
tags, err := r.registryClient.Tags(ref)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ import (
|
|||
"runtime"
|
||||
"testing"
|
||||
|
||||
"helm.sh/helm/v3/internal/experimental/registry"
|
||||
"helm.sh/helm/v3/pkg/chart"
|
||||
"helm.sh/helm/v3/pkg/registry"
|
||||
)
|
||||
|
||||
func TestResolve(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -344,11 +344,6 @@ func (m *Manager) downloadAll(deps []*chart.Dependency) error {
|
|||
|
||||
version := ""
|
||||
if registry.IsOCI(churl) {
|
||||
if !resolver.FeatureGateOCI.IsEnabled() {
|
||||
return errors.Wrapf(resolver.FeatureGateOCI.Error(),
|
||||
"the repository %s is an OCI registry", churl)
|
||||
}
|
||||
|
||||
churl, version, err = parseOCIRef(churl)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "could not parse OCI reference")
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ func (suite *RegistryClientTestSuite) Test_2_Pull() {
|
|||
func (suite *RegistryClientTestSuite) Test_3_Tags() {
|
||||
|
||||
// Load test chart (to build ref pushed in previous test)
|
||||
chartData, err := ioutil.ReadFile("../../../pkg/downloader/testdata/local-subchart-0.1.0.tgz")
|
||||
chartData, err := ioutil.ReadFile("../downloader/testdata/local-subchart-0.1.0.tgz")
|
||||
suite.Nil(err, "no error loading test chart")
|
||||
meta, err := extractChartMeta(chartData)
|
||||
suite.Nil(err, "no error extracting chart meta")
|
||||
|
|
|
|||
Loading…
Reference in a new issue