Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.16 Docs #773

Merged
merged 3 commits into from
May 16, 2024
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
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ security:
# Global parameters accessible by any Page
params:
# The current "latest" version. Used in the version dropdown
latest: "1.15"
docs: true
latest: "1.16"
docs: true
anchors:
# Generate heading anchors for any heading between min and max
min: 2
Expand Down
84 changes: 42 additions & 42 deletions content/master/guides/import-existing-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ weight: 200

If you have resources that are already provisioned in a Provider,
you can import them as managed resources and let Crossplane manage them.
A managed resource's [`managementPolicies`]({{<ref "/v1.13/concepts/managed-resources#managementpolicies">}})
A managed resource's [`managementPolicies`]({{<ref "/v1.16/concepts/managed-resources#managementpolicies">}})
jbw976 marked this conversation as resolved.
Show resolved Hide resolved
field enables importing external resources into Crossplane.

Crossplane can import resources either [manually]({{<ref "#import-resources-manually">}})
Expand All @@ -14,17 +14,17 @@ or [automatically]({{<ref "#import-resources-automatically">}}).
## Import resources manually

Crossplane can discover and import existing Provider resources by matching the
`crossplane.io/external-name` annotation in a managed resource.
`crossplane.io/external-name` annotation in a managed resource.

To import an existing external resource in a Provider, create a new managed
resource with the `crossplane.io/external-name` annotation. Set the annotation
value to the name of the resource in the Provider.

For example, to import an existing GCP Network named
For example, to import an existing GCP Network named
{{<hover label="annotation" line="5">}}my-existing-network{{</hover>}},
create a new managed resource and use the
create a new managed resource and use the
{{<hover label="annotation" line="5">}}my-existing-network{{</hover>}} in the
annotation.
annotation.

```yaml {label="annotation",copy-lines="none"}
apiVersion: compute.gcp.crossplane.io/v1beta1
Expand All @@ -34,14 +34,14 @@ metadata:
crossplane.io/external-name: my-existing-network
```

The {{<hover label="name" line="5">}}metadata.name{{</hover>}}
field can be anything you want. For example,
{{<hover label="name" line="5">}}imported-network{{</hover>}}.
The {{<hover label="name" line="5">}}metadata.name{{</hover>}}
field can be anything you want. For example,
{{<hover label="name" line="5">}}imported-network{{</hover>}}.

{{< hint "note" >}}
This name is the
This name is the
name of the Kubernetes object. It's not related to the resource name inside the
Provider.
Provider.
{{< /hint >}}

```yaml {label="name",copy-lines="none"}
Expand All @@ -53,15 +53,15 @@ metadata:
crossplane.io/external-name: my-existing-network
```

Leave the
{{<hover label="fp" line="8">}}spec.forProvider{{</hover>}} field empty.
Crossplane imports the settings and automatically applies them to the managed
resource.
Leave the
{{<hover label="fp" line="8">}}spec.forProvider{{</hover>}} field empty.
Crossplane imports the settings and automatically applies them to the managed
resource.

{{< hint "important" >}}
If the managed resource has _required_ fields in the
If the managed resource has _required_ fields in the
{{<hover label="fp" line="8">}}spec.forProvider{{</hover>}} you must add it to
the `forProvider` field.
the `forProvider` field.

The values of those fields must match what's inside the Provider or Crossplane
overwrites the existing values.
Expand All @@ -82,17 +82,17 @@ spec:
Crossplane now controls and manages this imported resource. Any changes to the
managed resource `spec` changes the external resource.

## Import resources automatically
## Import resources automatically

Automatically import external resources with an `Observe` [management policy]({{<ref "/v1.13/concepts/managed-resources#managementpolicies">}}).
Automatically import external resources with an `Observe` [management policy]({{<ref "/v1.16/concepts/managed-resources#managementpolicies">}}).

Crossplane imports observe only resources but never changes or deletes the
resources.

{{<hint "important" >}}
The managed resource `managementPolicies` option is a beta feature.
The managed resource `managementPolicies` option is a beta feature.

The Provider determines support for management policies.
The Provider determines support for management policies.
Refer to the Provider's documentation to see if the Provider supports
management policies.
{{< /hint >}}
Expand All @@ -101,15 +101,15 @@ management policies.
### Apply the Observe management policy
<!-- vale on -->

Create a new managed resource matching the
{{<hover label="oo-policy" line="1">}}apiVersion{{</hover>}} and
Create a new managed resource matching the
{{<hover label="oo-policy" line="1">}}apiVersion{{</hover>}} and
{{<hover label="oo-policy" line="2">}}kind{{</hover>}} of the resource
to import and add
{{<hover label="oo-policy" line="4">}}managementPolicies: ["Observe"]{{</hover>}} to the
{{<hover label="oo-policy" line="4">}}managementPolicies: ["Observe"]{{</hover>}} to the
{{<hover label="oo-policy" line="3">}}spec{{</hover>}}

For example, to import a GCP SQL DatabaseInstance, create a new resource with
the {{<hover label="oo-policy" line="4">}}managementPolicies: ["Observe"]{{</hover>}}
the {{<hover label="oo-policy" line="4">}}managementPolicies: ["Observe"]{{</hover>}}
set.
```yaml {label="oo-policy",copy-lines="none"}
apiVersion: sql.gcp.upbound.io/v1beta1
Expand All @@ -119,14 +119,14 @@ spec:
```

### Add the external-name annotation
Add the {{<hover label="oo-ex-name" line="5">}}crossplane.io/external-name{{</hover>}}
Add the {{<hover label="oo-ex-name" line="5">}}crossplane.io/external-name{{</hover>}}
annotation for the resource. This name must match the name inside the Provider.

For example, for a GCP database named
For example, for a GCP database named
{{<hover label="oo-ex-name" line="5">}}my-external-database{{</hover>}}, apply
the
{{<hover label="oo-ex-name" line="5">}}crossplane.io/external-name{{</hover>}}
annotation with the value
the
{{<hover label="oo-ex-name" line="5">}}crossplane.io/external-name{{</hover>}}
annotation with the value
{{<hover label="oo-ex-name" line="5">}}my-external-database{{</hover>}}.

```yaml {label="oo-ex-name",copy-lines="none"}
Expand All @@ -140,10 +140,10 @@ spec:
```

### Create a Kubernetes object name
Create a {{<hover label="oo-name" line="4">}}name{{</hover>}} to use for the
Kubernetes object.
Create a {{<hover label="oo-name" line="4">}}name{{</hover>}} to use for the
Kubernetes object.

For example, name the Kubernetes object
For example, name the Kubernetes object
{{<hover label="oo-name" line="4">}}my-imported-database{{</hover>}}.

```yaml {label="oo-name",copy-lines="none"}
Expand All @@ -159,11 +159,11 @@ spec:

### Identify a specific external resource
If more than one resource inside the Provider shares the same name, identify the
specific resource with a unique
{{<hover line="9" label="oo-region">}}spec.forProvider{{</hover>}} field.
specific resource with a unique
{{<hover line="9" label="oo-region">}}spec.forProvider{{</hover>}} field.

For example, only import the GCP SQL database in the
{{<hover line="10" label="oo-region">}}us-central1{{</hover>}} region.
For example, only import the GCP SQL database in the
{{<hover line="10" label="oo-region">}}us-central1{{</hover>}} region.

```yaml {label="oo-region"}
apiVersion: sql.gcp.upbound.io/v1beta1
Expand All @@ -181,7 +181,7 @@ spec:
### Apply the managed resource

Apply the new managed resource. Crossplane syncs the status of the external
resource in the cloud with the newly created managed resource.
resource in the cloud with the newly created managed resource.

### View the discovered resource
Crossplane discovers the managed resource and populates the
Expand Down Expand Up @@ -229,13 +229,13 @@ status:
```
<!-- vale off -->
## Control imported ObserveOnly resources
<!-- vale on -->
<!-- vale on -->

Crossplane can take active control of observe only imported resources by
Crossplane can take active control of observe only imported resources by
changing the `managementPolicies` after import.

Change the {{<hover label="fc" line="8">}}managementPolicies{{</hover>}} field
of the managed resource to
of the managed resource to
{{<hover label="fc" line="8">}}["*"]{{</hover>}}.

Copy any required parameter values from
Expand Down Expand Up @@ -281,5 +281,5 @@ status:
type: Synced
```

Crossplane now fully manages the imported resource. Crossplane applies any
changes to the managed resource in the Provider's external resource.
Crossplane now fully manages the imported resource. Crossplane applies any
changes to the managed resource in the Provider's external resource.
Loading
Loading