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

Side car do not remove the files of a config map when it is deleted #267

Open
vkjv opened this issue Apr 3, 2023 · 5 comments
Open

Side car do not remove the files of a config map when it is deleted #267

vkjv opened this issue Apr 3, 2023 · 5 comments
Labels
question Further information is requested stale close issues and PRs after 60 days of inactivity

Comments

@vkjv
Copy link

vkjv commented Apr 3, 2023

Hi,
I have configured k8s-sidecar to monitor some of the configmaps for json file contents and create them as files in the file system. Creation, modification is working fine. But when I remove the configmap itself, side car do not seems to be removing those files which are part if the deleted configmap. Even removing the content from the configmap also, do not seem to be removing the corresponding file. Am I missing something here?

@jekkel
Copy link
Member

jekkel commented Apr 12, 2023

@vkjv Are you using the latest version? Could you provide (anonymized) logs of the sidecar?

@jekkel jekkel added the question Further information is requested label Apr 12, 2023
@vkjv
Copy link
Author

vkjv commented Apr 17, 2023

@vkjv Are you using the latest version? Could you provide (anonymized) logs of the sidecar?

Hi, I made it work using the WATCH. From the documentation it is hard make out in the first place. Since it documents only SLEEP and LIST. SLEEP do not monitor removal of configmap contents. So it worked with WATCH.
Please update the documentation and close this case.

Thank you.

@jekkel
Copy link
Member

jekkel commented Apr 17, 2023

Glad that you were able to make it work for you. I am not sure it's not supposed to work with SLEEP though. Any chance you could provide the requested information?

Any suggestions for the improvements of this:

If METHOD is set to LIST, the sidecar will just list config-maps/secrets and exit. With SLEEP it will list all config-maps/secrets, then sleep for SLEEP_TIME seconds. Anything else will continuously watch for changes.

?

@ns-phegde
Copy link

ns-phegde commented Oct 16, 2023

@jekkel I'm also having the same issue 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.

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"

Copy link

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.

@github-actions github-actions bot added the stale close issues and PRs after 60 days of inactivity label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale close issues and PRs after 60 days of inactivity
Projects
None yet
Development

No branches or pull requests

3 participants