-
Notifications
You must be signed in to change notification settings - Fork 377
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
Add support for setting kubelet root directory #5186
Conversation
adcc12e
to
2d7aed2
Compare
This pull request has merge conflicts that need to be resolved. |
The PR is marked as stale since no activity has been recorded in 30 days |
9f462a1
to
70ca4a0
Compare
Storage drivers and others may hardcode /var/lib/kubelet which confilicts with the k0s default /var/lib/k0s/kubelet. Allow users to override the kubelet root directory with --kubelet-root-dir similar to the way they can override --data-dir. ref: https://cep.dev/posts/adventure-trying-change-kubelet-rootdir/ fixes: k0sproject#1842 Signed-off-by: Natanael Copa <ncopa@mirantis.com>
Use --kubelet-root-dir for the inttests: - kubeletcertrotate - reset Signed-off-by: Natanael Copa <ncopa@mirantis.com>
2fba927
to
2078d84
Compare
Signed-off-by: Natanael Copa <ncopa@mirantis.com>
2078d84
to
8c30737
Compare
} | ||
kubeletRootDir, err = filepath.Abs(kubeletRootDir) | ||
if err != nil { | ||
return nil, fmt.Errorf("invalid kubeletRootDir: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filepath.Abs
can only fail if the process working directory can't be determined, so the wrapped error message is kinda misleading.
return nil, fmt.Errorf("invalid kubeletRootDir: %w", err) | |
return err |
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
c, err := NewCfgVars(tt.fakeCmd, tt.dirs...) | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.NoError(t, err) | |
require.NoError(t, err) |
c, err := NewCfgVars(tt.fakeCmd, tt.dirs...) | ||
assert.NoError(t, err) | ||
expected, err := filepath.Abs(filepath.Join(tt.expected.KubeletRootDir)) | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.NoError(t, err) | |
require.NoError(t, err) |
Description
Storage drivers and others may hard code /var/lib/kubelet which
conflicts with the k0s default /var/lib/k0s/kubelet. Allow users to
override the kubelet root directory with --kubelet-root-dir similar to
the way they can override --data-dir.
For backwards compatibility we keep the default to be
<datadir>/kubelet
.Also fix unmounting when deleting directories in
k0s reset
while at it.Fixes #1842
Fixes #4318
Type of change
How Has This Been Tested?
Checklist: