posit-dev / posit-dev/ptd

Migration resources race condition: posit-team-system namespace may not exist

Open
#179 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
7
Forks
2
Avg merge
1d 15h
Merged PRs (30d)
3

Description

Problem

The clusters step can fail when migration resources (ServiceAccount, Job) are created in the posit-team-system namespace before anything has created that namespace.

The Helm release for team-operator sets create_namespace=True, which would create posit-team-system — but the migration resources run before the Helm release, so the namespace doesn't exist yet when they're applied.

Relevant code: python-pulumi/src/ptd/pulumi_resources/team_operator.py

  • Migration ServiceAccount and Job target namespace=ptd.POSIT_TEAM_SYSTEM_NAMESPACE (~lines 99-201)
  • Helm release with create_namespace=True runs after (~line 321)
  • No explicit namespace creation or dependency exists for posit-team-system before the migration resources

Context

  • A fix was attempted in b074d4f (Feb 5) adding explicit namespace creation as a separate Pulumi resource
  • It was reverted in 7b64328 (Feb 6) because it conflicted with the Helm-managed namespace on running workloads
  • Other components (Loki, Mimir, Alloy, Grafana) all create their namespaces explicitly as separate Pulumi resources — team-operator is the exception

Possible fixes

  • Explicit namespace creation with adopt/import to avoid conflict with the existing Helm-managed namespace
  • Reorder dependencies so the Helm release (and its namespace creation) runs before migration resources
  • Use a Pulumi resource option (e.g., ignore_changes on the namespace) to prevent conflict on subsequent runs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in python-pulumi/src/ptd/pulumi_resources/team_operator.py, reviewing the migration ServiceAccount and Job around lines 99-201 and the Helm release near line 321. Compare commits b074d4f and 7b64328 to understand the namespace conflict, then verify the chosen fix lets migration resources apply before or with namespace creation without conflicting on existing workloads.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.