Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

followups from removal of Bundle API and upload source #801

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion api/v1alpha2/bundle_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const (
SourceTypeImage SourceType = "image"
SourceTypeGit SourceType = "git"
SourceTypeConfigMaps SourceType = "configMaps"
SourceTypeUpload SourceType = "upload"
SourceTypeHTTP SourceType = "http"

TypeUnpacked = "Unpacked"
Expand Down
3 changes: 0 additions & 3 deletions cmd/core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"net/http"
"net/url"
"os"
"time"

"github.com/gorilla/handlers"
helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
Expand Down Expand Up @@ -79,7 +78,6 @@ func main() {
unpackImage string
rukpakVersion bool
provisionerStorageDirectory string
uploadStorageSyncInterval time.Duration
)
flag.StringVar(&httpBindAddr, "http-bind-address", ":8080", "The address the http server binds to.")
flag.StringVar(&httpExternalAddr, "http-external-address", "http://localhost:8080", "The external address at which the http server is reachable.")
Expand All @@ -92,7 +90,6 @@ func main() {
"Enabling this will ensure there is only one active controller manager.")
flag.BoolVar(&rukpakVersion, "version", false, "Displays rukpak version information")
flag.StringVar(&provisionerStorageDirectory, "provisioner-storage-dir", storage.DefaultBundleCacheDir, "The directory that is used to store bundle contents.")
flag.DurationVar(&uploadStorageSyncInterval, "upload-storage-sync-interval", time.Minute, "Interval on which to garbage collect unused uploaded bundles")
opts := zap.Options{
Development: true,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/webhooks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func main() {
os.Exit(1)
}

if err = (&webhook.Bundle{
if err = (&webhook.BundleDeployment{
Client: mgr.GetClient(),
SystemNamespace: systemNamespace,
}).SetupWebhookWithManager(mgr); err != nil {
Expand Down
17 changes: 0 additions & 17 deletions docs/bundles/plain.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Supported source types for a plain bundle currently include the following:
* A directory in a [container image](../sources/image.md)
* A directory in a [`git` repository](../sources/git.md)
* A set of keys in a [`ConfigMap`](../sources/local.md)
* An [upload](../sources/upload.md)
* A `.tgz` file returned by a [http endpoint](../sources/http.md)


Expand Down Expand Up @@ -124,22 +123,6 @@ docker push quay.io/operator-framework/rukpak:example

If you are looking to use a private image registry for sourcing your bundle content, see the ["Private image registries" section of the image source documentation](../sources/image.md#private-image-registries)

### Upload source

For using the bundle with an [upload source](../sources/upload.md), follow the below steps:

1. Download the `rukpakctl` CLI tool
```bash
go install github.com/operator-framework/rukpak/cmd/rukpakctl
```

2. Ensure RukPak is running. For more info on how to install RukPak on your cluster see the [Installation section of the README](../../README.md#installation)

3. Use `rukpakctl` to create a `BundleDeployment` using the `manifests/` directory
```bash
rukpakctl run <bundle-name> .
```

### ConfigMap source

For using the bundle with a [`ConfigMap` source (also known as a local source)](../sources/local.md), follow the below steps:
Expand Down
1 change: 0 additions & 1 deletion docs/provisioners/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Supported source types for a helm bundle currently include the following:
* A container image
* A directory in a git repository
* A [http](../sources/http.md)
* An [upload](../uploading-bundles.md)

Additional source types, such as a local volume are on the roadmap. These source types
all present the same content, a directory containing a helm chart, in a different ways.
Expand Down
1 change: 0 additions & 1 deletion docs/provisioners/plain.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Supported source types for a plain bundle currently include the following:
* A directory in a git repository
* A [http](../sources/http.md)
* A [configmap](local-bundles.md)
* An [upload](../uploading-bundles.md)

Additional source types, such as a local volume are on the roadmap. These source types
all present the same content, a directory containing a plain bundle, in a different ways.
Expand Down
67 changes: 0 additions & 67 deletions docs/sources/upload.md

This file was deleted.

4 changes: 2 additions & 2 deletions internal/provisioner/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const (
func HandleBundleDeployment(_ context.Context, fsys fs.FS, bd *rukpakv1alpha2.BundleDeployment) (*chart.Chart, chartutil.Values, error) {
// Helm expects an FS whose root contains a single chart directory. Depending on how
// the bundle is sourced, the FS may or may not contain this single chart directory in
// its root (e.g. charts uploaded via 'rukpakctl run <bdName> <chartDir>') would not.
// This FS wrapper adds this base directory unless the FS already has a base directory.
// its root. This FS wrapper adds this base directory unless the FS already has a base
// directory.
chartFS, err := util.EnsureBaseDirFS(fsys, "chart")
if err != nil {
return nil, nil, err
Expand Down
5 changes: 2 additions & 3 deletions internal/util/defaults.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package util

const (
DefaultSystemNamespace = "rukpak-system"
DefaultUnpackImage = "quay.io/operator-framework/rukpak:main"
DefaultUploadServiceName = "core"
DefaultSystemNamespace = "rukpak-system"
DefaultUnpackImage = "quay.io/operator-framework/rukpak:main"
)
16 changes: 8 additions & 8 deletions internal/webhook/bundledeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
rukpakv1alpha2 "github.com/operator-framework/rukpak/api/v1alpha2"
)

type Bundle struct {
type BundleDeployment struct {
Client client.Client
SystemNamespace string
}
Expand All @@ -42,23 +42,23 @@ type Bundle struct {
//+kubebuilder:webhook:path=/validate-core-rukpak-io-v1alpha2-bundledeployment,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.rukpak.io,resources=bundledeployments,verbs=create;update,versions=v1alpha2,name=vbundles.core.rukpak.io,admissionReviewVersions=v1

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (b *Bundle) ValidateCreate(ctx context.Context, obj runtime.Object) error {
func (b *BundleDeployment) ValidateCreate(ctx context.Context, obj runtime.Object) error {
bundleDeployment := obj.(*rukpakv1alpha2.BundleDeployment)
return b.checkBundleDeploymentSource(ctx, bundleDeployment)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (b *Bundle) ValidateUpdate(ctx context.Context, _ runtime.Object, newObj runtime.Object) error {
func (b *BundleDeployment) ValidateUpdate(ctx context.Context, _ runtime.Object, newObj runtime.Object) error {
newBundle := newObj.(*rukpakv1alpha2.BundleDeployment)
return b.checkBundleDeploymentSource(ctx, newBundle)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (b *Bundle) ValidateDelete(_ context.Context, _ runtime.Object) error {
func (b *BundleDeployment) ValidateDelete(_ context.Context, _ runtime.Object) error {
return nil
}

func (b *Bundle) checkBundleDeploymentSource(ctx context.Context, bundleDeployment *rukpakv1alpha2.BundleDeployment) error {
func (b *BundleDeployment) checkBundleDeploymentSource(ctx context.Context, bundleDeployment *rukpakv1alpha2.BundleDeployment) error {
switch typ := bundleDeployment.Spec.Source.Type; typ {
case rukpakv1alpha2.SourceTypeImage:
if bundleDeployment.Spec.Source.Image == nil {
Expand Down Expand Up @@ -91,7 +91,7 @@ func (b *Bundle) checkBundleDeploymentSource(ctx context.Context, bundleDeployme
return nil
}

func (b *Bundle) verifyConfigMapImmutable(ctx context.Context, configMapName string) error {
func (b *BundleDeployment) verifyConfigMapImmutable(ctx context.Context, configMapName string) error {
var cm corev1.ConfigMap
err := b.Client.Get(ctx, client.ObjectKey{Namespace: b.SystemNamespace, Name: configMapName}, &cm)
if err != nil {
Expand All @@ -103,9 +103,9 @@ func (b *Bundle) verifyConfigMapImmutable(ctx context.Context, configMapName str
return nil
}

func (b *Bundle) SetupWebhookWithManager(mgr ctrl.Manager) error {
func (b *BundleDeployment) SetupWebhookWithManager(mgr ctrl.Manager) error {
mgr.GetWebhookServer().Register("/validate-core-rukpak-io-v1alpha2-bundledeployment", admission.WithCustomValidator(&rukpakv1alpha2.BundleDeployment{}, b).WithRecoverPanic(true))
return nil
}

var _ webhook.CustomValidator = &Bundle{}
var _ webhook.CustomValidator = &BundleDeployment{}
1 change: 0 additions & 1 deletion manifests/base/core/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
resources:
- resources/bundle_reader_client_clusterrole.yaml
- resources/bundle_uploader_client_clusterrole.yaml
- resources/cluster_role.yaml
- resources/cluster_role_binding.yaml
- resources/deployment.yaml
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions manifests/base/core/resources/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ spec:
volumeMounts:
- name: bundle-cache
mountPath: /var/cache/bundles
- name: upload-cache
mountPath: /var/cache/uploads
resources:
requests:
cpu: 10m
memory: 160Mi
volumes:
- name: bundle-cache
emptyDir: {}
- name: upload-cache
emptyDir: {}
5 changes: 2 additions & 3 deletions test/e2e/plain_provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ import (
)

const (
defaultSystemNamespace = util.DefaultSystemNamespace
defaultUploadServiceName = util.DefaultUploadServiceName
testdataDir = "../../testdata"
defaultSystemNamespace = util.DefaultSystemNamespace
testdataDir = "../../testdata"
)

func Logf(f string, v ...interface{}) {
Expand Down
Loading