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

Introduce HookServer config loading from /etc/runtime/hookserver.d/ #100

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

honpey
Copy link
Contributor

@honpey honpey commented Apr 27, 2022

Signed-off-by: pengyang.hpy honpey@gmail.com

Ⅰ. Describe what this PR does

load hookServer config file from local dir, config file example:
{
"remote-endpoint": "/var/run/koordlet.sock",
"failure-policy": "Ignore",
"runtime-hooks": [
"PreRunPodSandbox"
]
}

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

@@ -0,0 +1,104 @@
package config
Copy link
Member

Choose a reason for hiding this comment

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

add some unittests?

@@ -0,0 +1,244 @@
package config
Copy link
Member

Choose a reason for hiding this comment

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

add tests to improve code coverage

type RuntimeHookConfig struct {
RemoteEndpoint string `json:"remote-endpoint,omitempty"`
FailurePolicy FailurePolicyType `json:"failure-policy,omitempty"`
RuntimeHooks []RuntimeHookType `json:"runtime-hooks,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

each RuntimeHookType may have different FailurePolicyType, maybe better as []struct{RuntimeHooks, FailurePolicy}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

each RuntimeHookType may have different FailurePolicyType, maybe better as []struct{RuntimeHooks, FailurePolicy}

let's make protocol simple here.
RuntimeHookServer can use different FailurePolicyType for different hooks by:
set FailurePolicy to 'Failure' and control grpc response code to nil or error on HookServer side.

@codecov-commenter
Copy link

Codecov Report

Merging #100 (36bcfb9) into main (ccd8ff7) will increase coverage by 3.52%.
The diff coverage is n/a.

❗ Current head 36bcfb9 differs from pull request most recent head dcef664. Consider uploading reports for the commit dcef664 to get more accurate results

@@            Coverage Diff             @@
##             main     #100      +/-   ##
==========================================
+ Coverage   40.66%   44.19%   +3.52%     
==========================================
  Files          66       73       +7     
  Lines        5144     5965     +821     
==========================================
+ Hits         2092     2636     +544     
- Misses       2804     3036     +232     
- Partials      248      293      +45     
Flag Coverage Δ
unittests 44.19% <ø> (+3.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/util/system/common.go 52.38% <0.00%> (-43.28%) ⬇️
pkg/util/system/cgroup.go 70.00% <0.00%> (-9.55%) ⬇️
pkg/util/container.go 26.81% <0.00%> (-2.56%) ⬇️
pkg/util/config.go 0.00% <0.00%> (ø)
pkg/koordlet/resmanager/memory_evict.go 0.00% <0.00%> (ø)
pkg/tools/cache/expiration_cache.go 70.90% <0.00%> (ø)
pkg/util/system/lscpu.go 0.00% <0.00%> (ø)
pkg/util/system/cgroup_resource.go 0.00% <0.00%> (ø)
pkg/koordlet/resmanager/cpu_burst.go 77.53% <0.00%> (ø)
pkg/koordlet/resmanager/types.go 41.53% <0.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccd8ff7...dcef664. Read the comment docs.

Signed-off-by: pengyang.hpy <honpey@gmail.com>
@zwzhang0107
Copy link
Contributor

/lgtm

@hormes
Copy link
Member

hormes commented Apr 27, 2022

/approve

@koordinator-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hormes

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@jasonliu747 jasonliu747 left a comment

Choose a reason for hiding this comment

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

/lgtm

@koordinator-bot koordinator-bot bot merged commit 429953e into koordinator-sh:main Apr 27, 2022
@honpey honpey deleted the runtime-dev branch April 28, 2022 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants