Skip to content
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
93 changes: 93 additions & 0 deletions mission-control/docs/guide/permissions/concepts/scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: Scopes
sidebar_position: 4
---

Scopes define collections of resources that can be used for fine-grained access control in Mission Control. A Scope allows you to group resources by various criteria (agent, namespace, name, tags) and use these groups in permission rules to control who can access what resources.

Scopes work as building blocks for [ABAC](abac.md) permission policies and enable [multi-tenancy](multi-tenancy.md) by allowing you to partition resources across different teams, environments, or organizational boundaries.

## Core Concepts

### Scope Structure

A Scope consists of one or more **targets**, where each target defines a collection of resources. When a Scope contains multiple targets, the system combines them with **OR logic**, meaning a resource matches the Scope if it matches any of the targets.

:::info
Each target must specify exactly **one** resource type. You cannot mix different resource types within a single target.
:::

### Resource Selectors

Each target uses a `ScopeResourceSelector` to filter resources. The selector supports four fields:

| Field | Description | Example |
| ------------- | -------------------------------------------------------------------- | --------------------------------------------------- |
| `agent` | Filter by agent ID or name | `agent-prod-1` |
| `namespace` | Filter by Kubernetes namespace | `production` |
| `name` | Filter by resource name. Supports wildcard `*` to match any resource | `nginx-*` is **NOT** supported, but `*` matches all |
| `tagSelector` | Filter by tags using label selector syntax | `env=prod,region=us-west` |

:::info Wildcard Limitations
The `name` field supports only the special wildcard directive `*` which matches **any** resource. Prefix and suffix wildcards (e.g., `nginx-*` or `*-prod`) are **NOT** supported.
:::

### Resource Types

Scopes can target six different resource types:

1. **`config`** - Configuration items from config-db
2. **`component`** - Topology components from the catalog
3. **`playbook`** - Runnable playbooks and automation
4. **`canary`** - Health checks and synthetic monitors
5. **`view`** - Custom dashboards and views
6. **`global`** - Wildcard selector that applies to all resource types

## Integration with ABAC

Scopes work seamlessly with [Attribute-Based Access Control (ABAC)](abac.md). When using ABAC, you reference Scopes in your permission policies to define the resource boundaries for access control.

```yaml
apiVersion: mission-control.flanksource.com/v1
kind: Permission
metadata:
name: dev-team-access
spec:
subjects:
- kind: Group
name: dev-team
scopes:
- prod-agent-configs # Reference to Scope
actions:
- read
- update
```
Comment on lines 50 to 64
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML with file= directive import.

The YAML example is written directly in the documentation, which violates the coding guidelines. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change
-```yaml
-apiVersion: mission-control.flanksource.com/v1
-kind: Permission
-metadata:
-  name: dev-team-access
-spec:
-  subjects:
-    - kind: Group
-      name: dev-team
-  scopes:
-    - prod-agent-configs  # Reference to Scope
-  actions:
-    - read
-    - update
-```
+```yaml title="dev-team-access.yaml" file=<rootDir>/modules/mission-control/fixtures/permissions/dev-team-access.yaml
+
+```

Create the corresponding fixture file in the mission-control submodule.

🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/concepts/scope.md` around lines 50 -
64, Replace the inline YAML example in scope.md (the Permission example for
dev-team-access) with a code block using the file= directive pointing to a
fixture and create that fixture; specifically remove the inline Permission YAML
and add a ```yaml title="dev-team-access.yaml" file=...``` block, then add a
fixture named dev-team-access.yaml in the mission-control submodule
fixtures/permissions containing the original YAML (kind: Permission,
metadata.name: dev-team-access, subjects: Group dev-team, scopes:
[prod-agent-configs], actions: [read, update]) so the docs import the example
instead of embedding it inline.


This permission grants the `dev-team` group read and update access to all resources defined in the `prod-agent-configs` Scope.

### Scope Evaluation

When a user attempts to access a resource:

1. The system evaluates all Scopes referenced in the user's permissions
2. If the resource matches any target in any of the user's Scopes, the system grants access (subject to action restrictions)
3. Multiple Scopes are combined with OR logic

## Integration with Multi-Tenancy

Scopes are fundamental to implementing [multi-tenancy](multi-tenancy.md) in Mission Control. They allow you to partition resources across different tenants, teams, or organizational units.

Common multi-tenancy patterns include:

- **Environment Isolation** - Separate Scopes for dev, staging, and production environments
- **Team-Based Isolation** - Partition resources by team using namespaces or agents
- **Customer Isolation** - For SaaS scenarios, isolate customer resources by tags or agents

See the [multi-tenancy patterns examples](../examples/multi-tenancy-patterns.md) for detailed implementation patterns.

## See Also

- [Scope Examples](../examples) - Practical examples of Scope configurations
- [Attribute-Based Access Control (ABAC)](abac.md) - Using Scopes in permission policies
- [Multi-Tenancy](multi-tenancy.md) - Implementing tenant isolation with Scopes
- [Permission Actions](/reference/permissions/actions) - Available actions for Scope-based permissions
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Combining Selectors
---

Within a single `ScopeResourceSelector`, you can combine multiple fields. All specified fields must match (AND logic).

```yaml
apiVersion: mission-control.flanksource.com/v1
kind: Scope
metadata:
name: prod-west-configs
namespace: default
spec:
description: Production configs in us-west region from specific agent
targets:
- config:
agent: agent-west-1
namespace: production
tagSelector: 'region=us-west'
```
Comment on lines 7 to 20
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML with file= directive import.

The YAML example is written directly in the documentation, which violates the coding guidelines. All YAML examples must be imported from submodules using the file= directive. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change
-```yaml
-apiVersion: mission-control.flanksource.com/v1
-kind: Scope
-metadata:
-  name: prod-west-configs
-  namespace: default
-spec:
-  description: Production configs in us-west region from specific agent
-  targets:
-    - config:
-        agent: agent-west-1
-        namespace: production
-        tagSelector: "region=us-west"
-```
+```yaml title="prod-west-configs.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/prod-west-configs.yaml
+
+```

You'll need to create the corresponding fixture file in the mission-control submodule.

🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/examples/combining-selectors.md`
around lines 7 - 20, Replace the inline YAML with a code block that uses the
file= import directive pointing to a fixture named prod-west-configs.yaml and
create that fixture in the mission-control module fixtures (scopes) containing
the same Scope resource (kind: Scope, metadata.name: prod-west-configs,
namespace: default, spec.description: "Production configs in us-west region from
specific agent", spec.targets: - config: agent: agent-west-1, namespace:
production, tagSelector: "region=us-west"); update the doc code block to use
```yaml title="prod-west-configs.yaml" file=<point to that mission-control
fixture>``` so the example is imported rather than inlined.


This target matches configs that:

- Come from `agent-west-1` **AND**
- Are in the `production` namespace **AND**
- Have the tag `region=us-west`

All three conditions must be satisfied for a config to match this target.

**Use Cases:**

- Highly specific resource filtering
- Regional + environment isolation
- Agent-specific namespaced resources
- Complex compliance requirements

**Selector Logic Summary:**

- Fields within a single selector: **AND** logic (all must match)
- Multiple targets in a Scope: **OR** logic (any target can match)
- Multiple tags in `tagSelector`: **AND** logic (all tags must match)
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: Global Resource Selectors
---

The `global` resource type creates a Scope that applies to all resource types simultaneously. This is useful for namespace-wide or agent-wide restrictions.

```yaml
apiVersion: mission-control.flanksource.com/v1
kind: Scope
metadata:
name: namespace-restricted
namespace: default
spec:
description: All resources in specific namespace
targets:
- global:
namespace: restricted-zone
```
Comment on lines +7 to +18
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML with file= directive import.

The YAML example is written directly in the documentation, which violates the coding guidelines. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change
-```yaml
-apiVersion: mission-control.flanksource.com/v1
-kind: Scope
-metadata:
-  name: namespace-restricted
-  namespace: default
-spec:
-  description: All resources in specific namespace
-  targets:
-    - global:
-        namespace: restricted-zone
-```
+```yaml title="namespace-restricted.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/namespace-restricted.yaml
+
+```

Create the corresponding fixture file in the mission-control submodule.

🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/examples/global-resource-selectors.md`
around lines 7 - 18, Replace the inline YAML in global-resource-selectors.md
with a file-import code block that references the fixture file named
namespace-restricted.yaml (e.g. ```yaml title="namespace-restricted.yaml"
file=...```) and create that fixture in the mission-control module's
fixtures/scopes directory; the new fixture must contain the original Scope
manifest (kind: Scope, metadata.name: namespace-restricted, metadata.namespace:
default, spec.description: "All resources in specific namespace", spec.targets
-> global.namespace: restricted-zone) so the documentation imports the example
instead of inlining it.


This Scope matches configs, components, playbooks, canaries, and views in the `restricted-zone` namespace.

## When to Use Global Selectors

**Use global selectors when:**

- Applying namespace-based isolation across all resource types
- Creating agent-wide restrictions
- Implementing broad organizational boundaries
- Simplifying Scope definitions for common patterns

**Avoid global selectors when:**

- You need fine-grained control per resource type
- Different resource types have different access requirements
- You want to apply different tag filters to different resource types

## Global vs. Multiple Targets

These two Scopes are functionally equivalent:

**Using global:**

```yaml
targets:
- global:
namespace: myapp
```

**Using individual targets:**

```yaml
targets:
- config:
namespace: myapp
- component:
namespace: myapp
- playbook:
namespace: myapp
- canary:
namespace: myapp
- view:
namespace: myapp
```
Comment on lines 43 to 63
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML comparison examples with file= directive imports.

Both YAML examples in the comparison are written inline, which violates the coding guidelines. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change

Create two fixture files in the mission-control submodule and reference them:

 **Using global:**
-```yaml
-targets:
-  - global:
-      namespace: myapp
-```
+```yaml title="global-example.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/global-example.yaml
+
+```

 **Using individual targets:**
-```yaml
-targets:
-  - config:
-      namespace: myapp
-  - component:
-      namespace: myapp
-  - playbook:
-      namespace: myapp
-  - canary:
-      namespace: myapp
-  - view:
-      namespace: myapp
-```
+```yaml title="individual-targets-example.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/individual-targets-example.yaml
+
+```
🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/examples/global-resource-selectors.md`
around lines 40 - 59, Replace the two inline YAML examples with imported
fixtures: create fixture files named global-example.yaml and
individual-targets-example.yaml inside the mission-control fixtures scopes, then
replace the inline code blocks in global-resource-selectors.md with fenced code
blocks using the file= directive to reference those two fixture filenames (keep
the title attributes as shown). Locate the existing inline blocks in
global-resource-selectors.md (the "global" example and the "Using individual
targets" example) and swap them for the file-import style code fences that point
to the new mission-control fixture files.


The `global` approach is more concise but less flexible if you later need to apply different filters to different resource types.
10 changes: 10 additions & 0 deletions mission-control/docs/guide/permissions/examples/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Examples
sidebar_position: 5
sidebar_custom_props:
icon: tutorial
---

import DocCardList from '@theme/DocCardList';

<DocCardList />
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
title: Multi-Tenancy Patterns
---

Scopes are fundamental to implementing multi-tenancy in Mission Control. Here are common patterns for partitioning resources across different tenants, teams, or organizational units.

## Environment Isolation

Create separate Scopes for different environments to prevent accidental changes to production:

```yaml
apiVersion: mission-control.flanksource.com/v1
kind: Scope
metadata:
name: production-resources
namespace: default
spec:
description: All production resources
targets:
- config:
tagSelector: 'env=production'
- component:
tagSelector: 'env=production'
- playbook:
tagSelector: 'env=production'
```
Comment on lines 11 to 26
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML with file= directive import.

The YAML example is written directly in the documentation, which violates the coding guidelines. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change
-```yaml
-apiVersion: mission-control.flanksource.com/v1
-kind: Scope
-metadata:
-  name: production-resources
-  namespace: default
-spec:
-  description: All production resources
-  targets:
-    - config:
-        tagSelector: "env=production"
-    - component:
-        tagSelector: "env=production"
-    - playbook:
-        tagSelector: "env=production"
-```
+```yaml title="production-resources.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/production-resources.yaml
+
+```

Create the corresponding fixture file in the mission-control submodule.

🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/examples/multi-tenancy-patterns.md`
around lines 11 - 26, Replace the inline YAML block in multi-tenancy-patterns.md
with a code block using the file= directive that references a fixture (title
"production-resources.yaml"); then add a fixture file named
production-resources.yaml under the mission-control module's fixtures/scopes
directory containing the original Scope manifest (kind: Scope, metadata.name:
production-resources, metadata.namespace: default, spec.description: All
production resources, spec.targets with config/component/playbook tagSelector
"env=production") so the document imports the example instead of embedding it
inline.


Grant developers read-only access to production resources and full access to development resources.

## Team-Based Isolation

Partition resources by team using namespace or agent:

```yaml
apiVersion: mission-control.flanksource.com/v1
kind: Scope
metadata:
name: platform-team-resources
namespace: default
spec:
description: Resources managed by platform team
targets:
- config:
namespace: platform-team
- component:
namespace: platform-team
```
Comment on lines +34 to +47
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML with file= directive import.

The YAML example is written directly in the documentation, which violates the coding guidelines. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change
-```yaml
-apiVersion: mission-control.flanksource.com/v1
-kind: Scope
-metadata:
-  name: platform-team-resources
-  namespace: default
-spec:
-  description: Resources managed by platform team
-  targets:
-    - config:
-        namespace: platform-team
-    - component:
-        namespace: platform-team
-```
+```yaml title="platform-team-resources.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/platform-team-resources.yaml
+
+```

Create the corresponding fixture file in the mission-control submodule.

🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/examples/multi-tenancy-patterns.md`
around lines 34 - 47, Replace the inline YAML example for the Scope named
"platform-team-resources" with a code block that uses the file= directive (and
title "platform-team-resources.yaml") and create a fixture file in the
mission-control module's fixtures/scopes named platform-team-resources.yaml
containing the original YAML (apiVersion: mission-control.flanksource.com/v1,
kind: Scope, metadata.name: platform-team-resources, metadata.namespace:
default, spec.description, spec.targets with config/component namespace:
platform-team). Update the code block in multi-tenancy-patterns.md to reference
that fixture file instead of embedding the YAML.


Each team gets their own namespace, and Scopes ensure teams can only access their designated resources.

## Customer Isolation (SaaS)

For SaaS scenarios, isolate customer resources by agent or tags:

```yaml
apiVersion: mission-control.flanksource.com/v1
kind: Scope
metadata:
name: customer-acme-resources
namespace: default
spec:
description: All resources for ACME Corp
targets:
- config:
tagSelector: 'customer=acme'
```
Comment on lines 55 to 66
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML with file= directive import.

The YAML example is written directly in the documentation, which violates the coding guidelines. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change
-```yaml
-apiVersion: mission-control.flanksource.com/v1
-kind: Scope
-metadata:
-  name: customer-acme-resources
-  namespace: default
-spec:
-  description: All resources for ACME Corp
-  targets:
-    - config:
-        tagSelector: "customer=acme"
-```
+```yaml title="customer-acme-resources.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/customer-acme-resources.yaml
+
+```

Create the corresponding fixture file in the mission-control submodule.

🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/examples/multi-tenancy-patterns.md`
around lines 55 - 66, Replace the inline YAML block in
mission-control/docs/guide/permissions/examples/multi-tenancy-patterns.md with a
code block that uses the file= directive pointing to a fixture named
customer-acme-resources.yaml, and add that fixture to the mission-control
fixtures (scopes) submodule; the fixture should contain the original Scope
resource with metadata.name customer-acme-resources, metadata.namespace default
and the spec (description: "All resources for ACME Corp" and targets -> config
-> tagSelector: "customer=acme"). Ensure the code block uses
title="customer-acme-resources.yaml" and the file= directive referencing the new
fixture.


You tag each customer's resources appropriately, and Scopes ensure customer data isolation.

## Multi-Dimensional Isolation

Combine multiple isolation dimensions (environment + team + region):

```yaml
apiVersion: mission-control.flanksource.com/v1
kind: Scope
metadata:
name: team-a-prod-west
namespace: default
spec:
description: Team A production resources in west region
targets:
- config:
namespace: team-a
tagSelector: 'env=production,region=west'
```
Comment on lines 74 to 86
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML with file= directive import.

The YAML example is written directly in the documentation, which violates the coding guidelines. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change
-```yaml
-apiVersion: mission-control.flanksource.com/v1
-kind: Scope
-metadata:
-  name: team-a-prod-west
-  namespace: default
-spec:
-  description: Team A production resources in west region
-  targets:
-    - config:
-        namespace: team-a
-        tagSelector: "env=production,region=west"
-```
+```yaml title="team-a-prod-west.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/team-a-prod-west.yaml
+
+```

Create the corresponding fixture file in the mission-control submodule.

🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/examples/multi-tenancy-patterns.md`
around lines 74 - 86, Replace the inline YAML in multi-tenancy-patterns.md (the
Scope example named team-a-prod-west) with a YAML code block using the file=
directive (title "team-a-prod-west.yaml" and file pointing to the fixture), and
create the corresponding fixture file team-a-prod-west.yaml under the
mission-control fixtures scopes directory containing the original Scope YAML
(apiVersion: mission-control.flanksource.com/v1, kind: Scope, metadata
name/team-a-prod-west namespace/default, spec description and targets with
config namespace/tagSelector) so the docs import the example instead of
embedding it inline.


This provides granular control for complex organizational structures.

**Key Principles:**

- Use consistent tagging strategies across all resources
- Document your tenant isolation model
- Start with broader Scopes and refine as needed
- Combine Scopes with [ABAC](../concepts/abac.md) policies for complete access control
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Multiple Resource Types
---

A single Scope can include multiple resource types by using multiple targets. Each target must specify exactly one resource type, and targets are combined with OR logic.

```yaml
apiVersion: mission-control.flanksource.com/v1
kind: Scope
metadata:
name: monitoring-stack
namespace: default
spec:
description: Complete monitoring stack resources
targets:
- config:
tagSelector: 'app=prometheus'
- component:
tagSelector: 'app=prometheus'
- canary:
tagSelector: 'app=prometheus'
```
Comment on lines 7 to 22
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inline YAML with file= directive import.

The YAML example is written directly in the documentation, which violates the coding guidelines. As per coding guidelines: "Never write YAML examples directly; import examples from submodules (mission-control, duty, config-db, canary-checker) using code blocks with file= directive."

📝 Required change
-```yaml
-apiVersion: mission-control.flanksource.com/v1
-kind: Scope
-metadata:
-  name: monitoring-stack
-  namespace: default
-spec:
-  description: Complete monitoring stack resources
-  targets:
-    - config:
-        tagSelector: "app=prometheus"
-    - component:
-        tagSelector: "app=prometheus"
-    - canary:
-        tagSelector: "app=prometheus"
-```
+```yaml title="monitoring-stack.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/monitoring-stack.yaml
+
+```

Create the corresponding fixture file in the mission-control submodule.

🤖 Prompt for AI Agents
In `@mission-control/docs/guide/permissions/examples/multiple-resource-types.md`
around lines 7 - 22, Replace the inline YAML example for the Scope resource
named "monitoring-stack" with a code block using the file= directive (e.g.,
```yaml title="monitoring-stack.yaml" file=...```), and create the referenced
fixture file containing the original YAML content (Scope, metadata.name
monitoring-stack, namespace default, spec.description and targets for
config/component/canary with tagSelector "app=prometheus") in the
mission-control module's fixtures for scopes so the documentation imports the
example instead of embedding it inline.


This Scope includes configs, components, and canaries that all have the tag `app=prometheus`. A resource matches the Scope if it matches **any** of the three targets.

**Use Cases:**

- Application stack ownership (all resources for an app)
- Feature-based access (configs + playbooks for a feature)
- Platform team permissions (infrastructure + monitoring)
- Cross-cutting concerns (observability resources across types)

:::info
Remember: Each target can only specify **one** resource type, but a single Scope can have multiple targets for different resource types.
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Targeting by Agent
---

This example shows how to scope configs based on which agent reported them. This is useful for creating permissions that apply to specific infrastructure components or regions.

```yaml title="prod-agent-configs.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/prod-agent-configs.yaml

```

This Scope includes all configs reported by either `agent-prod-1` or `agent-prod-2`. The multiple targets use OR logic, so any config from either agent will match this Scope.

**Use Cases:**

- Granting access to resources from specific production agents
- Regional isolation (agents in different regions)
- Infrastructure team boundaries (different teams managing different agents)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Targeting by Tags
---

This example shows how to use tag selectors to dynamically scope resources based on their labels. Tag-based scoping is the most flexible approach because you can add or remove resources from the scope by simply updating their tags.

```yaml title="homelab-all-resources.yaml" file=<rootDir>/modules/mission-control/fixtures/scopes/homelab-all-resources.yaml

```

The `tagSelector` uses label selector syntax to match configs with `cluster=homelab` AND `namespace=monitoring` tags. All specified tags must match (AND logic within a single selector).

**Advantages of Tag-Based Scoping:**

- **Dynamic**: Resources automatically join/leave the scope when tags change
- **Flexible**: No need to update Scope definitions when adding new resources
- **Expressive**: Combine multiple tags to create precise filters
- **Maintainable**: Centralize resource categorization through tagging strategy

**Use Cases:**

- Environment-based access (dev, staging, prod)
- Application-based grouping
- Compliance and regulatory boundaries
- Cost center or team ownership
Loading