-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: sayedppqq <[email protected]>
- Loading branch information
1 parent
078122d
commit 9ac2c79
Showing
9 changed files
with
872 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Autoscaling | ||
menu: | ||
docs_{{ .version }}: | ||
identifier: fr-auto-scaling | ||
name: Autoscaling | ||
parent: fr-ferretdb-guides | ||
weight: 46 | ||
menu_name: docs_{{ .version }} | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: FerretDB Concepts | ||
menu: | ||
docs_{{ .version }}: | ||
identifier: fr-concepts-ferretdb | ||
name: Concepts | ||
parent: fr-quickstart-ferretdb | ||
weight: 15 | ||
menu_name: docs_{{ .version }} | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--- | ||
title: AppBinding CRD | ||
menu: | ||
docs_{{ .version }}: | ||
identifier: fr-appbinding-concepts | ||
name: AppBinding | ||
parent: fr-concepts-ferretdb | ||
weight: 20 | ||
menu_name: docs_{{ .version }} | ||
section_menu_id: guides | ||
--- | ||
|
||
> New to KubeDB? Please start [here](/docs/README.md). | ||
# AppBinding | ||
|
||
## What is AppBinding | ||
|
||
An `AppBinding` is a Kubernetes `CustomResourceDefinition`(CRD) which points to an application using either its URL (usually for a non-Kubernetes resident service instance) or a Kubernetes service object (if self-hosted in a Kubernetes cluster), some optional parameters and a credential secret. To learn more about AppBinding and the problems it solves, please read this blog post: [The case for AppBinding](https://appscode.com/blog/post/the-case-for-appbinding). | ||
|
||
If you deploy a database using [KubeDB](https://kubedb.com/docs/0.11.0/concepts/), `AppBinding` object will be created automatically for it. Otherwise, you have to create an `AppBinding` object manually pointing to your desired database. | ||
|
||
KubeDB uses [Stash](https://appscode.com/products/stash/) to perform backup/recovery of databases. Stash needs to know how to connect with a target database and the credentials necessary to access it. This is done via an `AppBinding`. | ||
|
||
## AppBinding CRD Specification | ||
|
||
Like any official Kubernetes resource, an `AppBinding` has `TypeMeta`, `ObjectMeta` and `Spec` sections. However, unlike other Kubernetes resources, it does not have a `Status` section. | ||
|
||
An `AppBinding` object created by `KubeDB` for PostgreSQL database is shown below, | ||
|
||
```yaml | ||
apiVersion: appcatalog.appscode.com/v1alpha1 | ||
kind: AppBinding | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: database | ||
app.kubernetes.io/instance: quick-postgres | ||
app.kubernetes.io/managed-by: kubedb.com | ||
app.kubernetes.io/name: postgreses.kubedb.com | ||
name: quick-postgres | ||
namespace: demo | ||
spec: | ||
appRef: | ||
apiGroup: kubedb.com | ||
kind: Postgres | ||
name: quick-postgres | ||
namespace: demo | ||
clientConfig: | ||
service: | ||
name: quick-postgres | ||
path: / | ||
port: 5432 | ||
query: sslmode=disable | ||
scheme: postgresql | ||
secret: | ||
name: quick-postgres-auth | ||
type: kubedb.com/postgres | ||
version: "13.13" | ||
``` | ||
Here, we are going to describe the sections of an `AppBinding` crd. | ||
|
||
### AppBinding `Spec` | ||
|
||
An `AppBinding` object has the following fields in the `spec` section: | ||
|
||
#### spec.type | ||
|
||
`spec.type` is an optional field that indicates the type of the app that this `AppBinding` is pointing to. Stash uses this field to resolve the values of `TARGET_APP_TYPE`, `TARGET_APP_GROUP` and `TARGET_APP_RESOURCE` variables of [BackupBlueprint](https://appscode.com/products/stash/latest/concepts/crds/backupblueprint/) object. | ||
|
||
This field follows the following format: `<app group>/<resource kind>`. The above AppBinding is pointing to a `postgres` resource under `kubedb.com` group. | ||
|
||
Here, the variables are parsed as follows: | ||
|
||
| Variable | Usage | | ||
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | ||
| `TARGET_APP_GROUP` | Represents the application group where the respective app belongs (i.e: `kubedb.com`). | | ||
| `TARGET_APP_RESOURCE` | Represents the resource under that application group that this appbinding represents (i.e: `postgres`). | | ||
| `TARGET_APP_TYPE` | Represents the complete type of the application. It's simply `TARGET_APP_GROUP/TARGET_APP_RESOURCE` (i.e: `kubedb.com/postgres`). | | ||
|
||
#### spec.secret | ||
|
||
`spec.secret` specifies the name of the secret which contains the credentials that are required to access the database. This secret must be in the same namespace as the `AppBinding`. | ||
|
||
This secret must contain the following keys: | ||
|
||
PostgreSQL : | ||
|
||
| Key | Usage | | ||
|------------|------------------------------------------------| | ||
| `username` | Username of the target database. | | ||
| `password` | Password for the user specified by `username`. | | ||
|
||
MySQL : | ||
|
||
| Key | Usage | | ||
| ---------- | ---------------------------------------------- | | ||
| `username` | Username of the target database. | | ||
| `password` | Password for the user specified by `username`. | | ||
|
||
MongoDB : | ||
|
||
| Key | Usage | | ||
| ---------- | ---------------------------------------------- | | ||
| `username` | Username of the target database. | | ||
| `password` | Password for the user specified by `username`. | | ||
|
||
Elasticsearch: | ||
|
||
| Key | Usage | | ||
| ---------------- | ----------------------- | | ||
| `ADMIN_USERNAME` | Admin username | | ||
| `ADMIN_PASSWORD` | Password for admin user | | ||
|
||
#### spec.clientConfig | ||
|
||
`spec.clientConfig` defines how to communicate with the target database. You can use either a URL or a Kubernetes service to connect with the database. You don't have to specify both of them. | ||
|
||
You can configure following fields in `spec.clientConfig` section: | ||
|
||
- **spec.clientConfig.url** | ||
|
||
`spec.clientConfig.url` gives the location of the database, in standard URL form (i.e. `[scheme://]host:port/[path]`). This is particularly useful when the target database is running outside the Kubernetes cluster. If your database is running inside the cluster, use `spec.clientConfig.service` section instead. | ||
|
||
|
||
> Note that, attempting to use a user or basic auth (e.g. `user:password@host:port`) is not allowed. Stash will insert them automatically from the respective secret. Fragments ("#...") and query parameters ("?...") are not allowed either. | ||
|
||
- **spec.clientConfig.service** | ||
|
||
If you are running the database inside the Kubernetes cluster, you can use Kubernetes service to connect with the database. You have to specify the following fields in `spec.clientConfig.service` section if you manually create an `AppBinding` object. | ||
|
||
- **name :** `name` indicates the name of the service that connects with the target database. | ||
- **scheme :** `scheme` specifies the scheme (i.e. http, https) to use to connect with the database. | ||
- **port :** `port` specifies the port where the target database is running. | ||
|
||
- **spec.clientConfig.insecureSkipTLSVerify** | ||
|
||
`spec.clientConfig.insecureSkipTLSVerify` is used to disable TLS certificate verification while connecting with the database. We strongly discourage to disable TLS verification during backup. You should provide the respective CA bundle through `spec.clientConfig.caBundle` field instead. | ||
|
||
- **spec.clientConfig.caBundle** | ||
|
||
`spec.clientConfig.caBundle` is a PEM encoded CA bundle which will be used to validate the serving certificate of the database. | ||
|
||
## Next Steps | ||
|
||
- Learn how to use KubeDB to manage various databases [here](/docs/guides/README.md). | ||
- Want to hack on KubeDB? Check our [contribution guidelines](/docs/CONTRIBUTING.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
title: FerretDBAutoscaler CRD | ||
menu: | ||
docs_{{ .version }}: | ||
identifier: fr-autoscaler-concepts | ||
name: FerretDBAutoscaler | ||
parent: fr-concepts-ferretdb | ||
weight: 26 | ||
menu_name: docs_{{ .version }} | ||
section_menu_id: guides | ||
--- | ||
|
||
> New to KubeDB? Please start [here](/docs/README.md). | ||
# FerretDBAutoscaler | ||
|
||
## What is FerretDBAutoscaler | ||
|
||
`FerretDBAutoscaler` is a Kubernetes `Custom Resource Definitions` (CRD). It provides a declarative configuration for autoscaling `FerretDB` compute resources of FerretDB components in a Kubernetes native way. | ||
|
||
## FerretDBAutoscaler CRD Specifications | ||
|
||
Like any official Kubernetes resource, a `FerretDBAutoscaler` has `TypeMeta`, `ObjectMeta`, `Spec` and `Status` sections. | ||
|
||
Here, some sample `FerretDBAutoscaler` CROs for autoscaling different components of ferretdb is given below: | ||
|
||
**Sample `FerretDBAutoscaler` for ferretdb:** | ||
|
||
```yaml | ||
apiVersion: autoscaling.kubedb.com/v1alpha1 | ||
kind: FerretDBAutoscaler | ||
metadata: | ||
name: ferretdb-auto-scale | ||
namespace: demo | ||
spec: | ||
databaseRef: | ||
name: ferretdb | ||
compute: | ||
ferretdb: | ||
trigger: "On" | ||
podLifeTimeThreshold: 24h | ||
minAllowed: | ||
cpu: 250m | ||
memory: 350Mi | ||
maxAllowed: | ||
cpu: 1 | ||
memory: 1Gi | ||
controlledResources: ["cpu", "memory"] | ||
containerControlledValues: "RequestsAndLimits" | ||
resourceDiffPercentage: 10 | ||
``` | ||
Here, we are going to describe the various sections of a `FerretDBAutoscaler` crd. | ||
|
||
A `FerretDBAutoscaler` object has the following fields in the `spec` section. | ||
|
||
### spec.databaseRef | ||
|
||
`spec.databaseRef` is a required field that point to the [FerretDB](/docs/guides/ferretdb/concepts/ferretdb.md) object for which the autoscaling will be performed. This field consists of the following sub-field: | ||
|
||
- **spec.databaseRef.name :** specifies the name of the [FerretDB](/docs/guides/ferretdb/concepts/ferretdb.md) object. | ||
|
||
### spec.compute | ||
|
||
`spec.compute` specifies the autoscaling configuration for the compute resources i.e. cpu and memory of FerretDB components. This field consists of the following sub-field: | ||
|
||
- `trigger` indicates if compute autoscaling is enabled for this component of the ferretdb. If "On" then compute autoscaling is enabled. If "Off" then compute autoscaling is disabled. | ||
- `minAllowed` specifies the minimal amount of resources that will be recommended, default is no minimum. | ||
- `maxAllowed` specifies the maximum amount of resources that will be recommended, default is no maximum. | ||
- `controlledResources` specifies which type of compute resources (cpu and memory) are allowed for autoscaling. Allowed values are "cpu" and "memory". | ||
- `containerControlledValues` specifies which resource values should be controlled. Allowed values are "RequestsAndLimits" and "RequestsOnly". | ||
- `resourceDiffPercentage` specifies the minimum resource difference between recommended value and the current value in percentage. If the difference percentage is greater than this value than autoscaling will be triggered. | ||
- `podLifeTimeThreshold` specifies the minimum pod lifetime of at least one of the pods before triggering autoscaling. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
title: FerretDBVersion CRD | ||
menu: | ||
docs_{{ .version }}: | ||
identifier: fr-catalog-concepts | ||
name: FerretDBVersion | ||
parent: fr-concepts-ferretdb | ||
weight: 15 | ||
menu_name: docs_{{ .version }} | ||
section_menu_id: guides | ||
--- | ||
|
||
> New to KubeDB? Please start [here](/docs/README.md). | ||
# FerretDBVersion | ||
|
||
## What is FerretDBVersion | ||
|
||
`FerretDBVersion` is a Kubernetes `Custom Resource Definitions` (CRD). It provides a declarative configuration to specify the docker images to be used for [FerretDB](https://ferretdb.net/) server deployed with KubeDB in a Kubernetes native way. | ||
|
||
When you install KubeDB, a `FerretDBVersion` custom resource will be created automatically for every supported FerretDB release versions. You have to specify the name of `FerretDBVersion` crd in `spec.version` field of [FerretDB](/docs/guides/ferretdb/concepts/ferretdb.md) crd. Then, KubeDB will use the docker images specified in the `FerretDBVersion` crd to create your expected FerretDB instance. | ||
|
||
Using a separate crd for specifying respective docker image names allow us to modify the images independent of KubeDB operator. This will also allow the users to use a custom FerretDB image for their server. | ||
|
||
## FerretDBVersion Specification | ||
|
||
As with all other Kubernetes objects, a FerretDBVersion needs `apiVersion`, `kind`, and `metadata` fields. It also needs a `.spec` section. | ||
|
||
```yaml | ||
apiVersion: catalog.kubedb.com/v1alpha1 | ||
kind: FerretDBVersion | ||
metadata: | ||
name: 1.23.0 | ||
spec: | ||
db: | ||
image: ghcr.io/appscode-images/ferretdb:1.23.0 | ||
securityContext: | ||
runAsUser: 1000 | ||
version: 1.23.0 | ||
deprecated: false | ||
``` | ||
### metadata.name | ||
`metadata.name` is a required field that specifies the name of the `FerretDBVersion` crd. You have to specify this name in `spec.version` field of [FerretDB](/docs/guides/ferretdb/concepts/ferretdb.md) crd. | ||
|
||
We follow this convention for naming FerretDBVersion crd: | ||
|
||
- Name format: `{Original ferretdb image version}-{modification tag}` | ||
|
||
We plan to modify original FerretDB docker images to support additional features. Re-tagging the image with v1, v2 etc. modification tag help separating newer iterations from the older ones. An image with higher modification tag will have more features than the images with lower modification tag. Hence, it is recommended to use FerretDBVersion crd with higher modification tag to take advantage of the latest features. | ||
|
||
### spec.version | ||
|
||
`spec.version` is a required field that specifies the original version of FerretDB that has been used to build the docker image specified in `spec.server.image` field. | ||
|
||
### spec.deprecated | ||
|
||
`spec.deprecated` is an optional field that specifies whether the docker images specified here is supported by the current KubeDB operator. | ||
|
||
The default value of this field is `false`. If `spec.deprecated` is set `true`, KubeDB operator will not create the server and other respective resources for this version. | ||
|
||
### spec.ferretdb.image | ||
|
||
`spec.ferretdb.image` is a required field that specifies the docker image which will be used to create PetSet by KubeDB operator to create expected FerretDB server. | ||
|
||
### spec.securityContext | ||
|
||
`spec.securityContext` holds pod-level security attributes and common container settings for FerretDB pod. | ||
|
||
## Next Steps | ||
|
||
- Learn about FerretDB crd [here](/docs/guides/ferretdb/concepts/catalog.md). | ||
- Deploy your first FerretDB server with KubeDB by following the guide [here](/docs/guides/ferretdb/quickstart/quickstart.md). |
Oops, something went wrong.