mirror of https://github.com/crossplane/docs.git
docs snapshot for crossplane version `master`
This commit is contained in:
parent
c53733a476
commit
1f02431482
|
@ -97,13 +97,13 @@ GCP provides MySQL databases using [CloudSQL] instances. Crossplane uses a
|
|||
resource and claim pattern to provision and manage cloud resources like CloudSQL
|
||||
instances - if you've ever used [persistent volumes in Kubernetes] you've seen
|
||||
this pattern before. The simplest way to start using a new MySQL instance on GCP
|
||||
is to provision a `CloudsqlInstance`, then claim it via a `MySQLInstance`. We
|
||||
is to provision a `CloudSQLInstance`, then claim it via a `MySQLInstance`. We
|
||||
call this process _static provisioning_.
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: database.gcp.crossplane.io/v1beta1
|
||||
kind: CloudsqlInstance
|
||||
kind: CloudSQLInstance
|
||||
metadata:
|
||||
name: example-cloudsql-instance
|
||||
spec:
|
||||
|
@ -130,7 +130,7 @@ apply it:
|
|||
kubectl apply -f cloudsql.yaml
|
||||
```
|
||||
|
||||
Crossplane is now creating the `CloudsqlInstance`! Before we can use it, we need
|
||||
Crossplane is now creating the `CloudSQLInstance`! Before we can use it, we need
|
||||
to claim it.
|
||||
|
||||
```yaml
|
||||
|
@ -141,7 +141,7 @@ metadata:
|
|||
spec:
|
||||
resourceRef:
|
||||
apiVersion: database.gcp.crossplane.io/v1beta1
|
||||
kind: CloudsqlInstance
|
||||
kind: CloudSQLInstance
|
||||
name: example-cloudsql-instance
|
||||
writeConnectionSecretToRef:
|
||||
name: example-mysql-connection-details
|
||||
|
@ -153,7 +153,7 @@ Save the above as `mysql.yaml`, and once again apply it:
|
|||
kubectl --namespace default apply -f mysql.yaml
|
||||
```
|
||||
|
||||
In Crossplane cloud provider specific resources like the `CloudsqlInstance` we
|
||||
In Crossplane cloud provider specific resources like the `CloudSQLInstance` we
|
||||
created above are called _managed resources_. They're considered infrastructure,
|
||||
like a Kubernetes `Node` or `PersistentVolume`. Managed resources exist at the
|
||||
cluster scope (they're not namespaced) and let you specify nitty-gritty provider
|
||||
|
@ -173,7 +173,7 @@ use!
|
|||
```bash
|
||||
$ kubectl --namespace default get mysqlinstance example-mysql-claim
|
||||
NAME STATUS CLASS-KIND CLASS-NAME RESOURCE-KIND RESOURCE-NAME AGE
|
||||
example-mysql-claim Bound CloudsqlInstance example-cloudsql-instance 4m
|
||||
example-mysql-claim Bound CloudSQLInstance example-cloudsql-instance 4m
|
||||
```
|
||||
|
||||
You'll find all the details you need to connect to your new MySQL instance saved
|
||||
|
@ -202,7 +202,7 @@ serverCACertificateCert: 1272 bytes
|
|||
```
|
||||
|
||||
That's all there is to static provisioning with Crossplane! We've created a
|
||||
`CloudsqlInstance` as cluster scoped infrastructure, then claimed it as a
|
||||
`CloudSQLInstance` as cluster scoped infrastructure, then claimed it as a
|
||||
`MySQLInstance`. You can use `kubectl describe` to view the detailed
|
||||
configuration and status of your `CloudSqlInstance`.
|
||||
|
||||
|
@ -211,7 +211,7 @@ $ kubectl describe example-cloudsql-instance
|
|||
Name: example-cloudsql-instance
|
||||
Annotations: crossplane.io/external-name: example-cloudsql-instance
|
||||
API Version: database.gcp.crossplane.io/v1beta1
|
||||
Kind: CloudsqlInstance
|
||||
Kind: CloudSQLInstance
|
||||
Spec:
|
||||
For Provider:
|
||||
Database Version: MYSQL_5_6
|
||||
|
@ -281,7 +281,7 @@ the same settings as the `CloudSqlInstance` we provisioned earlier in the guide:
|
|||
|
||||
```yaml
|
||||
apiVersion: database.gcp.crossplane.io/v1beta1
|
||||
kind: CloudsqlInstanceClass
|
||||
kind: CloudSQLInstanceClass
|
||||
metadata:
|
||||
name: example-cloudsql-class
|
||||
annotations:
|
||||
|
@ -335,11 +335,11 @@ mysqlinstance.database.crossplane.io/example-mysql-dynamic-claim created
|
|||
|
||||
$ kubectl get mysqlinstance example-mysql-dynamic-claim
|
||||
NAME STATUS CLASS-KIND CLASS-NAME RESOURCE-KIND RESOURCE-NAME AGE
|
||||
example-mysql-dynamic-claim CloudsqlInstanceClass example-cloudsql-class CloudsqlInstance default-example-mysql-dynamic-claim-bwpzd 47s
|
||||
example-mysql-dynamic-claim CloudSQLInstanceClass example-cloudsql-class CloudSQLInstance default-example-mysql-dynamic-claim-bwpzd 47s
|
||||
```
|
||||
|
||||
You just dynamically provisioned a `CloudsqlInstance`! You can find the name of
|
||||
your new `CloudsqlInstance` under the `RESOURCE-NAME` column when you run
|
||||
You just dynamically provisioned a `CloudSQLInstance`! You can find the name of
|
||||
your new `CloudSQLInstance` under the `RESOURCE-NAME` column when you run
|
||||
`kubectl describe mysqlinstance`. Reuse the resource class as many times as you
|
||||
like; simply submit more `MySQLInstance` resource claims to create more CloudSQL
|
||||
instances.
|
||||
|
|
|
@ -285,7 +285,7 @@ cloudsql--mysql-standard.yaml
|
|||
```yaml
|
||||
---
|
||||
apiVersion: database.gcp.crossplane.io/v1beta1
|
||||
kind: CloudsqlInstanceClass
|
||||
kind: CloudSQLInstanceClass
|
||||
metadata:
|
||||
name: cloudsql-mysql-standard
|
||||
namespace: gcp-infra-dev
|
||||
|
|
|
@ -674,7 +674,7 @@ Spec:
|
|||
Engine Version: 5.6
|
||||
Resource Ref:
|
||||
API Version: database.aws.crossplane.io/v1alpha2
|
||||
Kind: MysqlServer
|
||||
Kind: MySQLServer
|
||||
Name: mysqlinstance-6a7fe064-d888-11e9-ab90-42b6bb22213a
|
||||
Namespace: aws-infra-dev
|
||||
Write Connection Secret To Ref:
|
||||
|
|
|
@ -421,7 +421,7 @@ Spec:
|
|||
Engine Version: 5.6
|
||||
Resource Ref:
|
||||
API Version: database.azure.crossplane.io/v1alpha2
|
||||
Kind: MysqlServer
|
||||
Kind: MySQLServer
|
||||
Name: mysqlinstance-6a7fe064-d888-11e9-ab90-42b6bb22213a
|
||||
Namespace: azure-infra-dev
|
||||
Write Connection Secret To Ref:
|
||||
|
@ -471,14 +471,14 @@ Rule][azure-vnet-rule].
|
|||
export MYSQL_NAME=$(kubectl get -o json mysqlinstance mysql-claim -n app-project1-dev | jq -j '.spec.resourceRef.name')
|
||||
```
|
||||
|
||||
* Define a `MysqlServerVirtualNetworkRule` in `wordpress-vnet-rule.yaml` and
|
||||
* Define a `MySQLServerVirtualNetworkRule` in `wordpress-vnet-rule.yaml` and
|
||||
create it:
|
||||
|
||||
```yaml
|
||||
cat > wordpress-vnet-rule.yaml <<EOF
|
||||
---
|
||||
apiVersion: database.azure.crossplane.io/v1alpha2
|
||||
kind: MysqlServerVirtualNetworkRule
|
||||
kind: MySQLServerVirtualNetworkRule
|
||||
metadata:
|
||||
name: wordpress-vnet-rule
|
||||
namespace: app-project1-dev
|
||||
|
@ -649,7 +649,7 @@ In this guide we:
|
|||
`mysql-standard` in the `app-project1-dev` namespace
|
||||
* Created a `MySQLInstance` claim in the `app-project1-dev1` namespace that
|
||||
referenced `mysql-standard`
|
||||
* Created a `MysqlServerVirtualNetworkRule` to establish secure connectivity
|
||||
* Created a `MySQLServerVirtualNetworkRule` to establish secure connectivity
|
||||
between our AKS Cluster and MySQL database
|
||||
* Created a `Deployment` and `Service` to run Wordpress on our AKS Cluster and
|
||||
assign an external IP address to it
|
||||
|
|
|
@ -174,13 +174,13 @@ Cloud-specific resource classes are used to define a reusable configuration for
|
|||
a specific managed service. Wordpress requires a MySQL database, which can be
|
||||
satisfied by a [Google Cloud SQL Instance](https://cloud.google.com/sql/docs/mysql/).
|
||||
|
||||
* Define a GCP CloudSQL class `CloudsqlInstanceClass`:
|
||||
* Define a GCP CloudSQL class `CloudSQLInstanceClass`:
|
||||
|
||||
```bash
|
||||
cat > gcp-mysql-standard.yaml <<EOF
|
||||
---
|
||||
apiVersion: database.gcp.crossplane.io/v1beta1
|
||||
kind: CloudsqlInstanceClass
|
||||
kind: CloudSQLInstanceClass
|
||||
metadata:
|
||||
name: standard-cloudsql
|
||||
specTemplate:
|
||||
|
@ -216,7 +216,7 @@ NAME PROVIDER-REF RECLAIM-POLICY AGE
|
|||
standard-cloudsql gcp-provider Delete 11s
|
||||
```
|
||||
|
||||
You are free to create more GCP `CloudsqlInstanceClass` instances to define more
|
||||
You are free to create more GCP `CloudSQLInstanceClass` instances to define more
|
||||
potential configurations. For instance, you may create `large-gcp-mysql` with
|
||||
field `storageGB: 100`.
|
||||
|
||||
|
@ -235,7 +235,7 @@ kubectl create namespace app-project1-dev
|
|||
|
||||
Portable resource classes are used to define a class of service in a single
|
||||
namespace for an abstract service type. We want to define our GCP
|
||||
`CloudsqlInstanceClass` as the standard MySQL class of service in the namespace
|
||||
`CloudSQLInstanceClass` as the standard MySQL class of service in the namespace
|
||||
that our Wordpress resources will live in.
|
||||
|
||||
* Define a `MySQLInstanceClass` in `mysql-standard.yaml` for namespace `app-project1-dev`:
|
||||
|
@ -248,7 +248,7 @@ that our Wordpress resources will live in.
|
|||
metadata:
|
||||
name: mysql-standard
|
||||
classRef:
|
||||
kind: CloudsqlInstanceClass
|
||||
kind: CloudSQLInstanceClass
|
||||
apiVersion: database.gcp.crossplane.io/v1beta1
|
||||
name: standard-cloudsql
|
||||
namespace: $INFRA_NAMESPACE
|
||||
|
@ -282,7 +282,7 @@ in the `app-project1-dev` namespace.
|
|||
> Portable classes are the resource classes that are not cloud specific and
|
||||
their purpose is to refer to cloud specific resource classes that will be
|
||||
used for provisioning. For example, MySQLInstanceClass is a portable class
|
||||
that can refer to CloudsqlInstanceClass (GCP) or RDSInstanceClass (AWS).
|
||||
that can refer to CloudSQLInstanceClass (GCP) or RDSInstanceClass (AWS).
|
||||
|
||||
You may specify *one* instance of a portable class kind as *default* in each
|
||||
namespace. This means that the portable resource class instance will be applied
|
||||
|
@ -374,7 +374,7 @@ Spec:
|
|||
Engine Version: 5.6
|
||||
Resource Ref:
|
||||
API Version: database.gcp.crossplane.io/v1beta1
|
||||
Kind: CloudsqlInstance
|
||||
Kind: CloudSQLInstance
|
||||
Name: mysqlinstance-6a7fe064-d888-11e9-ab90-42b6bb22213a
|
||||
Namespace: gcp-infra-dev
|
||||
Write Connection Secret To Ref:
|
||||
|
|
|
@ -425,7 +425,7 @@ exists, and will create the rule if so.
|
|||
```bash
|
||||
cat > vnet-rule.yaml <<EOF
|
||||
apiVersion: database.azure.crossplane.io/v1alpha2
|
||||
kind: MysqlServerVirtualNetworkRule
|
||||
kind: MySQLServerVirtualNetworkRule
|
||||
metadata:
|
||||
name: sample-vnet-rule
|
||||
namespace: azure-infra-dev
|
||||
|
@ -473,7 +473,7 @@ To recap what we've set up now in our environment:
|
|||
|
||||
- A Crossplane Provider resource for Azure
|
||||
- A Network Configuration to have secure connectivity between resources
|
||||
- An CloudsqlInstanceClass and an GKEClusterClass with the right configuration
|
||||
- An CloudSQLInstanceClass and an GKEClusterClass with the right configuration
|
||||
to use the mentioned networking setup.
|
||||
- A script that will create our Virtual Network Rule when our MySQL database
|
||||
name comes available.
|
||||
|
|
|
@ -382,20 +382,20 @@ This will save the sample resource classes YAML locally in
|
|||
`resource-classes.yaml`. As mentioned above, these resource classes serve as
|
||||
templates and could be configured depending on the specific needs that are
|
||||
needed from the underlying resources. For instance, in the sample resources the
|
||||
`CloudsqlInstanceClass` has `storageGB: 10`, which will result in databases of
|
||||
`CloudSQLInstanceClass` has `storageGB: 10`, which will result in databases of
|
||||
size 10GB once a claim is submitted for this class. In addition, it's possible
|
||||
to have multiple classes defined for the same claim kind, but our sample has
|
||||
defined only one class for each resource type.
|
||||
|
||||
Below we inspect each of these resource classes in more details:
|
||||
|
||||
- **`CloudsqlInstanceClass`** Represents a resource that serves as a template to
|
||||
- **`CloudSQLInstanceClass`** Represents a resource that serves as a template to
|
||||
create a [Cloud SQL Database Instance][gcp-cloudsql].
|
||||
|
||||
```yaml
|
||||
---
|
||||
apiVersion: database.gcp.crossplane.io/v1beta1
|
||||
kind: CloudsqlInstanceClass
|
||||
kind: CloudSQLInstanceClass
|
||||
metadata:
|
||||
name: standard-mysql
|
||||
annotations:
|
||||
|
@ -455,7 +455,7 @@ To recap what we've set up now in our environment:
|
|||
|
||||
- A Crossplane Provider resource for GCP
|
||||
- A Network Configuration to have secure connectivity between resources
|
||||
- An CloudsqlInstanceClass and an GKEClusterClass with the right configuration to use
|
||||
- An CloudSQLInstanceClass and an GKEClusterClass with the right configuration to use
|
||||
the mentioned networking setup.
|
||||
|
||||
## Next Steps
|
||||
|
|
Loading…
Reference in New Issue