Skip to content
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

Normalize Elasticsearch pod related naming #1024

Merged

Conversation

nkvoll
Copy link
Member

@nkvoll nkvoll commented Jun 7, 2019

Rename secret -roles-users to -xpack-file-realm

This is a bit more descriptive about its actual contents

Normalize volumes, mounts, users and roles for ES

Adds -internal to several things that should be considered internals.

Removes some no longer used (and mislabeled) "version specific" resources, such
as a generic ConfigMap and Secret.

Internal mounts are now mounted to directories under /mnt/elastic-internal.

Internal users has the elastic-internal- prefix and roles has the elastic_internal_ prefix.

Since data and logs directories for ES are not considered internals, they now have the
canonical names elasticsearch-data and elasticsearch-logs (previously just data and logs)

Example Volume Mounts:

      /mnt/elastic-internal/elasticsearch-config-managed from elastic-internal-elasticsearch-config-managed (ro)
      /mnt/elastic-internal/keystore-user from elsatic-internal-keystore-user (ro)
      /mnt/elastic-internal/probe-user from elastic-internal-probe-user (ro)
      /mnt/elastic-internal/process-manager from elastic-internal-process-manager (rw)
      /mnt/elastic-internal/secure-settings from elastic-internal-secure-settings (ro)
      /mnt/elastic-internal/unicast-hosts from elastic-internal-unicast-hosts (ro)
      /usr/share/elasticsearch/bin from elastic-internal-elasticsearch-bin-local (rw)
      /usr/share/elasticsearch/config from elastic-internal-elasticsearch-config-local (rw)
      /usr/share/elasticsearch/config/http-certs from elastic-internal-http-certificates (ro)
      /usr/share/elasticsearch/config/transport-certs from elastic-internal-transport-certificates (ro)
      /usr/share/elasticsearch/data from elasticsearch-data (rw)
      /usr/share/elasticsearch/logs from elasticsearch-logs (rw)
      /usr/share/elasticsearch/plugins from elastic-internal-elasticsearch-plugins-local (rw)

Example Volumes

  elastic-internal-elasticsearch-config-local:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elastic-internal-elasticsearch-plugins-local:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elastic-internal-elasticsearch-bin-local:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elasticsearch-data:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elasticsearch-logs:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elastic-internal-process-manager:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elastic-internal-unicast-hosts:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      elasticsearch-sample-es-unicast-hosts
    Optional:  false
  elastic-internal-probe-user:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-internal-users
    Optional:    false
  elsatic-internal-keystore-user:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-internal-users
    Optional:    false
  elastic-internal-secure-settings:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-secure-settings
    Optional:    false
  elastic-internal-http-certificates:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-http-certs-internal
    Optional:    false
  elastic-internal-transport-certificates:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-xdcbcdndf4-certs
    Optional:    false
  elastic-internal-elasticsearch-config-managed:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-xdcbcdndf4-config
    Optional:    false

Add an elstic-internal prefix to the init container names.

The new names are defined as consts to provide a slightly better overview.

Closes #547

@nkvoll nkvoll force-pushed the normalize-elasticsearch-pod-related-naming branch from 540d380 to 0d2f7fc Compare June 8, 2019 09:12
nkvoll added a commit to nkvoll/cloud-on-k8s that referenced this pull request Jun 8, 2019
By default they will get a 1Gi volume, which is chosen because matches roughly 1:1 vs the default heap.

Users can opt out of this behavior by specifying the data volume in the Elasticsearch resource directly

```yaml
apiVersion: elasticsearch.k8s.elastic.co/v1alpha1
kind: Elasticsearch
metadata:
  name: elasticsearch-sample
spec:
  version: "7.1.0"
  nodes:
  - nodeCount: 1
    podTemplate:
      spec:
        volumes:
        - name: elasticsearch-data
          emptyDir: {}
```

Builds on top of elastic#1024

Closes: elastic#913
Copy link
Contributor

@sebgl sebgl left a comment

Choose a reason for hiding this comment

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

Not sure about:

  • moving from data and logs to elasticsearch-data and elasticsearch-logs. I think they were already self-explanatory in their short version?
  • the elastic-internal prefix. Maybe internal is enough? elastic-internal-elasticsearch-config-managed for example looks a bit hairy, compared to eg. internal-config. Also most things we mount are managed?

operators/pkg/controller/elasticsearch/volume/volume.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sebgl sebgl left a comment

Choose a reason for hiding this comment

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

After discussing it on Slack with @nkvoll, I'm fine with going with the most explicit naming convention (elasticsearch-* and elastic-internal-*).

nkvoll added 3 commits June 10, 2019 11:08
The new names are defined as consts to provide a slightly better overview.
Adds `-internal` to several things that should be considered internals.

Removes some no longer used (and mislabeled) "version specific" resources, such
as a generic ConfigMap and Secret.

Internal mounts are now mounted to directories under `/mnt/elastic-internal`.

Internal users has the `elastic-internal-` prefix and roles has the `elastic_internal_` prefix.

Since data and logs directories for ES are not considered internals, they now have the
canonical names `elasticsearch-data` and `elasticsearch-logs` (previously just `data` and `logs`)

Example Volume Mounts:

```
      /mnt/elastic-internal/elasticsearch-config-managed from elastic-internal-elasticsearch-config-managed (ro)
      /mnt/elastic-internal/keystore-user from elsatic-internal-keystore-user (ro)
      /mnt/elastic-internal/probe-user from elastic-internal-probe-user (ro)
      /mnt/elastic-internal/process-manager from elastic-internal-process-manager (rw)
      /mnt/elastic-internal/secure-settings from elastic-internal-secure-settings (ro)
      /mnt/elastic-internal/unicast-hosts from elastic-internal-unicast-hosts (ro)
      /usr/share/elasticsearch/bin from elastic-internal-elasticsearch-bin-local (rw)
      /usr/share/elasticsearch/config from elastic-internal-elasticsearch-config-local (rw)
      /usr/share/elasticsearch/config/http-certs from elastic-internal-http-certificates (ro)
      /usr/share/elasticsearch/config/transport-certs from elastic-internal-transport-certificates (ro)
      /usr/share/elasticsearch/data from elasticsearch-data (rw)
      /usr/share/elasticsearch/logs from elasticsearch-logs (rw)
      /usr/share/elasticsearch/plugins from elastic-internal-elasticsearch-plugins-local (rw)
```

Example Volumes

```
  elastic-internal-elasticsearch-config-local:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elastic-internal-elasticsearch-plugins-local:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elastic-internal-elasticsearch-bin-local:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elasticsearch-data:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elasticsearch-logs:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elastic-internal-process-manager:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  elastic-internal-unicast-hosts:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      elasticsearch-sample-es-unicast-hosts
    Optional:  false
  elastic-internal-probe-user:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-internal-users
    Optional:    false
  elsatic-internal-keystore-user:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-internal-users
    Optional:    false
  elastic-internal-secure-settings:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-secure-settings
    Optional:    false
  elastic-internal-http-certificates:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-http-certs-internal
    Optional:    false
  elastic-internal-transport-certificates:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-xdcbcdndf4-certs
    Optional:    false
  elastic-internal-elasticsearch-config-managed:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-sample-es-xdcbcdndf4-config
    Optional:    false
```
@nkvoll nkvoll force-pushed the normalize-elasticsearch-pod-related-naming branch from 0d2f7fc to 4c31968 Compare June 10, 2019 09:16
@nkvoll
Copy link
Member Author

nkvoll commented Jun 10, 2019

Fixed the remaining comments, hoping for a happy build from CI since it took the weekend off :)

@nkvoll nkvoll merged commit 90663df into elastic:master Jun 10, 2019
@nkvoll nkvoll deleted the normalize-elasticsearch-pod-related-naming branch June 10, 2019 09:42
@pebrc pebrc added >enhancement Enhancement of existing functionality v0.9.0 labels Jul 19, 2019
@pebrc pebrc changed the title Normalize elasticsearch pod related naming Normalize Elasticsearch pod related naming Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v0.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Homogenize secrets and configmaps volumes mount paths
3 participants