Skip to content

Commit

Permalink
feat(cmd): add --no-storage installation option
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Mar 2, 2023
1 parent 162147c commit 0ccc65a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion e2e/commonwithcustominstall/tekton_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 7 additions & 3 deletions pkg/install/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 0ccc65a

Please sign in to comment.