docs snapshot for crossplane version `v0.13`

This commit is contained in:
Crossplane 2020-10-19 14:48:29 +00:00
parent 2a05332ceb
commit b218a1986f
12 changed files with 126 additions and 261 deletions

View File

@ -28,7 +28,7 @@ Run `setup.sh` to read `aws` credentials and region, and create an `aws
provider` instance in Crossplane:
```bash
curl -O https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/configure/aws/provider.yaml
curl -O https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/configure/aws/providerconfig.yaml
curl -O https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/configure/aws/setup.sh
./setup.sh [--profile aws_profile]
```

View File

@ -67,6 +67,11 @@ We will now install a `Configuration` that:
<div class="tab-content">
<div class="tab-pane fade in active" id="aws-tab-1" markdown="1">
> Note that this configuration will create an RDS instance using your default
> VPC, which may or may not allow connections from the internet depending on how
> it is configured. Select the AWS (New VPC) configuration if you wish to create
> an RDS instance that will allow traffic from the internet.
```console
kubectl crossplane install configuration crossplane/getting-started-with-aws:master
```
@ -74,6 +79,11 @@ kubectl crossplane install configuration crossplane/getting-started-with-aws:mas
</div>
<div class="tab-pane fade" id="aws-new-tab-1" markdown="1">
> Note that this configuration for AWS also includes several networking managed
> resources that are required to provision a publicly available PostgreSQL
> instance. Composition enables scenarios such as this, as well as far more
> complex ones. See the [composition] documentation for more information.
```console
kubectl crossplane install configuration crossplane/getting-started-with-aws-with-vpc:master
```
@ -267,9 +277,9 @@ Try the following command to watch your provisioned resources become ready:
kubectl get crossplane -l crossplane.io/claim-name=my-db
```
You should also see a `Secret` in the `default` namespace named `db-conn` that
contains keys that we defined in XRD. If they are filled by the composition, then
they should appear:
Once your `PostgreSQLInstance` is ready, you should see a `Secret` in the `default`
namespace named `db-conn` that contains keys that we defined in XRD. If they were
filled by the composition, then they should appear:
```console
$ kubectl describe secrets db-conn

View File

