Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add --no-install for activate command #536

Merged
merged 1 commit into from
Jul 3, 2023
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
2 changes: 1 addition & 1 deletion cmd/cache/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var listCmd = &cobra.Command{
color.Red("Error: %v", err)
os.Exit(1)
}

for _, name := range names {
println(name)
}
Expand Down
7 changes: 6 additions & 1 deletion cmd/integration/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import (
"github.com/spf13/viper"
)

var (
skipInstall bool
)

// activateCmd represents the activate command
var activateCmd = &cobra.Command{
Use: "activate [integration]",
Expand All @@ -39,7 +43,7 @@ var activateCmd = &cobra.Command{

integration := integration.NewIntegration()
// Check if the integation exists
err := integration.Activate(integrationName, namespace, activeFilters)
err := integration.Activate(integrationName, namespace, activeFilters, skipInstall)
if err != nil {
color.Red("Error: %v", err)
return
Expand All @@ -51,5 +55,6 @@ var activateCmd = &cobra.Command{

func init() {
IntegrationCmd.AddCommand(activateCmd)
activateCmd.Flags().BoolVarP(&skipInstall, "no-install", "s", false, "Only activate the integration filter without installing the filter (for example, if that filter plugin is already deployed in cluster, we do not need to re-install it again)")

}
8 changes: 5 additions & 3 deletions pkg/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (*Integration) Get(name string) (IIntegration, error) {
return integrations[name], nil
}

func (*Integration) Activate(name string, namespace string, activeFilters []string) error {
func (*Integration) Activate(name string, namespace string, activeFilters []string, skipInstall bool) error {
if _, ok := integrations[name]; !ok {
return errors.New("integration not found")
}
Expand All @@ -83,8 +83,10 @@ func (*Integration) Activate(name string, namespace string, activeFilters []stri

viper.Set("active_filters", uniqueFilters)

if err := integrations[name].Deploy(namespace); err != nil {
return err
if !skipInstall {
if err := integrations[name].Deploy(namespace); err != nil {
return err
}
}

if err := viper.WriteConfig(); err != nil {
Expand Down