Skip to content

Fix teardown to clean up operator namespace#82

Merged
AlexVulaj merged 3 commits into
mainfrom
fix-teardown-operator
Apr 9, 2026
Merged

Fix teardown to clean up operator namespace#82
AlexVulaj merged 3 commits into
mainfrom
fix-teardown-operator

Conversation

@AlexVulaj
Copy link
Copy Markdown
Contributor

@AlexVulaj AlexVulaj commented Apr 7, 2026

Fixes #72 - adds both vs all distinction for teardown behavior.

Changes:

  • teardown both - removes central + sensor, keeps operator (fast iteration)

  • teardown all - removes central + sensor + operator (full cleanup)

  • Default teardown is now all for complete cleanup

  • Teardowns run in parallel for better performance

  • Operator deployment is now explicit instead of hidden in central/sensor deployment

  • Added app.kubernetes.io/managed-by=roxie label to operator namespace

    Breaking change: Default teardown behavior changed from leaving operator behind to removing it. Use teardown both for the old behavior.

Manual testing:

Default behavior (all):

  • ./roxie deploy --resources=small → deployed central + sensor + operator
  • ./roxie teardown → removed all three including rhacs-operator-system namespace

both vs all distinction:

  • ./roxie deploy all --resources=small → deployed everything
  • ./roxie teardown both → central/sensor resources deleted, operator kept running
  • ./roxie teardown all → operator removed

Single namespace mode:

  • ./roxie deploy --single-namespace --resources=smallstackrox namespace labeled with managed-by=roxie
  • ./roxie teardown --single-namespace → cleaned up including operator

Parallel teardown verified - all three components started teardown simultaneously (logged at 00:01), finished independently.

Comment thread internal/deployer/operator.go
@AlexVulaj AlexVulaj requested a review from mclasmeier April 7, 2026 19:08
@AlexVulaj AlexVulaj self-assigned this Apr 7, 2026
Copy link
Copy Markdown
Collaborator

@mclasmeier mclasmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the issue, I am not 100% convinced that this is the way we should be doing it this way.

Why: I always tried to make roxie as snappy as possible to optimize for feedback cycles during development/testing.

With this change we would add some work for each new deployment (of the entire stack), namely redeploying the operator and waiting until it is ready. Currently roxie is treating the operator like some sort of implementation detail and automatically takes care of desired up- & downgrades when necessary. I personally think that this is working quite nicely.

What's your opinion on this?

At the same time I do understand that there might be use-cases for also cleaning up on the cluster entirely.

So, I am thinking, maybe we should provide ways to do both, but be explicit about it.

Just an idea, what about we stop treating "both" and "all" to mean the same thing? For example, "both" could mean "central & securedcluster" while "all" could mean "both + also the operator"?
This way we would get around introducing some flag like --all, which would make an invocation such as

roxie teardown all --all

seem a bit weird.

Let me also tag @porridge on this one.

@porridge
Copy link
Copy Markdown
Contributor

porridge commented Apr 8, 2026

+1 to @mclasmeier 's idea
BTW, there is also #55

@mclasmeier
Copy link
Copy Markdown
Collaborator

+1 to @mclasmeier 's idea BTW, there is also #55

Thank you for the reminder, will TAL.

@AlexVulaj
Copy link
Copy Markdown
Contributor Author

@mclasmeier @porridge thanks so much for your comments! I've made some pretty big changes, PTAL!

@AlexVulaj AlexVulaj requested a review from mclasmeier April 8, 2026 16:37
@AlexVulaj AlexVulaj force-pushed the fix-teardown-operator branch from 654ddad to db3a7ac Compare April 8, 2026 16:39
Copy link
Copy Markdown
Collaborator

@mclasmeier mclasmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Looking good, just 2 nits.

Comment thread internal/component/component.go
Comment thread internal/deployer/deploy_via_operator.go Outdated
Comment thread internal/deployer/deployer.go
Comment thread internal/component/component.go Outdated
- Revert deployOperator rename back to ensureOperatorDeployed
- Remove unused IncludesOperator() function
@AlexVulaj AlexVulaj enabled auto-merge (squash) April 9, 2026 12:53
@AlexVulaj AlexVulaj merged commit d04ddf7 into main Apr 9, 2026
3 checks passed
@AlexVulaj AlexVulaj deleted the fix-teardown-operator branch April 9, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

teardown all leaves operator behind

3 participants