Mostly show v2 style MRs in MRD docs

Signed-off-by: Nic Cope <nicc@rk0n.org>
This commit is contained in:
Nic Cope 2025-08-11 13:30:07 -07:00
parent da67f969bf
commit a8176fbdb2
4 changed files with 99 additions and 57 deletions

View File

@ -124,7 +124,7 @@ kubectl get mrds -o jsonpath='{.items[*].spec.state}' \
Notice that Crossplane didn't create any CRDs yet: Notice that Crossplane didn't create any CRDs yet:
```shell ```shell
kubectl get crds | grep ec2.aws.crossplane.io kubectl get crds | grep ec2.aws.m.crossplane.io
# No output - CRDs don't exist until MRDs are activated # No output - CRDs don't exist until MRDs are activated
``` ```
@ -140,9 +140,9 @@ metadata:
name: my-app-resources name: my-app-resources
spec: spec:
activate: activate:
- instances.ec2.aws.crossplane.io # EC2 instances for compute - instances.ec2.aws.m.crossplane.io # EC2 instances for compute
- securitygroups.ec2.aws.crossplane.io # Security groups for networking - securitygroups.ec2.aws.m.crossplane.io # Security groups for networking
- vpcs.ec2.aws.crossplane.io # VPCs for isolation - vpcs.ec2.aws.m.crossplane.io # VPCs for isolation
``` ```
Save this as `activation-policy.yaml` and apply it: Save this as `activation-policy.yaml` and apply it:
@ -162,18 +162,18 @@ Check that Crossplane activated only the specified resources:
kubectl get mrds \ kubectl get mrds \
-o jsonpath='{range .items[*]}{.metadata.name}: {.spec.state}{"\n"}{end}' \ -o jsonpath='{range .items[*]}{.metadata.name}: {.spec.state}{"\n"}{end}' \
| grep Active | grep Active
# instances.ec2.aws.crossplane.io: Active # instances.ec2.aws.m.crossplane.io: Active
# securitygroups.ec2.aws.crossplane.io: Active # securitygroups.ec2.aws.m.crossplane.io: Active
# vpcs.ec2.aws.crossplane.io: Active # vpcs.ec2.aws.m.crossplane.io: Active
# Verify Crossplane created corresponding CRDs # Verify Crossplane created corresponding CRDs
kubectl get crds | grep ec2.aws.crossplane.io kubectl get crds | grep ec2.aws.m.crossplane.io
# instances.ec2.aws.crossplane.io # instances.ec2.aws.m.crossplane.io
# securitygroups.ec2.aws.crossplane.io # securitygroups.ec2.aws.m.crossplane.io
# vpcs.ec2.aws.crossplane.io # vpcs.ec2.aws.m.crossplane.io
# Count CRDs from EC2 provider - should match activated MRDs # Count CRDs from EC2 provider - should match activated MRDs
kubectl get crds | grep ec2.aws.crossplane.io | wc -l kubectl get crds | grep ec2.aws.m.crossplane.io | wc -l
# 3 (only the activated resources) # 3 (only the activated resources)
``` ```

View File

@ -181,7 +181,7 @@ kubectl get mrds
# All should show STATE: Inactive # All should show STATE: Inactive
# No CRDs should exist yet # No CRDs should exist yet
kubectl get crds | grep yourprovider.io kubectl get crds | grep yourprovider.m.crossplane.io
# Should return no results # Should return no results
# Create activation policy # Create activation policy
@ -192,15 +192,15 @@ metadata:
name: test-activation name: test-activation
spec: spec:
activate: activate:
- "myresource.yourprovider.io" - "myresource.yourprovider.m.crossplane.io"
EOF EOF
# Verify activation worked # Verify activation worked
kubectl get mrd myresource.yourprovider.io kubectl get mrd myresource.yourprovider.m.crossplane.io
# Should show STATE: Active # Should show STATE: Active
# CRD should now exist # CRD should now exist
kubectl get crd myresource.yourprovider.io kubectl get crd myresource.yourprovider.m.crossplane.io
``` ```
## Troubleshooting ## Troubleshooting

View File

