diff --git a/e2e/commonwithcustominstall/tekton_test.go b/e2e/commonwithcustominstall/tekton_test.go index dd6bb3056b..ed7dc53135 100644 --- a/e2e/commonwithcustominstall/tekton_test.go +++ b/e2e/commonwithcustominstall/tekton_test.go @@ -41,7 +41,7 @@ func TestTektonLikeBehavior(t *testing.T) { Expect(CreateOperatorRoleBinding(ns)).To(Succeed()) Eventually(OperatorPod(ns)).Should(BeNil()) - Expect(CreateKamelPod(ns, "tekton-task", "install", "--skip-cluster-setup", "--force")).To(Succeed()) + Expect(CreateKamelPod(ns, "tekton-task", "install", "--no-storage", "--skip-cluster-setup", "--force")).To(Succeed()) Eventually(OperatorPod(ns)).ShouldNot(BeNil()) }) diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go index 2a9bdac924..7f964e3a3a 100644 --- a/pkg/cmd/install.go +++ b/pkg/cmd/install.go @@ -157,6 +157,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) (*cobra.Command, *installCmdO cmd.Flags().String("storage-class-name", "", "Use a storage class name to create a dynamic volume (if empty will look up for cluster default)") cmd.Flags().String("storage-capacity", "20Gi", "How much capacity to use") cmd.Flags().String("storage-access-mode", "ReadWriteOnce", "Persistent Volume Access Mode (any of ReadWriteOnce, ReadOnlyMany, ReadWriteMany or ReadWriteOncePod)") + cmd.Flags().Bool("no-storage", false, "If true, it won't use a persistent storage (recommended for development purpose only)") return &cmd, &options } @@ -210,6 +211,7 @@ type installCmdOptions struct { StorageClassName string `mapstructure:"storage-class-name"` StorageCapacity string `mapstructure:"storage-capacity"` StorageAccessMode string `mapstructure:"storage-access-mode"` + NoStorage bool `mapstructure:"no-storage"` } func (o *installCmdOptions) install(cmd *cobra.Command, _ []string) error { @@ -435,6 +437,7 @@ func (o *installCmdOptions) setupOperator( ResourcesRequirements: o.ResourcesRequirements, EnvVars: o.EnvVars, Storage: install.OperatorStorageConfiguration{ + NoStorage: o.NoStorage, ClassName: o.StorageClassName, Capacity: o.StorageCapacity, AccessMode: o.StorageAccessMode, diff --git a/pkg/install/operator.go b/pkg/install/operator.go index 9f798abf35..b81fae0089 100644 --- a/pkg/install/operator.go +++ b/pkg/install/operator.go @@ -75,6 +75,7 @@ type OperatorMonitoringConfiguration struct { // OperatorStorageConfiguration represents the configuration required for Camel K operator storage. type OperatorStorageConfiguration struct { + NoStorage bool ClassName string Capacity string AccessMode string @@ -88,9 +89,12 @@ func OperatorOrCollect(ctx context.Context, cmd *cobra.Command, c client.Client, return err } - camelKPVC, err := installPVC(ctx, cmd, c, cfg, collection) - if err != nil { - return err + var camelKPVC *corev1.PersistentVolumeClaim + if !cfg.Storage.NoStorage { + camelKPVC, err = installPVC(ctx, cmd, c, cfg, collection) + if err != nil { + return err + } } customizer := func(o ctrl.Object) ctrl.Object {