@ -166,7 +166,8 @@ kubectl create secret generic aws-creds -n crossplane-system --from-file=key=./c
### Configure the Provider
Create the following `provider.yaml`:
We will create the following `ProviderConfig` object to configure credentials for AWS
Provider:
```yaml
apiVersion: aws.crossplane.io/v1beta1
@ -181,11 +182,8 @@ spec:
name: aws-creds
key: key
```
Then apply it:
```console
kubectl apply -f provider.yaml
kubectl apply -f https://raw.githubusercontent.com/crossplane/crossplane/master/docs/snippets/configure/aws/providerconfig.yaml
```
</div>
@ -229,28 +227,24 @@ kubectl create secret generic gcp-creds -n crossplane-system --from-file=key=./c
### Configure the Provider
Create the following `provider.yaml`:
We will create the following `ProviderConfig` object to configure credentials for GCP
Provider:
```yaml
apiVersion: gcp.crossplane.io/v1beta1
```console
# replace this with your own gcp project id
PROJECT_ID=my-project
echo "apiVersion: gcp.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
# replace this with your own gcp project id
projectID: my-project
projectID: ${PROJECT_ID}
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: gcp-creds
key: key
```
Then apply it:
```console
kubectl apply -f provider.yaml
key: key" | kubectl apply -f -
```
</div>
@ -293,7 +287,8 @@ kubectl create secret generic azure-creds -n crossplane-system --from-file=key=.
### Configure the Provider
Create the following `provider.yaml`:
We will create the following `ProviderConfig` object to configure credentials for
Azure Provider:
```yaml
apiVersion: azure.crossplane.io/v1beta1
@ -308,11 +303,8 @@ spec:
name: azure-creds
key: key
```
Then apply it:
```console
kubectl apply -f provider.yaml
kubectl apply -f https://raw.githubusercontent.com/crossplane/crossplane/master/docs/snippets/configure/azure/providerconfig.yaml
```
</div>
@ -327,12 +319,14 @@ kubectl crossplane install provider crossplane/provider-alibaba:v0.3.0
### Create a Provider Secret
```console
# Replace <your-key> and <your-secret> with your actual key id and key secret.
kubectl create secret generic alibaba-creds --from-literal=accessKeyId=<your-key> --from-literal=accessKeySecret=<your-secret> -n crossplane-system
```
### Configure the Provider
Create the following `provider.yaml`:
We will create the following `ProviderConfig` object to configure credentials for
Alibaba Provider:
```yaml
apiVersion: alibaba.crossplane.io/v1alpha1
@ -346,13 +340,12 @@ spec:
secretRef:
namespace: crossplane-system
name: alibaba-creds
key: credentials
# "key" field does not have any effect right now but it has to be given.
# See https://github.com/crossplane/crossplane-runtime/issues/215
key: credentials
```
Then apply it:
```console
kubectl apply -f provider.yaml
kubectl apply -f https://raw.githubusercontent.com/crossplane/crossplane/master/docs/snippets/configure/alibaba/providerconfig.yaml
```
</div>

View File

@ -58,17 +58,6 @@ into a package.
First we'll create a `CompositeResourceDefinition` (XRD) to define the schema of
our `CompositePostgreSQLInstance` and its `PostgreSQLInstance` resource claim.
<ul class="nav nav-tabs">
<li class="active"><a href="#aws-tab-1" data-toggle="tab">AWS (Default VPC)</a></li>
<li><a href="#aws-new-tab-1" data-toggle="tab">AWS (New VPC)</a></li>
<li><a href="#gcp-tab-1" data-toggle="tab">GCP</a></li>
<li><a href="#azure-tab-1" data-toggle="tab">Azure</a></li>
<li><a href="#alibaba-tab-1" data-toggle="tab">Alibaba</a></li>
</ul>
<br>
<div class="tab-content">
<div class="tab-pane fade in active" id="aws-tab-1" markdown="1">
```yaml
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: CompositeResourceDefinition
@ -108,192 +97,9 @@ spec:
```
```console
curl -OL https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/package/aws/definition.yaml
curl -OL https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/package/definition.yaml
```
</div>
<div class="tab-pane fade" id="aws-new-tab-1" markdown="1">
```yaml
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: CompositeResourceDefinition
metadata:
name: compositepostgresqlinstances.database.example.org
spec:
claimNames:
kind: PostgreSQLInstance
plural: postgresqlinstances
connectionSecretKeys:
- username
- password
- endpoint
- port
crdSpecTemplate:
group: database.example.org
version: v1alpha1
names:
kind: CompositePostgreSQLInstance
plural: compositepostgresqlinstances
validation:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
parameters:
type: object
properties:
storageGB:
type: integer
required:
- storageGB
required:
- parameters
```
```console
curl -OL https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/package/aws-with-vpc/definition.yaml
```
</div>
<div class="tab-pane fade" id="gcp-tab-1" markdown="1">
```yaml
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: CompositeResourceDefinition
metadata:
name: compositepostgresqlinstances.database.example.org
spec:
claimNames:
kind: PostgreSQLInstance
plural: postgresqlinstances
connectionSecretKeys:
- username
- password
- endpoint
- port
crdSpecTemplate:
group: database.example.org
version: v1alpha1
names:
kind: CompositePostgreSQLInstance
plural: compositepostgresqlinstances
validation:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
parameters:
type: object
properties:
storageGB:
type: integer
required:
- storageGB
required:
- parameters
```
```console
curl -OL https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/package/gcp/definition.yaml
```
</div>
<div class="tab-pane fade" id="azure-tab-1" markdown="1">
```yaml
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: CompositeResourceDefinition
metadata:
name: compositepostgresqlinstances.database.example.org
spec:
claimNames:
kind: PostgreSQLInstance
plural: postgresqlinstances
connectionSecretKeys:
- username
- password
- endpoint
- port
crdSpecTemplate:
group: database.example.org
version: v1alpha1
names:
kind: CompositePostgreSQLInstance
plural: compositepostgresqlinstances
validation:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
parameters:
type: object
properties:
storageGB:
type: integer
required:
- storageGB
required:
- parameters
```
```console
curl -OL https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/package/azure/definition.yaml
```
</div>
<div class="tab-pane fade" id="alibaba-tab-1" markdown="1">
```yaml
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: CompositeResourceDefinition
metadata:
name: compositepostgresqlinstances.database.example.org
spec:
claimNames:
kind: PostgreSQLInstance
plural: postgresqlinstances
connectionSecretKeys:
- username
- password
- endpoint
- port
crdSpecTemplate:
group: database.example.org
version: v1alpha1
names:
kind: CompositePostgreSQLInstance
plural: compositepostgresqlinstances
validation:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
parameters:
type: object
properties:
storageGB:
type: integer
required:
- storageGB
required:
- parameters
```
```console
curl -OL https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/docs/snippets/package/alibaba/definition.yaml
```
</div>
</div>
> You might notice that the XRD we created specifies both "names" and "claim
> names". This is because the composite resource it defines offers a composite
> resource claim (XRC).

View File

@ -63,7 +63,7 @@ When provisioning is complete, you should see `READY: True` in the output. You
can take a look at its connection secret that is referenced under `spec.writeConnectionSecretToRef`:
```console
kubectl describe secret aws-rdspostgresql-conn -n crossplane-system -o yaml
kubectl describe secret aws-rdspostgresql-conn -n crossplane-system
```
You can then delete the `RDSInstance`:
@ -111,7 +111,7 @@ When provisioning is complete, you should see `READY: True` in the output. You
can take a look at its connection secret that is referenced under `spec.writeConnectionSecretToRef`:
```console
kubectl describe secret cloudsqlpostgresql-conn -n crossplane-system -o yaml
kubectl describe secret cloudsqlpostgresql-conn -n crossplane-system
```
You can then delete the `CloudSQLInstance`:

View File

@ -31,7 +31,7 @@ purposes of Crossplane packages are as follows:
As stated above, Crossplane packages are just opinionated OCI images, meaning
they can be constructed using any tool that outputs files that comply the the
OCI specification. However, constructing packages using the Crossplane CLI is a
more streamlined experience, as it will performing build-time checks on your
more streamlined experience, as it will perform build-time checks on your
packages to ensure that they are compliant with the Crossplane [package format].
Providers and Configurations vary in the types of resources they may contain in
@ -53,9 +53,9 @@ spec:
image: crossplane/provider-gcp-controller:master
```
> Note: The `meta.pkg.crossplane.io` group does contain actual CRDs that get
> installed into the cluster. They are strictly used as metadata in a Crossplane
> package.
> Note: The `meta.pkg.crossplane.io` group does contain custom resources that
> may be installed into the cluster. They are strictly used as metadata in a
> Crossplane package.
The `spec.controller.image` fields specifies that the `Provider` desires for a
`Deployment` to be created with the provided image. It is important to note that
@ -126,7 +126,7 @@ kubectl crossplane push provider crossplane/provider-gcp:master
To push a Configuration package, execute the following command:
```
kubectl crossplane push provider crossplane/my-org-infra:master
kubectl crossplane push configuration crossplane/my-org-infra:master
```
> Note: Both of the above commands assume a single `.xpkg` file exists in the
@ -178,7 +178,7 @@ spec:
> Note: These types differ from the `Provider` and `Configuration` types we saw
> earlier. They exist in the `pkg.crossplane.io` group rather than the
> `meta.pkg.crossplane.io` group and are actual CRD types installed in the
> `meta.pkg.crossplane.io` group and are actual custom resources created in the
> cluster.
The `spec.revisionActivationPolicy` and `spec.revisionHistoryLimit` fields are

