diff --git a/cmd/deploy.go b/cmd/deploy.go index 4e12a8d1..578000b2 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -18,13 +18,14 @@ func newDeployCmd() *cobra.Command { cmd := &cobra.Command{ Use: "deploy [component]", Short: "Deploy ACS components", - Long: `Deploy ACS components (central, secured-cluster). + Long: `Deploy ACS components (central, secured-cluster, operator). Examples: roxie deploy central roxie deploy secured-cluster - roxie deploy both`, - ValidArgs: []string{"central", "secured-cluster", "both", "all"}, + roxie deploy both + roxie deploy operator`, + ValidArgs: []string{"central", "secured-cluster", "both", "all", "operator"}, Args: cobra.MaximumNArgs(1), RunE: runDeploy, } @@ -64,6 +65,10 @@ func runDeploy(cmd *cobra.Command, args []string) error { component = args[0] } + if component == "operator" && helm { + return errors.New("cannot use --helm flag with 'operator' component") + } + if (component == "central" || component == "both") && os.Getenv("ROXIE_SHELL") != "" { return errors.New("already in a roxie sub-shell (ROXIE_SHELL environment variable is set), please exit the shell and try again") } @@ -123,6 +128,8 @@ func runDeploy(cmd *cobra.Command, args []string) error { d.PrintCentralDeploymentSummary() case "secured-cluster", "sensor": d.PrintSecuredClusterDeploymentSummary() + case "operator": + // No deployment summary needed for operator-only deployment } if envrc != "" { diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index ab48c8cd..04a446b7 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -14,6 +14,19 @@ import ( "gopkg.in/yaml.v3" ) +// deployOperatorOnly deploys only the operator without any Central or SecuredCluster resources +func (d *Deployer) deployOperatorOnly(ctx context.Context) error { + d.logger.Info("🚀 Deploying Operator only...") + + if err := d.ensureOperatorDeployed(ctx); err != nil { + return err + } + + d.logger.Success("✓ Operator deployed successfully") + d.logger.Info("You can now deploy Central or SecuredCluster components separately") + return nil +} + // ensureOperatorDeployed ensures the operator is deployed with the correct version and mode func (d *Deployer) ensureOperatorDeployed(ctx context.Context) error { // Skip operator deployment/checks if flag is set to false diff --git a/internal/deployer/deployer.go b/internal/deployer/deployer.go index 0fb8e9d8..e049f817 100644 --- a/internal/deployer/deployer.go +++ b/internal/deployer/deployer.go @@ -363,6 +363,8 @@ func formatComponentName(component string) string { return "Secured Cluster" case "central": return "Central" + case "operator": + return "Operator" default: return component } @@ -389,6 +391,8 @@ func (d *Deployer) Deploy(ctx context.Context, component, resources, exposure st d.logger.Infof("Initiating deployment of %s", formatComponentName(component)) switch component { + case "operator": + return d.deployOperatorOnly(ctx) case "central": return d.deployCentral(ctx, resources, exposure) case "secured-cluster", "sensor":