Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Elasticsearch: set PVC labels through setting all StatefulSet labels to its volumeClaimTemplate #665

Merged
merged 1 commit into from
Jun 29, 2020

Conversation

desaintmartin
Copy link
Contributor

Elasticsearch: set PVC labels through setting all StatefulSet labels to its volumeClaimTemplate.

Allows to track created PVCs (example: delete all PVCs from this recently deleted Release).

  • Chart version not bumped (the versions are all bumped and released at the same time)
  • README.md updated with any new values or changes
  • Updated template tests in ${CHART}/tests/*.py
  • Updated integration tests in ${CHART}/examples/*/test/goss.yaml

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@jmlrt
Copy link
Member

jmlrt commented Jun 25, 2020

jenkins test this please

Copy link
Member

@jmlrt jmlrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @desaintmartin,
Thank you for this PR 👍

Copy link
Member

@jmlrt jmlrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upgrade test is failing because volumeClaimTemplates update is forbidden for statefulsets:

14:52:00 Upgrading Elasticsearch chart
14:52:01 Error: UPGRADE FAILED: StatefulSet.apps "upgrade-master" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden
14:52:01 UPGRADE FAILED

https://devops-ci.elastic.co/job/elastic+helm-charts+pull-request+integration-elasticsearch/484/ES_SUITE=upgrade,KUBERNETES_VERSION=1.14,label=docker&&virtual/console

I would suggest adding a persistence.labels.enabled value. This label would default to false to no break upgrade from previous versions and would add the labels only when overrided to true.

WDYT?

@desaintmartin
Copy link
Contributor Author

Sure, here you are. Would you need tests for this?

@jmlrt
Copy link
Member

jmlrt commented Jun 25, 2020

jenkins test this please

@@ -26,6 +26,16 @@ spec:
volumeClaimTemplates:
- metadata:
name: {{ template "elasticsearch.uname" . }}
{{- if .Values.labels.enabled }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{- if .Values.labels.enabled }}
{{- if .Values.persistence.labels.enabled }}

@jmlrt
Copy link
Member

jmlrt commented Jun 25, 2020

Sure, here you are. Would you need tests for this?

Adding test would be great. Ideally we should have an assert in test_default to ensure that there is no pvc labels with default values, and another test like test_adding_storageclass_annotation_to_volumeclaimtemplate to ensure that labels are added when they are defined.

@desaintmartin
Copy link
Contributor Author

Updated!

@jmlrt
Copy link
Member

jmlrt commented Jun 26, 2020

jenkins test this please

elasticsearch/tests/elasticsearch_test.py Outdated Show resolved Hide resolved
@cla-checker-service
Copy link

cla-checker-service bot commented Jun 29, 2020

💚 CLA has been signed

…to its volumeClaimTemplate.

Allows to track created PVCs (example: delete all PVCs from this recently deleted Release).

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
@desaintmartin
Copy link
Contributor Author

Done, signed, rebased.
When running tests locally, it seemed to pass, but I didn't pay attention too much, maybe I did something wrong.

@jmlrt
Copy link
Member

jmlrt commented Jun 29, 2020

jenkins test this please

Copy link
Member

@jmlrt jmlrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM⛴
Thanks for this PR 👍

@jmlrt jmlrt merged commit 96c5155 into elastic:master Jun 29, 2020
jmlrt pushed a commit that referenced this pull request Jun 29, 2020
jmlrt pushed a commit that referenced this pull request Jun 29, 2020
jmlrt pushed a commit that referenced this pull request Jun 29, 2020
@jmlrt
Copy link
Member

jmlrt commented Jun 29, 2020

backported to 6.8, 7.8and 7.x branches

@jmlrt jmlrt mentioned this pull request Jul 16, 2020
@jmlrt jmlrt mentioned this pull request Jul 16, 2020
This was referenced Jul 27, 2020
@jmlrt jmlrt mentioned this pull request Oct 28, 2020
This was referenced Nov 17, 2020
@jmlrt jmlrt mentioned this pull request Feb 8, 2021
This was referenced Mar 15, 2021
@jmlrt jmlrt mentioned this pull request May 25, 2021
@jmlrt jmlrt mentioned this pull request Mar 8, 2022
@jmlrt jmlrt mentioned this pull request Apr 21, 2022
This was referenced Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants