Skip to content

Using the Kubernetes Tag Mapper

Overview

The Tag Mapper automatically deploys Kubernetes packages when Git tags matching specific patterns are pushed and successfully built. It supports multiple deployment rules per tag pattern, enabling sophisticated CI/CD workflows across different environments.

Enabling Tag Mapper

  1. Go to Development Servers → Select your application
  2. Open K8s CD tab
  3. In Tag deployment workflow section, check Use K8s Tag Mapper
  4. Set Default K8s Package Profile for mapped tags - fallback profile if rule doesn't specify one

Creating Deployment Rules

The Tag Map Rules table (in K8s CD tab) defines when and where to deploy:

Column Description Example
sequence Execution order (lower = first) 1, 2, 3
tag_match_code Git tag pattern to match beta, rc, :all_stable_tags
k8s_create_profile_for_tag_event Create package profile ✓ (read-only, auto-enabled)
k8s_base_profile_id Base profile to use my-app-beta-staging
deploy Auto-deploy to qualifiers ✓ or ✗
selector_qualifier_ids Target environments staging, qa, demo

Tag Match Code Examples

  • beta → matches 1.0.0-beta.5, 1.0.0-beta.42
  • alpha → matches 1.0.0-alpha.1
  • rc → matches 1.0.0-rc.2
  • :all_stable_tags → matches 1.0.0, 2.1.3 (no prerelease)

Multi-Rule Behavior: "Last Rule Wins"

When multiple rules target the same qualifier, Muppy uses smart deduplication:

Only the last rule (highest sequence) deploys to that qualifier.

Example

Rule 1 (seq=1): Deploy to [staging, qa]
Rule 2 (seq=2): Deploy to [qa, demo]

Result:
├─ staging → Rule 1 (only rule targeting it)
├─ qa → Rule 2 (last rule wins)
└─ demo → Rule 2 (only rule targeting it)

Benefits: - Each qualifier receives exactly ONE deployment - No duplicate package upgrades - Predictable, sequential execution

Common Patterns

Pattern 1: Progressive Deployment

Deploy beta versions through testing environments:

Rule 1: tag=beta, deploy to [staging]
Rule 2: tag=beta, deploy to [qa]
Rule 3: tag=beta, deploy to [demo]

Each qualifier gets its own rule → no overlaps → all deploy.

Pattern 2: Different Profiles per Environment

Same tag, different resource allocations:

Rule 1: tag=beta, profile=beta-minimal, deploy to [staging]
Rule 2: tag=beta, profile=beta-full, deploy to [production]

Pattern 3: Manual Approval Gate

Create profile without auto-deploying:

Rule 1: tag=beta, profile=beta-test, deploy to [staging] ✓
Rule 2: tag=beta, profile=beta-prod, deploy=✗, qualifier=none

Rule 2 creates profile for manual review, doesn't deploy automatically.

Configuration Tips

  1. Use Drag-Handle to reorder rules (click sequence column)
  2. Check Deploy Checkbox to enable auto-deployment to qualifiers
  3. Leave Deploy Unchecked to create profile-only (manual deployment later)
  4. Empty Qualifiers with deploy=checked: profile created, no deployment
  5. No Qualifiers + Deploy=unchecked: creates profile for manual deployment

Troubleshooting

No deployment happened: - Verify tag format matches tag_match_code (semver required) - Check GitLab pipeline succeeded before webhook fires - Verify qualifiers are selected and Deploy is checked - Enable logs: tail -f /tmp/odoo.log | grep "Tag Map Rule"

Wrong profile deployed: - Check rule sequence order (last rule wins overlapped qualifiers) - Verify base profile exists and belongs to correct K8s app

Deployment to wrong qualifier: - Overlapping qualifiers? Last rule wins strategy applies - Check rule sequence - lowest sequence number executes first