Skip to content

Commit 490414a

Browse files
committed
WIP: Guide for updating v1 -> v2
Signed-off-by: Nic Cope <[email protected]>
1 parent 0314e64 commit 490414a

File tree

1 file changed

+327
-0
lines changed

1 file changed

+327
-0
lines changed
Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
---
2+
title: Upgrade to Crossplane v2
3+
weight: 410
4+
description: "Upgrade from Crossplane v1 to v2"
5+
---
6+
7+
Crossplane v2 introduces significant improvements while maintaining backward
8+
compatibility with most v1 configurations. This guide helps you upgrade from
9+
Crossplane v1.x to v2.
10+
11+
{{<hint "important">}}
12+
Only upgrade to Crossplane v2 from Crossplane v1.20, the final v1.x release.
13+
If you're running an earlier version, upgrade to v1.20 first.
14+
{{</hint>}}
15+
16+
## Prerequisites
17+
18+
Before upgrading, ensure:
19+
20+
* You're running Crossplane v1.20
21+
* You're not using deprecated features (see [removed features](#removed-features))
22+
* All packages use fully qualified image names
23+
* [Helm](https://helm.sh/docs/intro/install/) version v3.2.0 or later
24+
25+
## What changes in v2
26+
27+
Crossplane v2 makes these major improvements:
28+
29+
* **Namespaced resources**: Crossplane now creates both composite resources (XRs) and managed
30+
resources (MRs) in namespaces by default
31+
* **Compose any resource**: XRs can compose any Kubernetes resource, not just
32+
Crossplane resources
33+
* **Operations**: New operational workflows using function pipelines
34+
* **Simplified architecture**: Removes the need for claims and provider-kubernetes Objects
35+
36+
## Removed features
37+
38+
Crossplane v2 removes these deprecated features:
39+
40+
* [Native patch and transform composition](#native-patch-and-transform-composition)
41+
* [ControllerConfig type](#controllerconfig-type)
42+
* [External secret stores](#external-secret-stores)
43+
* [Default registry flag](#default-registry-flag)
44+
45+
### Native patch and transform composition
46+
**Deprecated in**: v1.17
47+
**Replaced by**: [Composition functions]({{<ref "../composition/compositions">}})
48+
49+
If you're using `spec.mode: Resources` in your Compositions, migrate to
50+
composition functions before upgrading.
51+
52+
<!-- vale Google.Headings = NO -->
53+
### ControllerConfig type
54+
<!-- vale Google.Headings = YES -->
55+
**Deprecated in**: v1.11
56+
**Replaced by**: [DeploymentRuntimeConfig]({{<ref "../packages/providers#runtime-configuration">}})
57+
58+
Update any ControllerConfig resources to use DeploymentRuntimeConfig instead.
59+
60+
### External secret stores
61+
**Status**: alpha feature, unmaintained
62+
63+
If you're using external secret stores, migrate to native Kubernetes secrets
64+
or external secret operators before upgrading.
65+
66+
### Default registry flag
67+
**Removed**: `--registry` flag for default package registry
68+
69+
All packages must now use fully qualified image names. Check your packages
70+
with:
71+
72+
```shell
73+
kubectl get pkg -o wide
74+
```
75+
76+
Update any packages without fully qualified names before upgrading.
77+
78+
## Who can upgrade
79+
80+
You can upgrade to Crossplane v2 if you meet these criteria:
81+
82+
* ✅ Running Crossplane v1.20
83+
* ✅ Not using native patch and transform composition
84+
* ✅ Not using ControllerConfig resources
85+
* ✅ Not using external secret stores
86+
* ✅ All packages use fully qualified image names
87+
88+
If you're using any removed features, migrate away from them first.
89+
90+
## Upgrade approach
91+
92+
The recommended upgrade approach:
93+
94+
1. [Prepare for upgrade](#1-prepare-for-upgrade)
95+
2. [Upgrade Crossplane core](#2-upgrade-crossplane-core)
96+
3. [Configure managed resource activation policies](#3-configure-managed-resource-activation-policies)
97+
4. [Upgrade to v2.0.0 providers](#4-upgrade-providers)
98+
5. [Start using v2 features](#5-start-using-v2-features)
99+
100+
### 1. Prepare for upgrade
101+
102+
Check for deprecated features in your cluster:
103+
104+
```shell
105+
# Check for native patch and transform compositions
106+
kubectl get compositions -o jsonpath='{range .items[*]}{.metadata.name}: {.spec.mode}{"\n"}{end}' | grep Resources
107+
108+
# Check for ControllerConfig resources
109+
kubectl get controllerconfigs
110+
111+
# Check for packages without fully qualified names
112+
kubectl get pkg -o wide | grep -v '/'
113+
```
114+
115+
If any of these commands return results, address them before upgrading.
116+
117+
### 2. Upgrade Crossplane core
118+
119+
Add the Crossplane Helm repository:
120+
121+
```shell
122+
helm repo add crossplane-stable https://charts.crossplane.io/stable
123+
helm repo update
124+
```
125+
126+
Upgrade to Crossplane v2:
127+
128+
```shell
129+
helm upgrade crossplane \
130+
--namespace crossplane-system \
131+
crossplane-stable/crossplane \
132+
--version="2.0.0"
133+
```
134+
135+
Verify the upgrade:
136+
137+
```shell
138+
kubectl get pods -n crossplane-system
139+
```
140+
141+
### 3. Configure managed resource activation policies
142+
143+
Crossplane v2 introduces managed resource activation policies (MRAPs) to
144+
control which managed resources are active in your cluster.
145+
146+
Create a default activation policy:
147+
148+
```yaml
149+
apiVersion: apiextensions.crossplane.io/v1beta1
150+
kind: ManagedResourceActivationPolicy
151+
metadata:
152+
name: default
153+
spec:
154+
# Activate all legacy cluster-scoped MRs by default
155+
activation: Default
156+
selector:
157+
matchLabels:
158+
crossplane.io/scope: cluster
159+
```
160+
161+
Apply the policy:
162+
163+
```shell
164+
kubectl apply -f mrap.yaml
165+
```
166+
167+
{{<hint "tip">}}
168+
MRAPs help reduce cluster overhead by activating only the managed resources
169+
you need. See the [MRAP documentation]({{<ref "../managed-resources/managed-resource-activation-policies">}})
170+
for advanced configurations.
171+
{{</hint>}}
172+
173+
### 4. Upgrade providers
174+
175+
Upgrade your providers to versions that support both namespaced and
176+
cluster-scoped managed resources:
177+
178+
```shell
179+
# Check current provider versions
180+
kubectl get providers
181+
182+
# Upgrade to v2.0.0 providers (example for provider-aws)
183+
kubectl apply -f - <<EOF
184+
apiVersion: pkg.crossplane.io/v1
185+
kind: Provider
186+
metadata:
187+
name: provider-aws
188+
spec:
189+
package: xpkg.crossplane.io/upbound/provider-aws:v2.0.0
190+
EOF
191+
```
192+
193+
{{<hint "note">}}
194+
Provider v2.0.0 releases support both legacy cluster-scoped and new
195+
namespaced managed resources. Your existing cluster-scoped MRs continue
196+
working unchanged.
197+
{{</hint>}}
198+
199+
### 5. Start using v2 features
200+
201+
After upgrading, you can begin using Crossplane v2 features:
202+
203+
#### Create namespaced XRDs
204+
205+
Create composite resource definitions that define namespaced XRs:
206+
207+
```yaml
208+
apiVersion: apiextensions.crossplane.io/v2
209+
kind: CompositeResourceDefinition
210+
metadata:
211+
name: apps.example.crossplane.io
212+
spec:
213+
scope: Namespaced # Default in v2
214+
group: example.crossplane.io
215+
names:
216+
kind: App
217+
plural: apps
218+
# schema definition...
219+
```
220+
221+
#### Use namespaced managed resources
222+
223+
Create managed resources directly in namespaces:
224+
225+
```yaml
226+
apiVersion: s3.aws.m.crossplane.io/v1beta1
227+
kind: Bucket
228+
metadata:
229+
name: my-bucket
230+
namespace: production
231+
spec:
232+
forProvider:
233+
region: us-east-2
234+
```
235+
236+
#### Try operations
237+
238+
Explore operational workflows with the new Operations feature:
239+
240+
```yaml
241+
apiVersion: ops.crossplane.io/v1alpha1
242+
kind: Operation
243+
metadata:
244+
name: certificate-check
245+
spec:
246+
mode: Pipeline
247+
pipeline:
248+
- step: check-certificates
249+
functionRef:
250+
name: crossplane-contrib-function-python
251+
# function configuration...
252+
```
253+
254+
## Legacy resource behavior
255+
256+
Your existing v1 resources continue working in Crossplane v2:
257+
258+
* **Legacy cluster-scoped XRs**: Continue working with claims support
259+
* **Legacy cluster-scoped MRs**: Continue working unchanged
260+
* **Existing Compositions**: Continue working with legacy XRs
261+
262+
These resources use `LegacyCluster` scope internally and maintain full
263+
backward compatibility.
264+
265+
## Migration timeline
266+
267+
There's no rush to migrate existing resources. Crossplane v2 maintains full
268+
support for legacy resources:
269+
270+
* **Immediate**: Start using v2 features for new resources
271+
* **Short term**: Migrate Compositions to work with v2 XRs as needed
272+
* **Long term**: Consider migrating existing resources to v2 patterns
273+
274+
{{<hint "tip">}}
275+
Crossplane may provide automated migration tooling in future releases to
276+
help transition legacy resources to v2 patterns.
277+
{{</hint>}}
278+
279+
## Troubleshooting
280+
281+
### Upgrade fails with package validation errors
282+
283+
**Issue**: packages without fully qualified names fail validation
284+
285+
**Solution**: update all packages to use fully qualified image names:
286+
287+
```yaml
288+
apiVersion: pkg.crossplane.io/v1
289+
kind: Provider
290+
metadata:
291+
name: my-provider
292+
spec:
293+
package: registry.example.com/my-org/my-provider:v1.0.0
294+
```
295+
296+
### Functions don't recognize new resource types
297+
298+
**Issue**: composition functions can't work with new namespaced resources
299+
300+
**Solution**: ensure you're using function versions that support both
301+
cluster-scoped and namespaced resources.
302+
303+
<!-- vale Google.Headings = NO -->
304+
### MRAPs not activating expected resources
305+
<!-- vale Google.Headings = YES -->
306+
307+
**Issue**: expected managed resources aren't available after upgrade
308+
309+
**Solution**: review your MRAP configuration and verify it matches your
310+
resource labels:
311+
312+
```shell
313+
kubectl get mraps -o yaml
314+
kubectl get mrds --show-labels
315+
```
316+
317+
## Next steps
318+
319+
After upgrading:
320+
321+
1. **Explore namespaced resources**: Try creating XRs and MRs in namespaces
322+
2. **Build app compositions**: Use v2's ability to compose any Kubernetes resource
323+
3. **Try Operations**: Experiment with operational workflows
324+
4. **Plan migration**: Consider which existing resources to migrate to v2 patterns
325+
326+
Read more about [what's new in v2]({{<ref "../whats-new">}}) and explore the
327+
updated [composition documentation]({{<ref "../composition/compositions">}}).

0 commit comments

Comments
 (0)