Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

cluster setup and structured logging #837

Merged
merged 9 commits into from
Dec 18, 2020

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Dec 18, 2020

This is a combination of PRs #825 and PR #836. Those two PRs conflict, which gets resolved here by rebasing the later one on top of the older one.

We can merge either one of the two PRs or this one here when both are okay.

This is inspired by structured logging in Kubernetes. However,
upstream Kubernetes currently lacks some pieces of the puzzle, so
klogr had to be forked until
kubernetes/klog#197 is merged and released.

testinglogger.go is something that also might better go into klog.
This reduces direct usage of klog to the main function. Everything
else gets a structured logger through the context and uses only that
for logging.

While making this change, the code also got cleaned up:
- context gets passed into a lot more functions, allowing the removal
  of all context.TODO
- several private functions and types no longer get exported unnecessarily
- repetitive invocations of identical functions gets replaced
  with iterating over a map of callbacks
The default is klog text format, "json" selects zapper.
Downloading the 1MB file can be surprisingly slow (> 30 minutes) on an
otherwise fast Internet connection.
When setup-ca-kubernetes.sh is invoked directly as explain in
install.md, then it must get TEST_DRIVER_NAMESPACE via test-config.sh
because that deals with setting it via the environment and local
config files.

setup-deployment.sh already got it that way, but had a redundant
fallback.
We need the namespace for the driver *before* creating secrets.
Therefore we cannot create the namespace via the YAML files.

Fixes: intel#834
When a deployment was created in a different namespace than the one
that is expected now, the log output was a bit confusing:

Dec 18 09:31:55.805: INFO: want lvm-testing PMEM-CSI deployment = {HasDriver:true HasOperator:false HasOLM:false Mode:lvm Namespace:default Testing:true Version:}
Dec 18 09:31:55.805: INFO: have lvm-testing PMEM-CSI deployment, want lvm-testing -> delete existing deployment

Re-deploying in the intended namespace however worked fine.
@pohly pohly merged commit 692818b into intel:devel Dec 18, 2020
@pohly pohly mentioned this pull request Dec 18, 2020
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.

1 participant