-
Notifications
You must be signed in to change notification settings - Fork 159
ECK: Document annotations and labels propagation #2144
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7789b55
ECK: Document annotations and labels propagation
barkbay 36fba47
remove mapped pages
barkbay bdfc4a0
fix link
barkbay 0e6e75c
Test {version}
barkbay dafbf4d
Use shortcuts
barkbay 4dc8c7a
Use eck_resources_list
barkbay 595273f
update
barkbay 3a41137
wording
barkbay eb43c3d
mention * and restrictions
barkbay 2a0629b
fix
barkbay ff81757
fix comment
barkbay 739a601
Use {{eck}}
barkbay 118f320
space
barkbay e0973bc
Update deploy-manage/deploy/cloud-on-k8s/propagate-labels-annotations.md
barkbay b772c74
Update deploy-manage/deploy/cloud-on-k8s/propagate-labels-annotations.md
barkbay 2f8eb1b
Update deploy-manage/deploy/cloud-on-k8s/propagate-labels-annotations.md
barkbay d2b0898
Attempt to fix version
barkbay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
deploy-manage/deploy/cloud-on-k8s/propagate-labels-annotations.md
This file contains hidden or 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,86 @@ | ||
--- | ||
applies_to: | ||
deployment: | ||
eck: all | ||
products: | ||
- id: cloud-kubernetes | ||
--- | ||
|
||
# Propagate Labels and Annotations [k8s-propagate-labels-annotations] | ||
|
||
Starting with version `3.1.0`, {{eck}} supports propagating labels and annotations from the parent resource to the child resources it creates. This can be used on all custom resources managed by ECK, such as {{eck_resources_list}}. | ||
|
||
The example below demonstrates how to use this feature on a {{es}} cluster, however, as mentioned above, this can be also applied to any custom resource managed by {{eck}}. | ||
|
||
```yaml | ||
apiVersion: elasticsearch.k8s.elastic.co/v1 | ||
kind: Elasticsearch | ||
metadata: | ||
annotations: | ||
# Some custom annotations to be propagated to resources created by the operator. | ||
my-annotation1: "my-annotation1-value" | ||
my-annotation2: "my-annotation2-value" | ||
# Instructions for the operator to propagate these annotations and labels to resources it creates. | ||
eck.k8s.alpha.elastic.co/propagate-annotations: "my-annotation1, my-annotation2" | ||
eck.k8s.alpha.elastic.co/propagate-labels: "my-label1, my-label2" | ||
labels: | ||
# Some custom labels to be propagated to resources created by the operator. | ||
my-label1: "my-label1-value" | ||
my-label2: "my-label2-value" | ||
name: elasticsearch-sample | ||
spec: | ||
version: 9.1.0 | ||
nodeSets: | ||
- name: default | ||
config: | ||
# this allows ES to run on nodes even if their vm.max_map_count has not been increased, at a performance cost | ||
node.store.allow_mmap: false | ||
count: 1 | ||
``` | ||
|
||
The custom labels and annotations specified in the `metadata` section of the parent resource will be propagated to all child resources created by {{eck}}, such as StatefulSets, Pods, Services, and Secrets. This ensures that all resources have consistent metadata, which can be useful for filtering, monitoring, and managing resources in Kubernetes: | ||
|
||
```sh | ||
kubectl get sts,pods,svc -l my-label1=my-label1-value,my-label2=my-label2-value | ||
``` | ||
|
||
```sh | ||
NAME READY AGE | ||
statefulset.apps/elasticsearch-sample-es-default 1/1 4m10s | ||
|
||
NAME READY STATUS RESTARTS AGE | ||
pod/elasticsearch-sample-es-default-0 1/1 Running 0 4m9s | ||
|
||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE | ||
service/elasticsearch-sample-es-default ClusterIP None <none> 9200/TCP 4m12s | ||
service/elasticsearch-sample-es-http ClusterIP XX.XX.XX.XX <none> 9200/TCP 4m14s | ||
service/elasticsearch-sample-es-internal-http ClusterIP XX.XX.XX.XX <none> 9200/TCP 4m14s | ||
service/elasticsearch-sample-es-transport ClusterIP None <none> 9300/TCP 4m14s | ||
``` | ||
|
||
It is possible to use `*` as a wildcard to propagate all labels and annotations from the parent resource to the child resources. For example: | ||
|
||
```yaml | ||
apiVersion: elasticsearch.k8s.elastic.co/v1 | ||
kind: Elasticsearch | ||
metadata: | ||
annotations: | ||
# Instructions for the operator to propagate all the annotations and labels to resources it creates. | ||
eck.k8s.alpha.elastic.co/propagate-annotations: "*" | ||
eck.k8s.alpha.elastic.co/propagate-labels: "*" | ||
name: elasticsearch-sample | ||
spec: | ||
version: 9.1.0 | ||
nodeSets: | ||
- name: default | ||
config: | ||
# this allows ES to run on nodes even if their vm.max_map_count has not been increased, at a performance cost | ||
node.store.allow_mmap: false | ||
count: 1 | ||
``` | ||
|
||
::::{note} | ||
Note the following considerations when using this feature: | ||
* Propagated labels and annotations are not automatically deleted. If you want to remove them from the child resources, you need to do so manually or use a cleanup script. | ||
* To prevent conflicts, some labels and annotations reserved for internal use by ECK or Kubernetes are not propagated. This is the case for labels and annotations that match `*.k8s.*.elastic.co/` and also `kubectl.kubernetes.io/last-applied-configuration`. | ||
:::: |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.