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

when listing secrets and configmaps, secrets fail with 'V1Secret' object has no attribute 'binary_data' #265

Closed
ThommyH opened this issue Mar 24, 2023 · 4 comments · Fixed by #281
Assignees
Labels
bug Something isn't working

Comments

@ThommyH
Copy link

ThommyH commented Mar 24, 2023

We have a mix of configmaps and secrets for grafana datasources. When the sidecar tries to load the secrets it fails. Neither the configmaps nor the secrets use binary data:

Traceback (most recent call last): File "/app/sidecar.py", line 155, in <module> main() File "/app/sidecar.py", line 113, in main list_resources(label, label_value, target_folder, request_url, request_method, request_payload, File "/app/resources.py", line 128, in list_resources files_changed |= _process_config_map(dest_folder, item, resource, unique_filenames, enable_5xx, True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/resources.py", line 217, in _process_config_map if config_map.binary_data is not None: ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'V1Secret' object has no attribute 'binary_data'

We tried running with the latest version 1.23.1 but that didnt help.

@ThommyH
Copy link
Author

ThommyH commented Mar 24, 2023

I suspect the cleanup method here to be the culprit:

for key in set(_resources_object_map.keys()) - exist_keys:

It ignores the kind of resources saved in there. Therefore when reaching this line when loading configmaps, it sees the previously added secret and then assumes it is a configmap.

@jekkel
Copy link
Member

jekkel commented Mar 27, 2023

Thanks for the report, indeed the cleanup code looks broken a bit...

@tomrk-esteam8 could you try fixing that? I think it's a matter of detecting the resource type from item instead. Even extending the test should be easily possible.

@jekkel jekkel added the bug Something isn't working label Mar 27, 2023
@tomrk-esteam8
Copy link
Collaborator

@jekkel ok, I will take. a look.

@mario-steinhoff-gcx
Copy link
Contributor

Hey, I fixed this in my local branch, PR will follow shortly.

mario-steinhoff-gcx added a commit to mario-steinhoff-gcx/k8s-sidecar that referenced this issue May 17, 2023
mario-steinhoff-gcx added a commit to mario-steinhoff-gcx/k8s-sidecar that referenced this issue May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants