kiwigrid/helm-charts

Compact is not properly provisioned in the pure chart

Closed this issue · 4 comments

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Version of Helm and Kubernetes:

$ k version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.8", GitCommit:"211047e9a1922595eaa3a1127ed365e9299a6c23", GitTreeState:"clean", BuildDate:"2019-10-15T12:11:03Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.11", GitCommit:"25074a190ef2a07d8b0ed38734f2cb373edfb868", GitTreeState:"clean", BuildDate:"2019-09-18T14:34:46Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}
$ helm version
Client: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.15.0", GitCommit:"c2440264ca6c078a06e088a838b0476d2fc14750", GitTreeState:"clean"}

Which chart in which version:
prometheus-thanos (906d1b4)

What happened:
If compactor statefulset has persistentVolume.enabled: false then it is not properly provisioned.

How to reproduce it (as minimally and precisely as possible):
After I clone the repository, run the command below.
helm-charts/charts $ helm install --name thanos --namespace test prometheus-thanos

This command is based on the values in the prometheus-thanos/values.yaml.
However, the Compact statefulset is not working well due to an invalid yaml template.

helm-charts/charts $ k get sts
NAME                                     READY   AGE
thanos-prometheus-thanos-compact         0/1     2m4s
thanos-prometheus-thanos-ruler           1/1     2m4s
thanos-prometheus-thanos-store-gateway   0/1     2m4s

helm-charts/charts $ k describe sts thanos-prometheus-thanos-compact
Name:               thanos-prometheus-thanos-compact
Namespace:          test
CreationTimestamp:  Mon, 16 Dec 2019 14:01:24 +0900
Selector:           app.kubernetes.io/instance=thanos,app.kubernetes.io/name=prometheus-thanos-compact
Labels:             app.kubernetes.io/instance=thanos
                    app.kubernetes.io/managed-by=Tiller
                    app.kubernetes.io/name=prometheus-thanos-compact
                    helm.sh/chart=prometheus-thanos-2.4.0
Annotations:        <none>
Replicas:           1 desired | 0 total
Update Strategy:    RollingUpdate
Pods Status:        0 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:       app.kubernetes.io/instance=thanos
                app.kubernetes.io/name=prometheus-thanos-compact
  Annotations:  prometheus.io/port: 10902
                prometheus.io/scrape: true
  Containers:
   prometheus-thanos-compact:
    Image:      quay.io/thanos/thanos:v0.8.1
    Port:       10902/TCP
    Host Port:  0/TCP
    Args:
      compact
      --log.level=info
      --retention.resolution-raw=30d
      --retention.resolution-5m=30d
      --retention.resolution-1h=10y
      --consistency-delay=30m
      --wait
    Environment:  <none>
    Mounts:
      /data from storage-volume (rw)
   storage-volume:
    Image:
    Port:         <none>
    Host Port:    <none>
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Volume Claims:    <none>
Events:
  Type     Reason        Age                  From                    Message
  ----     ------        ----                 ----                    -------
  Warning  FailedCreate  9s (x19 over 2m27s)  statefulset-controller  create Pod thanos-prometheus-thanos-compact-0 in StatefulSet thanos-prometheus-thanos-compact failed error: Pod "thanos-prometheus-thanos-compact-0" is invalid: [spec.containers[0].volumeMounts[0].name: Not found: "storage-volume", spec.containers[1].image: Required value]

helm-charts/charts $ k get sts thanos-prometheus-thanos-compact -o yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  creationTimestamp: "2019-12-16T05:01:24Z"
  generation: 1
  labels:
    app.kubernetes.io/instance: thanos
    app.kubernetes.io/managed-by: Tiller
    app.kubernetes.io/name: prometheus-thanos-compact
    helm.sh/chart: prometheus-thanos-2.4.0
  name: thanos-prometheus-thanos-compact
  namespace: test
  resourceVersion: "33359536"
  selfLink: /apis/apps/v1/namespaces/test/statefulsets/thanos-prometheus-thanos-compact
  uid: 1bcf0539-1fc1-11ea-8a29-0234de78666e
spec:
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/instance: thanos
      app.kubernetes.io/name: prometheus-thanos-compact
  serviceName: prometheus-thanos-compact
  template:
    metadata:
      annotations:
        prometheus.io/port: "10902"
        prometheus.io/scrape: "true"
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: thanos
        app.kubernetes.io/name: prometheus-thanos-compact
    spec:
      containers:
      - args:
        - compact
        - --log.level=info
        - --retention.resolution-raw=30d
        - --retention.resolution-5m=30d
        - --retention.resolution-1h=10y
        - --consistency-delay=30m
        - --wait
        image: quay.io/thanos/thanos:v0.8.1
        imagePullPolicy: IfNotPresent
        name: prometheus-thanos-compact
        ports:
        - containerPort: 10902
          name: monitoring
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /data
          name: storage-volume
      - imagePullPolicy: IfNotPresent
        name: storage-volume
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
  updateStrategy:
    type: RollingUpdate
status:
  replicas: 0

If I set Compact.persistentVolume.enabled: true, the template works well.
Even if set to false, storage-volume should be created with emptyDir, but template is not.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

sorry for the delay. i'll check it later...

@yheonhochoi is this fixed for you with the current version?

@monotek
Sorry for checking late!
I confirmed that it works well with the revised chart. Thank you!