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

Umbrella Issue: Code Quality Improvements #528

Closed
5 tasks done
BenTheElder opened this issue May 15, 2019 · 12 comments
Closed
5 tasks done

Umbrella Issue: Code Quality Improvements #528

BenTheElder opened this issue May 15, 2019 · 12 comments
Assignees
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@BenTheElder
Copy link
Member

BenTheElder commented May 15, 2019

What should be cleaned up or changed:

  • enable staticcheck and fix errors https://staticcheck.io/docs/
  • factor out all exec / docker interaction into interfaces for mocking and implementing against podman etc.
    • eliminate the caching mechanism on node handles, instead provide a caching wrapper for this docker interface, and only use it by default in the CLI (library users should need to opt into caching since we don't know how long lived their processes are and we probably won't have good invalidation)
  • unit tests, as the code grows and matures, we should write more of them! [WIP]
  • shellcheck our bash. it's not going anywhere for the little dev scripts, and we run a tiny bit in the node entrypoint now. we should ensure this is high quality. we can create a simpler variation on my kubernetes/kubernetes shellcheck script.

Why is this needed:
To ensure kind's code improves in quality and stays that way.

/priority important-longterm
/assign

Will work on this more after the 0.3 release. Plan to go ahead and get some smaller pieces in while some tests soak.

@BenTheElder BenTheElder added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label May 15, 2019
@k8s-ci-robot k8s-ci-robot added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label May 15, 2019
@BenTheElder BenTheElder added the lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. label May 15, 2019
@aojea
Copy link
Contributor

aojea commented May 15, 2019

@BenTheElder should we add some e2e smoke tests for features like the load balancer and port mapping?

@BenTheElder
Copy link
Member Author

BenTheElder commented May 15, 2019

@aojea IE HA mode?

Eventually yes, but lower priority, to my knowledge nothing depends on that yet. (And shouldn't!)

We also should have smoke tests with the default image.

@ezzoueidi
Copy link

I might help with the two last points :)

zegl added a commit to zegl/kind that referenced this issue Jun 2, 2019
zegl added a commit to zegl/kind that referenced this issue Jun 2, 2019
command -v is a shell builtin, this change is recommended by shellcheck.

This updates kubernetes-sigs#528
zegl added a commit to zegl/kind that referenced this issue Jun 2, 2019
This bug was found with shellcheck.

This updates kubernetes-sigs#528
@alisondy
Copy link
Contributor

alisondy commented Jun 3, 2019

another one for the list potentially?
Hadolint our docker files see here

@BenTheElder
Copy link
Member Author

#584 and #591 added a shellcheck linter and eliminated failures (except the one lint we turn off regarding command -v vs which)

@glerchundi
Copy link

Is it possible to avoid the dependency with docker binary by vendoring the client library and making the calls directly to the API instead of executing them through exec?

@BenTheElder
Copy link
Member Author

Good question.

It's pretty wildly unusual to have a docker daemon running but no docker client binary so we're not trying to avoid depending on the binary, however we are trying to let kind work with other runtimes (podman).

(Also the docker client library
is pretty terrible, kubelet is littered with comments about trying to figure out how to use it correctly. Users will have a much better time debugging when they can see the CLI calls by adjusting the log level)

@glerchundi
Copy link

glerchundi commented Jun 6, 2019 via email

@k8s-ci-robot k8s-ci-robot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. and removed lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. labels Sep 4, 2019
@kubernetes-sigs kubernetes-sigs deleted a comment from fejta-bot Sep 4, 2019
@BenTheElder BenTheElder added lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 4, 2019
@BenTheElder
Copy link
Member Author

Small update: we've added golangci-lint with a number of extra linters enabled across the repo and fixed ~all of the failures.

@BenTheElder
Copy link
Member Author

we're mostly decoupled from docker, and span up some more effort on testing, including collecting coverage data and soon e2e coverage too.

@BenTheElder
Copy link
Member Author

factoring out docker into a provider and node interface is 100% done for cluster operations.

image building I don't think we want to tackle for now, I'd rather only maintain one build, but we can see if s/docker/$tool/ works for any tools implementing the same build command maybe..

we definitely want more unit tests, and are going to collect e2e test coverage, but we do have a lot more unit tests now and are working to improve coverage of stable behaviors (like kubeconfig management).

@BenTheElder
Copy link
Member Author

https://prow.k8s.io/view/gcs/kubernetes-jenkins/logs/ci-kind-unit/1190267720940130305

We're up to 22% of statements and 31% of files.

Ordinarily I'd be very unhappy with that, but the other code is mostly things like creating the nodes with docker exec, which we e2e test extensively.

I have a WIP PR to collect the e2e coverage of kind, we can diff when that's in and fill the gaps.

This code still has other quality improvements to come, but the ones in the initial comment are in much better shape.

stg-0 added a commit to stg-0/kind that referenced this issue Mar 26, 2024
* Add upgrade 0.4 documentation

* Update stratio-docs/en/modules/operations-manual/pages/operations-manual.adoc

Co-authored-by: Teresa Pérez Senso <[email protected]>

* Apply suggestions from code review

Co-authored-by: Teresa Pérez Senso <[email protected]>

---------

Co-authored-by: stg <[email protected]>
Co-authored-by: Teresa Pérez Senso <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

No branches or pull requests

6 participants