Skip to content

Commit 5789dbf

Browse files
pedjakclaude
andcommitted
fix: remove HelmChartSupport feature
The HelmChartSupport feature gate (alpha, default off) and all code for detecting, pulling, caching, and loading native Helm chart bundles from OCI registries is removed. The path forward on the next bundle format is unclear and may not be Helm, so maintaining this code is not justified. The Helm backend that converts registry+v1 bundles into Helm chart objects for installation (RegistryV1HelmChartProvider) is unaffected. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d0252d4 commit 5789dbf

17 files changed

Lines changed: 3 additions & 1573 deletions

File tree

docs/draft/howto/enable-helm-chart-support.md

Lines changed: 0 additions & 415 deletions
This file was deleted.

helm/experimental.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ options:
1414
- BoxcutterRuntime
1515
- BundleReleaseSupport
1616
- DeploymentConfig
17-
- HelmChartSupport
1817
- PreflightPermissions
1918
- SingleOwnNamespaceInstallSupport
2019
- WebhookProviderCertManager

helm/olmv1/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ options:
1717
- BoxcutterRuntime
1818
- BundleReleaseSupport
1919
- DeploymentConfig
20-
- HelmChartSupport
2120
- PreflightPermissions
2221
- SingleOwnNamespaceInstallSupport
2322
- SyntheticPermissions

helm/tilt.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ options:
1616
enabled:
1717
- SingleOwnNamespaceInstallSupport
1818
- PreflightPermissions
19-
- HelmChartSupport
2019
disabled:
2120
- WebhookProviderOpenshiftServiceCA
2221
catalogd:

internal/catalogd/graphql/graphql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ func BuildDynamicGraphQLSchema(catalogSchema *CatalogSchema, metasBySchema map[s
549549
objectType := objectType // Capture loop variable
550550
// Generate GraphQL field name from schema name
551551
// Convention: remove dots/special chars, lowercase, append 's' for pluralization
552-
// Examples: "olm.bundle" -> "olmbundles", "helm.chart" -> "helmcharts"
552+
// Examples: "olm.bundle" -> "olmbundles"
553553
// LIMITATION: Simple 's' appending doesn't follow English grammar rules or support
554554
// non-English languages. Schemas should use names that pluralize well with 's'.
555555
sanitized := alphanumericOnlyRE.ReplaceAllString(schemaName, "")

internal/operator-controller/applier/helm.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ import (
3030
"github.com/operator-framework/operator-controller/internal/operator-controller/authorization"
3131
"github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager"
3232
"github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager/cache"
33-
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
3433
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util"
35-
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image"
3634
)
3735

3836
// HelmChartProvider provides helm charts from bundle sources and cluster extensions
@@ -248,16 +246,6 @@ func (h *Helm) buildHelmChart(bundleFS fs.FS, ext *ocv1.ClusterExtension) (*char
248246
if h.HelmChartProvider == nil {
249247
return nil, errors.New("HelmChartProvider is nil")
250248
}
251-
if features.OperatorControllerFeatureGate.Enabled(features.HelmChartSupport) {
252-
meta := new(chart.Metadata)
253-
if ok, _ := imageutil.IsBundleSourceChart(bundleFS, meta); ok {
254-
return imageutil.LoadChartFSWithOptions(
255-
bundleFS,
256-
fmt.Sprintf("%s-%s.tgz", meta.Name, meta.Version),
257-
imageutil.WithInstallNamespace(ext.Spec.Namespace),
258-
)
259-
}
260-
}
261249
return h.HelmChartProvider.Get(bundleFS, ext)
262250
}
263251

internal/operator-controller/features/features.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const (
1616
SyntheticPermissions featuregate.Feature = "SyntheticPermissions"
1717
WebhookProviderCertManager featuregate.Feature = "WebhookProviderCertManager"
1818
WebhookProviderOpenshiftServiceCA featuregate.Feature = "WebhookProviderOpenshiftServiceCA"
19-
HelmChartSupport featuregate.Feature = "HelmChartSupport"
2019
BoxcutterRuntime featuregate.Feature = "BoxcutterRuntime"
2120
DeploymentConfig featuregate.Feature = "DeploymentConfig"
2221
BundleReleaseSupport featuregate.Feature = "BundleReleaseSupport"
@@ -68,14 +67,6 @@ var operatorControllerFeatureGates = map[featuregate.Feature]featuregate.Feature
6867
LockToDefault: false,
6968
},
7069

71-
// HelmChartSupport enables support for installing,
72-
// updating and uninstalling Helm Charts via Cluster Extensions.
73-
HelmChartSupport: {
74-
Default: false,
75-
PreRelease: featuregate.Alpha,
76-
LockToDefault: false,
77-
},
78-
7970
// BoxcutterRuntime configures OLM to use the Boxcutter runtime for extension lifecycling
8071
BoxcutterRuntime: {
8172
Default: false,

internal/shared/util/image/cache.go

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package image
22

33
import (
4-
"bytes"
54
"context"
65
"errors"
76
"fmt"
@@ -11,19 +10,14 @@ import (
1110
"os"
1211
"path/filepath"
1312
"slices"
14-
"testing"
1513
"time"
1614

1715
"github.com/containerd/containerd/archive"
18-
"github.com/google/renameio/v2"
1916
"github.com/opencontainers/go-digest"
2017
ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1"
2118
"go.podman.io/image/v5/docker/reference"
22-
"helm.sh/helm/v3/pkg/chart"
23-
"helm.sh/helm/v3/pkg/registry"
2419
"sigs.k8s.io/controller-runtime/pkg/log"
2520

26-
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
2721
errorutil "github.com/operator-framework/operator-controller/internal/shared/util/error"
2822
fsutil "github.com/operator-framework/operator-controller/internal/shared/util/fs"
2923
)
@@ -113,40 +107,6 @@ func (a *diskCache) unpackPath(ownerID string, digest digest.Digest) string {
113107
return filepath.Join(a.ownerIDPath(ownerID), digest.String())
114108
}
115109

116-
type LayerUnpacker interface {
117-
Unpack(_ context.Context, path string, layer LayerData, opts ...archive.ApplyOpt) error
118-
}
119-
120-
type defaultLayerUnpacker struct{}
121-
122-
type chartLayerUnpacker struct{}
123-
124-
var _ LayerUnpacker = &defaultLayerUnpacker{}
125-
var _ LayerUnpacker = &chartLayerUnpacker{}
126-
127-
func imageLayerUnpacker(layer LayerData) LayerUnpacker {
128-
if features.OperatorControllerFeatureGate.Enabled(features.HelmChartSupport) || testing.Testing() {
129-
if layer.MediaType == registry.ChartLayerMediaType {
130-
return &chartLayerUnpacker{}
131-
}
132-
}
133-
return &defaultLayerUnpacker{}
134-
}
135-
136-
func (u *chartLayerUnpacker) Unpack(_ context.Context, path string, layer LayerData, _ ...archive.ApplyOpt) error {
137-
if err := storeChartLayer(path, layer); err != nil {
138-
return fmt.Errorf("error applying chart layer[%d]: %w", layer.Index, err)
139-
}
140-
return nil
141-
}
142-
143-
func (u *defaultLayerUnpacker) Unpack(ctx context.Context, path string, layer LayerData, opts ...archive.ApplyOpt) error {
144-
if _, err := archive.Apply(ctx, path, layer.Reader, opts...); err != nil {
145-
return fmt.Errorf("error applying layer[%d]: %w", layer.Index, err)
146-
}
147-
return nil
148-
}
149-
150110
func (a *diskCache) Store(ctx context.Context, ownerID string, srcRef reference.Named, canonicalRef reference.Canonical, imgCfg ocispecv1.Image, layers iter.Seq[LayerData]) (fs.FS, time.Time, error) {
151111
var applyOpts []archive.ApplyOpt
152112
if a.filterFunc != nil {
@@ -169,9 +129,8 @@ func (a *diskCache) Store(ctx context.Context, ownerID string, srcRef reference.
169129
if layer.Err != nil {
170130
return fmt.Errorf("error reading layer[%d]: %w", layer.Index, layer.Err)
171131
}
172-
layerUnpacker := imageLayerUnpacker(layer)
173-
if err := layerUnpacker.Unpack(ctx, dest, layer, applyOpts...); err != nil {
174-
return fmt.Errorf("unpacking layer: %w", err)
132+
if _, err := archive.Apply(ctx, dest, layer.Reader, applyOpts...); err != nil {
133+
return fmt.Errorf("error applying layer[%d]: %w", layer.Index, err)
175134
}
176135
l.Info("applied layer", "layer", layer.Index)
177136
}
@@ -189,40 +148,6 @@ func (a *diskCache) Store(ctx context.Context, ownerID string, srcRef reference.
189148
return os.DirFS(dest), modTime, nil
190149
}
191150

192-
func storeChartLayer(path string, layer LayerData) error {
193-
if layer.Err != nil {
194-
return fmt.Errorf("error found in layer data: %w", layer.Err)
195-
}
196-
data, err := io.ReadAll(layer.Reader)
197-
if err != nil {
198-
return fmt.Errorf("error reading layer[%d]: %w", layer.Index, err)
199-
}
200-
meta := new(chart.Metadata)
201-
_, err = inspectChart(data, meta)
202-
if err != nil {
203-
return fmt.Errorf("inspecting chart layer: %w", err)
204-
}
205-
chart, err := renameio.TempFile("",
206-
filepath.Join(path,
207-
fmt.Sprintf("%s-%s.tgz", meta.Name, meta.Version),
208-
),
209-
)
210-
if err != nil {
211-
return fmt.Errorf("create temp file: %w", err)
212-
}
213-
defer func() {
214-
_ = chart.Cleanup()
215-
}()
216-
if _, err := io.Copy(chart, bytes.NewReader(data)); err != nil {
217-
return fmt.Errorf("copying chart archive: %w", err)
218-
}
219-
_, err = chart.Seek(0, io.SeekStart)
220-
if err != nil {
221-
return fmt.Errorf("seek chart archive start: %w", err)
222-
}
223-
return chart.CloseAtomicallyReplace()
224-
}
225-
226151
func (a *diskCache) Delete(_ context.Context, ownerID string) error {
227152
return fsutil.DeleteReadOnlyRecursive(a.ownerIDPath(ownerID))
228153
}

0 commit comments

Comments
 (0)