-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
rootless: fail early if prerequiresites are not satisfied #2129
rootless: fail early if prerequiresites are not satisfied #2129
Conversation
Hi @AkihiroSuda. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -66,6 +66,11 @@ type ClusterOptions struct { | |||
|
|||
// Cluster creates a cluster | |||
func Cluster(logger log.Logger, p providers.Provider, opts *ClusterOptions) error { | |||
// validate provider first | |||
if err := validateProvider(p); err != nil { |
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.
@BenTheElder I don't know if we should validate it only on create cluster
or always in DetectNodeProvider()
,
Lines 95 to 118 in 5b79090
// DetectNodeProvider allows callers to autodetect the node provider | |
// *without* fallback to the default. | |
// | |
// Pass the returned ProviderOption to NewProvider to pass the auto-detect Docker | |
// or Podman option explicitly (in the future there will be more options) | |
// | |
// NOTE: The kind *cli* also checks `KIND_EXPERIMENTAL_PROVIDER` for "podman" or | |
// "docker" currently and does not auto-detect / respects this if set. | |
// | |
// This will be replaced with some other mechanism in the future (likely when | |
// podman support is GA), in the meantime though your tool may wish to match this. | |
// | |
// In the future when this is not considered experimental, | |
// that logic will be in a public API as well. | |
func DetectNodeProvider() (ProviderOption, error) { | |
// auto-detect based on each node provider's IsAvailable() function | |
if docker.IsAvailable() { | |
return ProviderWithDocker(), nil | |
} | |
if podman.IsAvailable() { | |
return ProviderWithPodman(), nil | |
} | |
return nil, errors.WithStack(NoNodeProviderDetectedError) | |
} |
we currently have <provider>.IsAvailable()
Should it be <provider>.IsAvailableAndValid()
?
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.
I added this validation to create.go
because deletion should not require this validation.
When a user booted the host with cgroup v2, created a rootless kind cluster, and then rebooted with cgroup v1 for running some other apps that do not support cgroup v2, the user still want to be able to remove the kind cluster.
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.
my comment is more about the long term solution, Ben always wanted to model the providers API (as you can see in the comment that I pasted above)
So I'm wondering if this is the time to do it, to avoid start to grow it organically, 👍
When a user booted the host with cgroup v2, created a rootless kind cluster, and then rebooted with cgroup v1 for running some other apps that do not support cgroup v2, the user still want to be able to remove the kind cluster.
we should also start to think in what is supported , that is an interesting use case
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.
I failed to click submit on my comment earlier it seems ...
Delete should not require validation indeed, the validation is wether the tagged resource exists.
It's fine for this to grow somewhat organically internally for now, we can create a better API in the future and consider it exporting it once we have a better idea what we need. It's the public APIs that we need to be more careful with (because people already depend on them and we can't refactor them easily, so we need to make any changes minimally difficult to deal with / not really remove APIs etc.). We can completely rewrite our own internal usage. I'm going to take a sledgehammer to the "actions" thing when I get some freetime someday, and the node build code ...
e21174c
to
4d7e6c9
Compare
/ok-to-test |
4d7e6c9
to
ba7e05f
Compare
ba7e05f
to
c3f2463
Compare
/retest |
/lgtm |
/test pull-kind-e2e-kubernetes-1-20 |
/test pull-kind-e2e-kubernetes |
@BenTheElder PTAL? |
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.
thanks, sorry I've been prioritizing bug fixes & test coverage (k8s release cycle spilling over everywhere)
Rootless: os.Geteuid() != 0, | ||
Rootless: euid != 0, | ||
} | ||
if _, err := os.Stat("/sys/fs/cgroup/cgroup.controllers"); err == nil { |
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.
this is going to bite us someday when someone requests remote podman 🙃
(not a blocker I think, but leaving a breadcrumb @aojea)
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.
I think that will be a future work, and probably needs some work on Podman side.
@@ -347,8 +349,45 @@ func (p *provider) CollectLogs(dir string, nodes []nodes.Node) error { | |||
|
|||
// Info returns the provider info. | |||
func (p *provider) Info() (*providers.ProviderInfo, error) { |
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.
we should probably note that this is cached.
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.
this can not change on runtime, right?
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.
Added a comment line about that.
this can not change on runtime, right?
Right
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AkihiroSuda, BenTheElder 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 |
/test pull-kind-e2e-kubernetes |
1 similar comment
/test pull-kind-e2e-kubernetes |
/retest |
something is going on with lots of timeout and failures lately |
`kind create cluster` now prints errors before running the containers. Signed-off-by: Akihiro Suda <[email protected]>
c3f2463
to
9a292c3
Compare
/retest |
/lgtm |
/retest |
kind create cluster
now prints errors before running the containers.