-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/2021-04-28' into main
Former-commit-id: 1be9c9f
- Loading branch information
Showing
88 changed files
with
3,860 additions
and
449 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
531 changes: 288 additions & 243 deletions
531
advocacy_docs/kubernetes/cloud_native_postgresql/api_reference.mdx
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
84 changes: 84 additions & 0 deletions
84
advocacy_docs/kubernetes/cloud_native_postgresql/labels_annotations.mdx
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,84 @@ | ||
--- | ||
title: 'Labels and annotations' | ||
originalFilePath: 'src/labels_annotations.md' | ||
product: 'Cloud Native Operator' | ||
--- | ||
|
||
Resources in Kubernetes are organized in a flat structure, with no hierarchical | ||
information or relationship between them. However, such resources and objects | ||
can be linked together and put in relationship through **labels** and | ||
**annotations**. | ||
|
||
!!! info | ||
For more information, please refer to the Kubernetes documentation on | ||
[annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) and | ||
[labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/). | ||
|
||
In short: | ||
|
||
- an annotation is used to assign additional non-identifying information to | ||
resources with the goal to facilitate integration with external tools | ||
- a label is used to group objects and query them through Kubernetes' native | ||
selector capability | ||
|
||
You can select one or more labels and/or annotations you will use | ||
in your Cloud Native PostgreSQL deployments. Then you need to configure the operator | ||
so that when you define these labels and/or annotations in a cluster's metadata, | ||
they are automatically inherited by all resources created by it (including pods). | ||
|
||
!!! Note | ||
Label and annotation inheritance is the technique adopted by Cloud Native | ||
PostgreSQL in lieu of alternative approaches such as pod templates. | ||
|
||
## Pre-requisites | ||
|
||
By default, no label or annotation defined in the cluster's metadata is | ||
inherited by the associated resources. | ||
In order to enable label/annotation inheritance, you need to follow the | ||
instructions provided in the ["Operator configuration"](operator_conf.md) section. | ||
|
||
Below we will continue on that example and limit it to the following: | ||
|
||
- annotations: `categories` | ||
- labels: `app`, `environment`, and `workload` | ||
|
||
!!! Note | ||
Feel free to select the names that most suit your context for both | ||
annotations and labels. Remember that you can also use wildcards | ||
in naming and adopt strategies like `mycompany/*` for all labels | ||
or annotations starting with `mycompany/` to be inherited. | ||
|
||
## Defining cluster's metadata | ||
|
||
When defining the cluster, **before** any resource is deployed, you can | ||
properly set the metadata as follows: | ||
|
||
```yaml | ||
apiVersion: postgresql.k8s.enterprisedb.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: cluster-example | ||
annotations: | ||
categories: database | ||
labels: | ||
environment: production | ||
workload: database | ||
app: sso | ||
spec: | ||
# ... <snip> | ||
``` | ||
|
||
Once the cluster is deployed, you can verify, for example, that the labels | ||
have been correctly set in the pods with: | ||
|
||
```shell | ||
kubectl get pods --show-labels | ||
``` | ||
|
||
## Current limitations | ||
|
||
Cloud Native PostgreSQL does not currently support synchronization of labels | ||
or annotations after a resource has been created. For example, suppose you | ||
deploy a cluster. When you add a new annotation to be inherited and define it | ||
in the existing cluster, the operator will not automatically set it | ||
on the associated resources. |
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
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
Oops, something went wrong.