@@ -5,7 +5,7 @@ weight: 200
5
5
6
6
If you have resources that are already provisioned in a Provider,
7
7
you can import them as managed resources and let Crossplane manage them.
8
- A managed resource's [ ` managementPolicies ` ] ({{<ref "/v1.13 /concepts/managed-resources#managementpolicies">}})
8
+ A managed resource's [ ` managementPolicies ` ] ({{<ref "/v1.16 /concepts/managed-resources#managementpolicies">}})
9
9
field enables importing external resources into Crossplane.
10
10
11
11
Crossplane can import resources either [ manually] ({{<ref "#import-resources-manually">}})
@@ -14,17 +14,17 @@ or [automatically]({{<ref "#import-resources-automatically">}}).
14
14
## Import resources manually
15
15
16
16
Crossplane can discover and import existing Provider resources by matching the
17
- ` crossplane.io/external-name ` annotation in a managed resource.
17
+ ` crossplane.io/external-name ` annotation in a managed resource.
18
18
19
19
To import an existing external resource in a Provider, create a new managed
20
20
resource with the ` crossplane.io/external-name ` annotation. Set the annotation
21
21
value to the name of the resource in the Provider.
22
22
23
- For example, to import an existing GCP Network named
23
+ For example, to import an existing GCP Network named
24
24
{{<hover label =" annotation " line =" 5 " >}}my-existing-network{{</hover >}},
25
- create a new managed resource and use the
25
+ create a new managed resource and use the
26
26
{{<hover label =" annotation " line =" 5 " >}}my-existing-network{{</hover >}} in the
27
- annotation.
27
+ annotation.
28
28
29
29
``` yaml {label="annotation",copy-lines="none"}
30
30
apiVersion : compute.gcp.crossplane.io/v1beta1
@@ -34,14 +34,14 @@ metadata:
34
34
crossplane.io/external-name : my-existing-network
35
35
` ` `
36
36
37
- The {{<hover label="name" line="5">}}metadata.name{{</hover>}}
38
- field can be anything you want. For example,
39
- {{<hover label="name" line="5">}}imported-network{{</hover>}}.
37
+ The {{<hover label="name" line="5">}}metadata.name{{</hover>}}
38
+ field can be anything you want. For example,
39
+ {{<hover label="name" line="5">}}imported-network{{</hover>}}.
40
40
41
41
{{< hint "note" >}}
42
- This name is the
42
+ This name is the
43
43
name of the Kubernetes object. It's not related to the resource name inside the
44
- Provider.
44
+ Provider.
45
45
{{< /hint >}}
46
46
47
47
` ` ` yaml {label="name",copy-lines="none"}
@@ -53,15 +53,15 @@ metadata:
53
53
crossplane.io/external-name : my-existing-network
54
54
` ` `
55
55
56
- Leave the
57
- {{<hover label="fp" line="8">}}spec.forProvider{{</hover>}} field empty.
58
- Crossplane imports the settings and automatically applies them to the managed
59
- resource.
56
+ Leave the
57
+ {{<hover label="fp" line="8">}}spec.forProvider{{</hover>}} field empty.
58
+ Crossplane imports the settings and automatically applies them to the managed
59
+ resource.
60
60
61
61
{{< hint "important" >}}
62
- If the managed resource has _required_ fields in the
62
+ If the managed resource has _required_ fields in the
63
63
{{<hover label="fp" line="8">}}spec.forProvider{{</hover>}} you must add it to
64
- the ` forProvider` field.
64
+ the ` forProvider` field.
65
65
66
66
The values of those fields must match what's inside the Provider or Crossplane
67
67
overwrites the existing values.
@@ -82,17 +82,17 @@ spec:
82
82
Crossplane now controls and manages this imported resource. Any changes to the
83
83
managed resource `spec` changes the external resource.
84
84
85
- # # Import resources automatically
85
+ # # Import resources automatically
86
86
87
- Automatically import external resources with an `Observe` [management policy]({{<ref "/v1.13 /concepts/managed-resources#managementpolicies">}}).
87
+ Automatically import external resources with an `Observe` [management policy]({{<ref "/v1.16 /concepts/managed-resources#managementpolicies">}}).
88
88
89
89
Crossplane imports observe only resources but never changes or deletes the
90
90
resources.
91
91
92
92
{{<hint "important" >}}
93
- The managed resource `managementPolicies` option is a beta feature.
93
+ The managed resource `managementPolicies` option is a beta feature.
94
94
95
- The Provider determines support for management policies.
95
+ The Provider determines support for management policies.
96
96
Refer to the Provider's documentation to see if the Provider supports
97
97
management policies.
98
98
{{< /hint >}}
@@ -101,15 +101,15 @@ management policies.
101
101
# ## Apply the Observe management policy
102
102
<!-- vale on -->
103
103
104
- Create a new managed resource matching the
105
- {{<hover label="oo-policy" line="1">}}apiVersion{{</hover>}} and
104
+ Create a new managed resource matching the
105
+ {{<hover label="oo-policy" line="1">}}apiVersion{{</hover>}} and
106
106
{{<hover label="oo-policy" line="2">}}kind{{</hover>}} of the resource
107
107
to import and add
108
- {{<hover label="oo-policy" line="4">}}managementPolicies: ["Observe"]{{</hover>}} to the
108
+ {{<hover label="oo-policy" line="4">}}managementPolicies: ["Observe"]{{</hover>}} to the
109
109
{{<hover label="oo-policy" line="3">}}spec{{</hover>}}
110
110
111
111
For example, to import a GCP SQL DatabaseInstance, create a new resource with
112
- the {{<hover label="oo-policy" line="4">}}managementPolicies : ["Observe"]{{</hover>}}
112
+ the {{<hover label="oo-policy" line="4">}}managementPolicies : ["Observe"]{{</hover>}}
113
113
set.
114
114
` ` ` yaml {label="oo-policy",copy-lines="none"}
115
115
apiVersion: sql.gcp.upbound.io/v1beta1
@@ -119,14 +119,14 @@ spec:
119
119
` ` `
120
120
121
121
# ## Add the external-name annotation
122
- Add the {{<hover label="oo-ex-name" line="5">}}crossplane.io/external-name{{</hover>}}
122
+ Add the {{<hover label="oo-ex-name" line="5">}}crossplane.io/external-name{{</hover>}}
123
123
annotation for the resource. This name must match the name inside the Provider.
124
124
125
- For example, for a GCP database named
125
+ For example, for a GCP database named
126
126
{{<hover label="oo-ex-name" line="5">}}my-external-database{{</hover>}}, apply
127
- the
128
- {{<hover label="oo-ex-name" line="5">}}crossplane.io/external-name{{</hover>}}
129
- annotation with the value
127
+ the
128
+ {{<hover label="oo-ex-name" line="5">}}crossplane.io/external-name{{</hover>}}
129
+ annotation with the value
130
130
{{<hover label="oo-ex-name" line="5">}}my-external-database{{</hover>}}.
131
131
132
132
` ` ` yaml {label="oo-ex-name",copy-lines="none"}
@@ -140,10 +140,10 @@ spec:
140
140
` ` `
141
141
142
142
# ## Create a Kubernetes object name
143
- Create a {{<hover label="oo-name" line="4">}}name{{</hover>}} to use for the
144
- Kubernetes object.
143
+ Create a {{<hover label="oo-name" line="4">}}name{{</hover>}} to use for the
144
+ Kubernetes object.
145
145
146
- For example, name the Kubernetes object
146
+ For example, name the Kubernetes object
147
147
{{<hover label="oo-name" line="4">}}my-imported-database{{</hover>}}.
148
148
149
149
` ` ` yaml {label="oo-name",copy-lines="none"}
@@ -159,11 +159,11 @@ spec:
159
159
160
160
# ## Identify a specific external resource
161
161
If more than one resource inside the Provider shares the same name, identify the
162
- specific resource with a unique
163
- {{<hover line="9" label="oo-region">}}spec.forProvider{{</hover>}} field.
162
+ specific resource with a unique
163
+ {{<hover line="9" label="oo-region">}}spec.forProvider{{</hover>}} field.
164
164
165
- For example, only import the GCP SQL database in the
166
- {{<hover line="10" label="oo-region">}}us-central1{{</hover>}} region.
165
+ For example, only import the GCP SQL database in the
166
+ {{<hover line="10" label="oo-region">}}us-central1{{</hover>}} region.
167
167
168
168
` ` ` yaml {label="oo-region"}
169
169
apiVersion: sql.gcp.upbound.io/v1beta1
@@ -181,7 +181,7 @@ spec:
181
181
# ## Apply the managed resource
182
182
183
183
Apply the new managed resource. Crossplane syncs the status of the external
184
- resource in the cloud with the newly created managed resource.
184
+ resource in the cloud with the newly created managed resource.
185
185
186
186
# ## View the discovered resource
187
187
Crossplane discovers the managed resource and populates the
@@ -229,13 +229,13 @@ status:
229
229
` ` `
230
230
<!-- vale off -->
231
231
# # Control imported ObserveOnly resources
232
- <!-- vale on -->
232
+ <!-- vale on -->
233
233
234
- Crossplane can take active control of observe only imported resources by
234
+ Crossplane can take active control of observe only imported resources by
235
235
changing the `managementPolicies` after import.
236
236
237
237
Change the {{<hover label="fc" line="8">}}managementPolicies{{</hover>}} field
238
- of the managed resource to
238
+ of the managed resource to
239
239
{{<hover label="fc" line="8">}}["*"]{{</hover>}}.
240
240
241
241
Copy any required parameter values from
@@ -281,5 +281,5 @@ status:
281
281
type: Synced
282
282
` ` `
283
283
284
- Crossplane now fully manages the imported resource. Crossplane applies any
285
- changes to the managed resource in the Provider's external resource.
284
+ Crossplane now fully manages the imported resource. Crossplane applies any
285
+ changes to the managed resource in the Provider's external resource.
0 commit comments