diff --git a/api/v1alpha2/bundle_types.go b/api/v1alpha2/bundle_types.go index d9f5734b..77003aa5 100644 --- a/api/v1alpha2/bundle_types.go +++ b/api/v1alpha2/bundle_types.go @@ -26,7 +26,6 @@ const ( SourceTypeImage SourceType = "image" SourceTypeGit SourceType = "git" SourceTypeConfigMaps SourceType = "configMaps" - SourceTypeUpload SourceType = "upload" SourceTypeHTTP SourceType = "http" TypeUnpacked = "Unpacked" diff --git a/cmd/core/main.go b/cmd/core/main.go index d4ed680e..cfef3cb6 100644 --- a/cmd/core/main.go +++ b/cmd/core/main.go @@ -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" @@ -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.") @@ -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, } diff --git a/cmd/webhooks/main.go b/cmd/webhooks/main.go index 7138a5b1..810453a4 100644 --- a/cmd/webhooks/main.go +++ b/cmd/webhooks/main.go @@ -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 { diff --git a/docs/bundles/plain.md b/docs/bundles/plain.md index bf607c1a..a31781a1 100644 --- a/docs/bundles/plain.md +++ b/docs/bundles/plain.md @@ -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) @@ -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 . -``` - ### ConfigMap source For using the bundle with a [`ConfigMap` source (also known as a local source)](../sources/local.md), follow the below steps: diff --git a/docs/provisioners/helm.md b/docs/provisioners/helm.md index c51abd9f..6ed20d00 100644 --- a/docs/provisioners/helm.md +++ b/docs/provisioners/helm.md @@ -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. diff --git a/docs/provisioners/plain.md b/docs/provisioners/plain.md index 90d0a813..0fd5ed30 100644 --- a/docs/provisioners/plain.md +++ b/docs/provisioners/plain.md @@ -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. diff --git a/docs/sources/upload.md b/docs/sources/upload.md deleted file mode 100644 index d05819d6..00000000 --- a/docs/sources/upload.md +++ /dev/null @@ -1,67 +0,0 @@ -# Uploading Bundles - -## Summary - -A Bundle can reference content from an uploaded bundle directory instead of a remote container image or a git repository by -using the `upload` source type in the Bundle manifest. This enables one to easily source content locally without external -repositories/registries. - -The `rukpakctl run` command can be used to create or update a `BundleDeployment` that references -an `upload` bundle. - -## Running an `upload` bundle - -To run an `upload` bundle, simply invoke the `rukpakctl run` subcommand with a `BundleDeployment` name and the path -to a local directory that contains a bundle. - -```console -rukpakctl run -``` - -By default, `rukpakctl run` assumes that the bundle is a plain bundle and uses `core-rukpak-io-plain` as the -provisioner class names for both the bundle template and the bundle deployment spec. - -The `--bundle-provisioner-class` and `--bundle-deployment-provisioner-class` flags can be used to -configure the provisioner classes that are used to unpack and deploy the bundle, respectively. - -## Updating an existing `upload` bundle - -The `upload` source type also supports pivoting from one `upload` bundle to another. To initiate -a pivot, simply run the same `rukpakctl run` command with a bundle directory that contains different -content than the existing bundle. The `rukpakctl` client will automatically hash the contents of the bundle -directory and include that hash as a label in the bundle template to ensure that the template changes, -thus causing the bundle deployment provisioner to begin a pivot. - -Because hashing is used to determine differences between bundle revisions, `rukpakctl run` supports -an iterative development cycle of: -1. Make changes in the bundle directory -2. Run `rukpakctl run` -3. Goto step 1 - -## A note about immutability - -The `upload` source upload handler rejects uploads for non-`upload` bundles and for `upload` bundles -that have already been unpacked. This preserves the immutable property of bundles. - -## Example - -1. Run the bundle from a local testdata directory - ```console - $ rukpakctl run combo ../testdata/bundles/plain-v0/valid - bundledeployment.core.rukpak.io "combo" applied - successfully uploaded bundle content for "combo-7fdb455bf7" - ``` - -2. Check the status of the bundle - ```console - $ kubectl get bundle -l app=combo - NAME TYPE PHASE AGE - combo-7fdb455bf7 upload Unpacked 104s - ``` - -3. Check the status of the bundle deployment - ```console - $ kubectl get bundledeployments.core.rukpak.io combo - NAME ACTIVE BUNDLE INSTALL STATE AGE - combo combo-7fdb455bf7 InstallationSucceeded 2m46s - ``` \ No newline at end of file diff --git a/internal/provisioner/helm/helm.go b/internal/provisioner/helm/helm.go index af4bcb15..2377322c 100644 --- a/internal/provisioner/helm/helm.go +++ b/internal/provisioner/helm/helm.go @@ -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 ') 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 diff --git a/internal/util/defaults.go b/internal/util/defaults.go index 1412bebf..0a0faffc 100644 --- a/internal/util/defaults.go +++ b/internal/util/defaults.go @@ -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" ) diff --git a/internal/webhook/bundledeployment.go b/internal/webhook/bundledeployment.go index 5ce775ba..e585695c 100644 --- a/internal/webhook/bundledeployment.go +++ b/internal/webhook/bundledeployment.go @@ -33,7 +33,7 @@ import ( rukpakv1alpha2 "github.com/operator-framework/rukpak/api/v1alpha2" ) -type Bundle struct { +type BundleDeployment struct { Client client.Client SystemNamespace string } @@ -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 { @@ -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 { @@ -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{} diff --git a/manifests/base/core/kustomization.yaml b/manifests/base/core/kustomization.yaml index ab927be0..730efb48 100644 --- a/manifests/base/core/kustomization.yaml +++ b/manifests/base/core/kustomization.yaml @@ -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 diff --git a/manifests/base/core/resources/bundle_uploader_client_clusterrole.yaml b/manifests/base/core/resources/bundle_uploader_client_clusterrole.yaml deleted file mode 100644 index 6aab6391..00000000 --- a/manifests/base/core/resources/bundle_uploader_client_clusterrole.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: bundle-uploader -rules: - - nonResourceURLs: - - /bundles/* - verbs: - - put diff --git a/manifests/base/core/resources/deployment.yaml b/manifests/base/core/resources/deployment.yaml index ed4665c5..83853905 100644 --- a/manifests/base/core/resources/deployment.yaml +++ b/manifests/base/core/resources/deployment.yaml @@ -64,8 +64,6 @@ spec: volumeMounts: - name: bundle-cache mountPath: /var/cache/bundles - - name: upload-cache - mountPath: /var/cache/uploads resources: requests: cpu: 10m @@ -73,5 +71,3 @@ spec: volumes: - name: bundle-cache emptyDir: {} - - name: upload-cache - emptyDir: {} diff --git a/test/e2e/plain_provisioner_test.go b/test/e2e/plain_provisioner_test.go index 261463a7..caa46b8f 100644 --- a/test/e2e/plain_provisioner_test.go +++ b/test/e2e/plain_provisioner_test.go @@ -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{}) {