@ -54,9 +54,9 @@ metadata:
name: aws-core-resources name: aws-core-resources
spec: spec:
activate: activate:
- buckets.s3.aws.crossplane.io - buckets.s3.aws.m.crossplane.io # Modern v2 style S3 buckets
- instances.rds.aws.crossplane.io - instances.rds.aws.m.crossplane.io # Modern v2 style RDS instances
- "*.ec2.aws.crossplane.io" # All EC2 resources - "*.ec2.aws.m.crossplane.io" # All modern v2 style EC2 resources
``` ```
When you apply this MRAP, Crossplane activates the specified S3 Bucket, RDS When you apply this MRAP, Crossplane activates the specified S3 Bucket, RDS
@ -80,9 +80,9 @@ Specify complete MRD names for precise control:
```yaml ```yaml
spec: spec:
activate: activate:
- buckets.s3.aws.crossplane.io - buckets.s3.aws.m.crossplane.io
- databases.rds.aws.crossplane.io - databases.rds.aws.m.crossplane.io
- clusters.eks.aws.crossplane.io - clusters.eks.aws.m.crossplane.io
``` ```
### Wildcard patterns ### Wildcard patterns
@ -92,15 +92,15 @@ Use `*` wildcards to match multiple resources:
```yaml ```yaml
spec: spec:
activate: activate:
- "*.s3.aws.crossplane.io" # All S3 resources - "*.s3.aws.m.crossplane.io" # All S3 resources
- "*.ec2.aws.crossplane.io" # All EC2 resources - "*.ec2.aws.m.crossplane.io" # All EC2 resources
- "*.rds.aws.crossplane.io" # All RDS databases - "*.rds.aws.m.crossplane.io" # All RDS databases
``` ```
{{<hint "important">}} {{<hint "important">}}
MRAPs use prefix-only wildcards, not full regular expressions. Only `*` at MRAPs use prefix-only wildcards, not full regular expressions. Only `*` at
the beginning of a pattern works (for example, `*.s3.aws.crossplane.io`). the beginning of a pattern works (for example, `*.s3.aws.m.crossplane.io`).
Patterns like `s3.*.aws.crossplane.io` or `*.s3.*` aren't valid. Patterns like `s3.*.aws.m.crossplane.io` or `*.s3.*` aren't valid.
{{</hint>}} {{</hint>}}
{{<hint "tip">}} {{<hint "tip">}}
@ -108,12 +108,54 @@ You can mix exact names and wildcards for flexible activation:
```yaml ```yaml
spec: spec:
activate: activate:
- buckets.s3.aws.crossplane.io # Exact S3 buckets - buckets.s3.aws.m.crossplane.io # Exact S3 buckets
- "*.ec2.aws.crossplane.io" # All EC2 resources - "*.ec2.aws.m.crossplane.io" # All EC2 resources
- clusters.eks.aws.crossplane.io # Exact EKS clusters - clusters.eks.aws.m.crossplane.io # Exact EKS clusters
``` ```
{{</hint>}} {{</hint>}}
## Legacy and modern resource versions
Crossplane v2 supports two styles of managed resources:
- **Modern v2 style** (recommended): Use `*.m.crossplane.io` domains for
namespaced managed resources with better isolation and security
- **Legacy v1 style**: Use `*.crossplane.io` domains for cluster-scoped
managed resources (maintained for backward compatibility)
### Activating modern resources
Most examples in this guide use modern v2 style resources:
```yaml
spec:
activate:
- buckets.s3.aws.m.crossplane.io # Modern v2 S3 bucket
- "*.ec2.aws.m.crossplane.io" # All modern v2 EC2 resources
```
### Activating legacy resources
To activate legacy v1 style resources, use patterns without `.m`:
```yaml
spec:
activate:
- buckets.s3.aws.crossplane.io # Legacy v1 S3 bucket
- "*.ec2.aws.crossplane.io" # All legacy v1 EC2 resources
```
### Mixed activation
You can activate both modern and legacy resources in the same MRAP:
```yaml
spec:
activate:
- "*.aws.m.crossplane.io" # All modern AWS resources
- "*.aws.crossplane.io" # All legacy AWS resources
```
## Common activation strategies ## Common activation strategies
### Activate everything (default behavior) ### Activate everything (default behavior)
@ -140,7 +182,7 @@ helm install crossplane crossplane-stable/crossplane \
# Or provide custom default activations # Or provide custom default activations
helm install crossplane crossplane-stable/crossplane \ helm install crossplane crossplane-stable/crossplane \
--set provider.defaultActivations={\ --set provider.defaultActivations={\
"*.s3.aws.crossplane.io","*.ec2.aws.crossplane.io"} "*.s3.aws.m.crossplane.io","*.ec2.aws.m.crossplane.io"}
``` ```
### Provider-specific activation ### Provider-specific activation
@ -169,10 +211,10 @@ metadata:
name: storage-and-compute name: storage-and-compute
spec: spec:
activate: activate:
- "*.s3.aws.crossplane.io" # AWS S3 resources - "*.s3.aws.m.crossplane.io" # AWS S3 resources
- "*.ec2.aws.crossplane.io" # AWS EC2 resources - "*.ec2.aws.m.crossplane.io" # AWS EC2 resources
- "*.storage.gcp.crossplane.io" # GCP Storage resources - "*.storage.gcp.m.crossplane.io" # GCP Storage resources
- "*.compute.gcp.crossplane.io" # GCP Compute resources - "*.compute.gcp.m.crossplane.io" # GCP Compute resources
``` ```
### Minimal activation ### Minimal activation
@ -186,9 +228,9 @@ metadata:
name: minimal-footprint name: minimal-footprint
spec: spec:
activate: activate:
- buckets.s3.aws.crossplane.io # Just S3 buckets - buckets.s3.aws.m.crossplane.io # Just S3 buckets
- instances.ec2.aws.crossplane.io # Just EC2 instances - instances.ec2.aws.m.crossplane.io # Just EC2 instances
- databases.rds.aws.crossplane.io # Just RDS databases - databases.rds.aws.m.crossplane.io # Just RDS databases
``` ```
<!-- vale Google.Headings = NO --> <!-- vale Google.Headings = NO -->
@ -212,8 +254,8 @@ metadata:
name: storage-team name: storage-team
spec: spec:
activate: activate:
- "*.s3.aws.crossplane.io" - "*.s3.aws.m.crossplane.io"
- "*.storage.gcp.crossplane.io" - "*.storage.gcp.m.crossplane.io"
--- ---
# Database team MRAP # Database team MRAP
apiVersion: apiextensions.crossplane.io/v1alpha1 apiVersion: apiextensions.crossplane.io/v1alpha1
@ -222,8 +264,8 @@ metadata:
name: database-team name: database-team
spec: spec:
activate: activate:
- "*.rds.aws.crossplane.io" - "*.rds.aws.m.crossplane.io"
- "*.sql.gcp.crossplane.io" - "*.sql.gcp.m.crossplane.io"
``` ```
### Configuration package activation ### Configuration package activation
@ -238,10 +280,10 @@ metadata:
name: web-platform-dependencies name: web-platform-dependencies
spec: spec:
activate: activate:
- buckets.s3.aws.crossplane.io # For static assets - buckets.s3.aws.m.crossplane.io # For static assets
- instances.ec2.aws.crossplane.io # For web servers - instances.ec2.aws.m.crossplane.io # For web servers
- databases.rds.aws.crossplane.io # For application data - databases.rds.aws.m.crossplane.io # For application data
- certificates.acm.aws.crossplane.io # For HTTPS - certificates.acm.aws.m.crossplane.io # For HTTPS
``` ```
<!-- vale Google.Headings = NO --> <!-- vale Google.Headings = NO -->
@ -291,12 +333,12 @@ status:
status: "True" status: "True"
reason: Running reason: Running
activated: activated:
- buckets.s3.aws.crossplane.io - buckets.s3.aws.m.crossplane.io
- instances.ec2.aws.crossplane.io - instances.ec2.aws.m.crossplane.io
- instances.rds.aws.crossplane.io - instances.rds.aws.m.crossplane.io
- securitygroups.ec2.aws.crossplane.io - securitygroups.ec2.aws.m.crossplane.io
- subnets.ec2.aws.crossplane.io - subnets.ec2.aws.m.crossplane.io
- vpcs.ec2.aws.crossplane.io - vpcs.ec2.aws.m.crossplane.io
``` ```
<!-- vale Google.Headings = NO --> <!-- vale Google.Headings = NO -->
@ -407,7 +449,7 @@ package dependencies.
add wildcards only when beneficial for maintainability add wildcards only when beneficial for maintainability
2. **Plan for provider evolution** - Design wildcard patterns that 2. **Plan for provider evolution** - Design wildcard patterns that
accommodate new resources as providers add them (for example, accommodate new resources as providers add them (for example,
`*.s3.aws.crossplane.io` works for future S3 resources) `*.s3.aws.m.crossplane.io` works for future S3 resources)
3. **Group related resources logically** - Create MRAPs that activate 3. **Group related resources logically** - Create MRAPs that activate
resources teams actually use together resources teams actually use together
4. **Include activation dependencies in Configuration packages** - 4. **Include activation dependencies in Configuration packages** -

View File

@ -63,9 +63,9 @@ managing instances of that resource.
apiVersion: apiextensions.crossplane.io/v1alpha1 apiVersion: apiextensions.crossplane.io/v1alpha1
kind: ManagedResourceDefinition kind: ManagedResourceDefinition
metadata: metadata:
name: buckets.s3.aws.crossplane.io name: buckets.s3.aws.m.crossplane.io
spec: spec:
group: s3.aws.crossplane.io group: s3.aws.m.crossplane.io
names: names:
kind: Bucket kind: Bucket
plural: buckets plural: buckets
@ -197,7 +197,7 @@ kubectl get managedresourcedefinitions
View MRD details: View MRD details:
```shell ```shell
kubectl describe mrd buckets.s3.aws.crossplane.io kubectl describe mrd buckets.s3.aws.m.crossplane.io
``` ```
<!-- vale Google.Headings = NO --> <!-- vale Google.Headings = NO -->
@ -238,7 +238,7 @@ status:
You can manually activate an MRD by changing its state: You can manually activate an MRD by changing its state:
```shell ```shell
kubectl patch mrd buckets.s3.aws.crossplane.io --type='merge' \ kubectl patch mrd buckets.s3.aws.m.crossplane.io --type='merge' \
-p='{"spec":{"state":"Active"}}' -p='{"spec":{"state":"Active"}}'
``` ```