elastic / curator

Curator: Tending your Elasticsearch indices
Other
3.04k stars 635 forks source link

Error: No such option: --config #1696

Closed RiRa12621 closed 9 months ago

RiRa12621 commented 9 months ago

To submit a bug or report an issue

I'm trying to run curator in a container on a kubernetes cluster.

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: curator
  namespace: logging
data:
  config.yml: |
    client:
      hosts:
        - elasticsearch
      port: 9200
      url_prefix:
      use_ssl: False
      certificate:
      client_cert:
      client_key:
      ssl_no_validate: False
      username:
      password:
      timeout: 30
      master_only: False
      logging:
      loglevel: INFO
      logfile:
      logformat: default
  actions.yml: |
    actions:
      1:
        action: delete_indices
        description: "Delete indices older than 1 day"
        options:
        ignore_empty_list: True
        filters:
        - filtertype: age
          source: creation_date
          direction: older
          unit: days
          unit_count: 1
---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: curator
  namespace: logging
spec:
  schedule: "0 1 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: curator
              image: untergeek/curator:8.0.8
              args:
                - --config /dummy/config.yml /dummy/actions.yml
              volumeMounts:
                - name: curator
                  mountPath: /dummy
          volumes:
            - name: curator
              configMap:
                name: curator
                defaultMode: 0777
                items:
                  - key: "config.yml"
                    path: "config.yml"
                  - key: "actions.yml"
                    path: "actions.yml"
          restartPolicy: OnFailure

This is creating actions.yml and config.yml in a configmap. the configmap gets mounted and then run. Since the binary is in /curator we can't mount it in there, so creating a new dir.

Expected Behavior

Curator runs, using the actions.yml and config.yml that are provided.

Actual Behavior

$ kubectl logs handtest14-xml64
Usage: curator [OPTIONS] ACTION_FILE
Try 'curator --help' for help.

Error: No such option: --config /dummy/config.yml /dummy/actions.yml

Steps to Reproduce the Problem

  1. Create minikube cluster
  2. deploy above yaml
  3. create job from cronjob by hand: oc create job --from=cronjob/curator handtest1

Specifications

Additional information

When running the image locally, there are no issues like :

 $ docker run -ti --rm curator-test --config /curator/config.yml /curator/actions.yml
No "elasticsearch" setting in supplied configuration.  Using defaults.
No "logging" setting in supplied configuration.  Using defaults.
RiRa12621 commented 9 months ago

adjusted syntaxt to

              args:
                - --config
                - /dummy/config.yml
                - /dummy/actions.yml

Works now