Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Conversation

@bznein
Copy link
Contributor

@bznein bznein commented Jul 10, 2020

All Submissions:

  • Have you signed our CLA?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

@bznein bznein changed the title Cloudp 66908 add configmap to evg logs CLOUDP-66908: add configmap to evg logs Jul 10, 2020
Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Nice and straight forward change.

Good to merge once tests pass 👍 (and we see the configmaps are correctly attached!)

Copy link
Contributor

@rodrigovalin rodrigovalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check that ApiException capture, return inmediatelly maybe?

config_maps = corev1.list_namespaced_config_map(namespace, pretty="true")
except ApiException as e:
print("Exception when calling list_namespaced_config_map: %s\n" % e)
return config_maps.items
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the ApiException is raised, config_maps will be None and .items will fail with AttributeError

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you are absolutely right! I'll fix this on all functions in this file!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ nice catch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change the function to return a Optional[dict] and similar and give the caller the burden to check it?
The other way would be to just not catch the exception, but that would interrupting the dumping of logs and mark the task as failed even when it is not. So I'm leaning towards the first.

@chatton
Copy link
Contributor

chatton commented Jul 10, 2020

@bznein a few small things

  1. Since we are attaching all configmaps, this means we end up attaching kube-configs. (definitely don't want this)
  2. The format of automation config in the configmap is not very nice to look at! In this case, maybe we just want to pretty-print the .data.automation-config value, and not get the output of the configmap resource itself.

What do you think?

@bznein
Copy link
Contributor Author

bznein commented Jul 10, 2020

@bznein a few small things

  1. Since we are attaching all configmaps, this means we end up attaching kube-configs. (definitely don't want this)
  2. The format of automation config in the configmap is not very nice to look at! In this case, maybe we just want to pretty-print the .data.automation-config value, and not get the output of the configmap resource itself.

What do you think?

  1. You are right. I didn't want to have a function too specific that looks for a particular configmap in case the name changes in the future. Should we do that instead? Or exclude kube-config?
  2. Yes I agree, I'll see which way is better

@chatton
Copy link
Contributor

chatton commented Jul 10, 2020

@bznein a few small things

  1. Since we are attaching all configmaps, this means we end up attaching kube-configs. (definitely don't want this)
  2. The format of automation config in the configmap is not very nice to look at! In this case, maybe we just want to pretty-print the .data.automation-config value, and not get the output of the configmap resource itself.

What do you think?

  1. You are right. I didn't want to have a function too specific that looks for a particular configmap in case the name changes in the future. Should we do that instead? Or exclude kube-config?
  2. Yes I agree, I'll see which way is better

I think in this case, it might actually be fine to just pick a configmap by name, and explicitly just upload that one. Right now, we only have a single one we want, later on we can worry about adding all, or maybe use an exlude-list like you mentioned.

We could maybe create a mechanism like dump_configmap_value(cm, key="automation-config", pretty=True)

I don't think we need to worry too much about configmap names changing, as it should always be a deterministic name based on the name of the resource. "{mdb-name}-config" I think.

Another thing to consider, we are currently running all our tests in kind, a pretty empty environment, but if we're running in a different cluster, there can be all sorts of other k8s resources we don't actually care about, so maybe explicitly stating which resources we want will result in a cleaner output overall.

@bznein bznein merged commit 9afd5f5 into master Jul 13, 2020
@bznein bznein deleted the CLOUDP-66908_add_configmap_to_evg_logs branch July 13, 2020 16:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants