Skip to content

DataNode native libs volume naming mismatch #66

@monrax

Description

@monrax

From https://github.com/tigerpeng2001/graylog-helm/blob/main/evaluation.txt

DataNode uses volumeMount name native-libs:

volumeMounts:
- name: "data"
mountPath: {{ .Values.datanode.persistence.data.mountPath | default "/var/lib/graylog-datanode" | quote }}
- name: native-libs
mountPath: {{ .Values.datanode.persistence.nativeLibs.mountPath | default "/native_libs" | quote }}

Which it also uses for the corresponding default emptyDir volume:

volumes:
{{- if not .Values.datanode.persistence.nativeLibs.enabled }}
- name: native-libs
emptyDir: {}
{{- end }}

But the PVC template name is nativeLibs:

{{- if .Values.datanode.persistence.nativeLibs.enabled }}
- metadata:
name: nativeLibs
spec:

How to reproduce?

By running

helm template graylog ./charts/graylog | grep -A 120 "statefulsets/datanode.yaml"

The following YAML should be rendered:

Click to show/hide
# Source: graylog/templates/workload/statefulsets/datanode.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: graylog-datanode
  labels:
    app: graylog-datanode
    helm.sh/chart: graylog-1.0.0
    app.kubernetes.io/name: graylog
    app.kubernetes.io/instance: graylog
    app.kubernetes.io/version: "7.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 3
  serviceName: graylog-datanode-svc
  selector:
    matchLabels:
      app: graylog-datanode
      app.kubernetes.io/name: graylog
      app.kubernetes.io/instance: graylog
  updateStrategy:
    # (...)
  template:
    metadata:
      # (...)
    spec:
      dnsPolicy: ClusterFirst
      serviceAccountName: graylog-sa
      containers:
        - name: graylog-datanode
          image: graylog/graylog-datanode:7.0
          # (...)
          volumeMounts:
            - name: "data"
              mountPath: "/var/lib/graylog-datanode"
            - name: native-libs
              mountPath: "/native_libs"
      #(...)
      volumes:
        - name: native-libs
          emptyDir: {}
  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes:
          - "ReadWriteOnce"
        resources:
          requests:
            storage: "8Gi"
---

with both the volumeMounts item and the corresponding volumes one match.

But, by running

helm template graylog ./charts/graylog --set datanode.persistence.nativeLibs.enabled=true | grep -A 120 "statefulsets/datanode.yaml"

The following YAML is rendered:

Click to show/hide
# Source: graylog/templates/workload/statefulsets/datanode.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: graylog-datanode
  labels:
    app: graylog-datanode
    helm.sh/chart: graylog-1.0.0
    app.kubernetes.io/name: graylog
    app.kubernetes.io/instance: graylog
    app.kubernetes.io/version: "7.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 3
  serviceName: graylog-datanode-svc
  selector:
    matchLabels:
      app: graylog-datanode
      app.kubernetes.io/name: graylog
      app.kubernetes.io/instance: graylog
  updateStrategy:
    # (...)
  template:
    metadata:
      # (...)
    spec:
      dnsPolicy: ClusterFirst
      serviceAccountName: graylog-sa
      containers:
        - name: graylog-datanode
          image: graylog/graylog-datanode:7.0
          # (...)
          volumeMounts:
            - name: "data"
              mountPath: "/var/lib/graylog-datanode"
            - name: native-libs
              mountPath: "/native_libs"
  # (...)
  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes:
          - "ReadWriteOnce"
        resources:
          requests:
            storage: "8Gi"
    - metadata:
        name: nativeLibs
      spec:
        accessModes:
          - "ReadWriteOnce"
        resources:
          requests:
            storage: "2Gi"
---

with the volumeMounts item (native-libs) and the volumes one (nativeLibs) not matching.

Then, when trying to install the chart with datanode.persistence.nativeLibs.enabled=true:

helm install graylog graylog/graylog --set datanode.persistence.nativeLibs.enabled=true

The graylog-datanodes won't be scheduled:

kubectl get pods | grep datanode

And by describing the corresponding Statefulset:

kubectl describe sts graylog-datanode

We get the following Events:

Events:
  Type     Reason        Age                    From                    Message
  ----     ------        ----                   ----                    -------
  Warning  FailedCreate  3m55s (x12 over 4m6s)  statefulset-controller  create Pod graylog-datanode-0 in StatefulSet graylog-datanode failed error: failed to create PVC nativeLibs-graylog-datanode-0: PersistentVolumeClaim "nativeLibs-graylog-datanode-0" is invalid: metadata.name: Invalid value: "nativeLibs-graylog-datanode-0": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
  Warning  FailedCreate  3m45s (x13 over 4m6s)  statefulset-controller  create Claim nativeLibs-graylog-datanode-0 for Pod graylog-datanode-0 in StatefulSet graylog-datanode failed error: PersistentVolumeClaim "nativeLibs-graylog-datanode-0" is invalid: metadata.name: Invalid value: "nativeLibs-graylog-datanode-0": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions