kiwigrid / k8s-sidecar

This is a docker container intended to run inside a kubernetes cluster to collect config maps with a specified label and store the included files in a local folder.
MIT License
613 stars 183 forks source link

BUG: With METHOD SLEEP deleting configmap does not delete the file. #311

Open ns-phegde opened 1 year ago

ns-phegde commented 1 year ago

I'm having issues with METHOD: "SLEEP". I'm getting the below error when I use something like the config I've specified. To be more precise this happens when a configmap is deleted.

Version: v1.25.2

ERROR:

Traceback (most recent call last):
  File "/app/resources.py", line 300, in _update_file
    return remove_file(dest_folder, filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/helpers.py", line 103, in remove_file
    complete_file = os.path.join(folder, filename)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 76, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

CONFIG:

      - name:k8s-sidecar
        image: kiwigrid/k8s-sidecar:1.25.2
        imagePullPolicy: IfNotPresent
        volumeMounts:
          - name: config-volume
            mountPath: "/config/"
          - name: merge-script-volume
            mountPath: "/opt/merge.sh"
            subPath: "merge.sh"
          - name: merge-script-volume
            mountPath: "/opt/config_merge.py"
            subPath: "config_merge.py"
          - name: merge-script-volume
            mountPath: "/opt/requirements.txt"
            subPath: "requirements.txt"
        env:
          - name: LABEL
            value: "config"
          - name: FOLDER
            value: "/config/"
          - name: RESOURCE
            value: "configmap"
          - name: REQ_URL
            value: "http://localhost:8080/reload"
          - name: NAMESPACE
            value: "config-dev"
          - name: SCRIPT
            value: "/opt/merge.sh"
          - name: REQ_METHOD
            value: "POST"
          - name: REQ_SKIP_TLS_VERIFY
            value: "true"
          - name: METHOD
            value: "SLEEP"
          - name: IGNORE_ALREADY_PROCESSED
            value: "true"
github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had any activity in the last 60 days. Thank you for your contributions.