View File

@ -0,0 +1,13 @@
---
apiVersion: alibaba.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: default
spec:
region: cn-beijing
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: alibaba-creds
key: credentials

View File

@ -1,21 +0,0 @@
---
apiVersion: v1
data:
credentials: ((AWS_CREDS_BASE64))
kind: Secret
metadata:
name: aws-account-creds
namespace: crossplane-system
type: Opaque
---
apiVersion: aws.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: aws-account-creds
key: credentials

View File

@ -0,0 +1,12 @@
---
apiVersion: aws.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: aws-creds
key: key

View File

@ -40,10 +40,14 @@ AWS_CREDS_BASE64=$(echo -e "[default]\naws_access_key_id = $(aws configure get a
if test -z "$AWS_CREDS_BASE64"; then
echo "error reading credentials from aws config"
exit -1
exit 1
fi
# build the secret and provider objects, and then apply it
cat provider.yaml | sed \
-e "s|((AWS_CREDS_BASE64))|"$AWS_CREDS_BASE64"|g" \
| kubectl apply -f -
echo "apiVersion: v1
data:
key: $AWS_CREDS_BASE64
kind: Secret
metadata:
name: aws-creds
namespace: crossplane-system
type: Opaque" | kubectl apply -f -

View File

@ -0,0 +1,12 @@
---
apiVersion: azure.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: azure-creds
key: key

View File

@ -0,0 +1,36 @@
---
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: CompositeResourceDefinition
metadata:
name: compositepostgresqlinstances.database.example.org
spec:
claimNames:
kind: PostgreSQLInstance
plural: postgresqlinstances
connectionSecretKeys:
- username
- password
- endpoint
- port
crdSpecTemplate:
group: database.example.org
version: v1alpha1
names:
kind: CompositePostgreSQLInstance
plural: compositepostgresqlinstances
validation:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
parameters:
type: object
properties:
storageGB:
type: integer
required:
- storageGB
required:
- parameters