-
Notifications
You must be signed in to change notification settings - Fork 119
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
KV provider #1230
base: main
Are you sure you want to change the base?
KV provider #1230
Conversation
Hi @aerosouund. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c69b93f
to
1ff08d2
Compare
1ff08d2
to
b54838d
Compare
b54838d
to
28752d9
Compare
/test all |
28752d9
to
86c176f
Compare
I think a reason for this flake, the one where the CI job keeps waiting on the node to stop is that the node shuts down before reporting the status back to the ssh agent which makes it not know whether this happened or no this code previously looked like this _cmd(cli, nodeContainer(prefix, nodeName), "ssh.sh sudo shutdown now -h", "shutting down the node") and now it looks like this (this PR introduces this change) if err = sshClient.Command("sudo shutdown now -h"); err != nil {
return err
} which results in a golang error, since previously the error wasn't being handled
and so what i suggest we do is that we don't handle the error, i don't know if we also need to force the code to continue executing after a certain duration but this may not be necessary. since previously when ssh.sh would fail the gocli wouldn't get this failure and the CI run hangs. but since we now ssh directly its guaranteed that if there's an error you will get it I will push a commit with this suggestion |
Is this from the
|
yes, i believe so. since when it was executed through |
ea8daed
to
234e2b1
Compare
/hold |
/test check-provision-k8s-1.29 |
/test check-provision-k8s-1.31 |
/test check-provision-k8s-1.29 |
890a184
to
7b5f284
Compare
929a8f9
to
18d2f70
Compare
361171e
to
22465ce
Compare
Two new opts that represent the two scripts used in the provision phase (provision linux and provision k8s). Using go embed to include any necessary config files then run the commands on a node using libssh Signed-off-by: aerosouund <[email protected]>
The KubevirtProvider is a struct representing an arbitrary Kubevirtci running cluster. It holds all config flags and options that are in the run and provision commands. A Kubevirt provider can be created in two ways, by creating a cluster using the Start method, or from an already running cluster. For this to be possible then json representation of the struct is persisted on the dnsmasq container and later read to parse the deployed settings Or through the normal constructor which uses the option pattern to avoid a bloated function signature The logic that was previously in run.go has been split to several methods to facilitate readability and testing (runNFSGanesha, runRegistry, prepareQemuCmd, prepareDeviceMappings) and dnsmasq creation logic got moved to its own method instead of existing in its own package Floating methods such as waitForVMToBeUp, nodeNameFromIndex, nodeContainer.. etc were grouped to be methods of the struct Signed-off-by: aerosouund <[email protected]>
To avoid having to read each flag and return an error if its unset leverage the FlagMap, a map of flag name to FlagConfig. a FlagConfig is the type of this flag (string, int, uint16, bool or array of string) and the option function that sets the value of this flag on the KubevirtProvider struct. During parsing of flags this map is being iterated on and each option gets appended to an array to later be used in the KubevirtProvider constructor. The run method's role is now to parse the flags and pass them to the provider and just call Start. All the floating methods in run.go are removed after being moved to the provider. Signed-off-by: aerosouund <[email protected]>
Signed-off-by: aerosouund <[email protected]>
This functionality now exists in the KubevirtProvider type and doesn't need a package of its own Signed-off-by: aerosouund <[email protected]>
22465ce
to
01aaf22
Compare
The KubevirtProvider type is what provides the methods that run a node or run the k8s options. Testing logic has been moved to a Base Provider Suite Signed-off-by: aerosouund <[email protected]>
Signed-off-by: aerosouund <[email protected]>
…uint16 All references to ports in the codebase use uint not uint16. There is no reason to keep the ports as they are Signed-off-by: aerosouund <[email protected]>
01aaf22
to
6d52569
Compare
@aerosouund: The following tests failed, say
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-sigs/prow repository. I understand the commands that are listed here. |
@brianmcarey @dhiller @xpivarc |
PR needs rebase. 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-sigs/prow repository. |
/test check-provision-k8s-1.30 |
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 for this @aerosouund - just a couple of comments inline
/cc @xpivarc
|
||
operation := func() error { | ||
client, err = ssh.Dial("tcp", net.JoinHostPort("127.0.0.1", fmt.Sprint(s.sshPort)), s.config) | ||
return 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.
Why did you remove the more verbose error message here?
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.
That's fine, I can reintroduce it. I probably just removed it unintentionally
@@ -35,6 +37,18 @@ var _ = Describe("Node Provisioning", func() { | |||
} | |||
|
|||
k8sClient = k8s.NewTestClient(reactors...) | |||
kp = NewKubevirtProvider("k8s-1.30", "", &client.Client{}, []KubevirtProviderOption{ |
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.
Could we get k8s-1.30 dynamically from what folders are existing? This will fail when removing the k8s-1.30 provider?
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.
No its unrelated to the folder and off the top of my mind it won't fail if we drop 1.30 altogether
the version validation logic has been moved to the run command, and since this is being defined in line then it wont be obstructed by this logic
cluster-provision/gocli/cmd/run.go:143
allowedK8sVersions := []string{"k8s-1.28", "k8s-1.29", "k8s-1.30", "k8s-1.31"}
var validVersion bool
for _, v := range allowedK8sVersions {
if k8sVersion == v {
validVersion = true
}
}
if !validVersion {
return fmt.Errorf("Invalid k8s version passed, please use one of k8s-1.28, k8s-1.29, k8s-1.30 or k8s-1.31")
}
I don't think anywhere else in the code does this validation but I will double check
_, err = kp.Docker.ContainerCommit(ctx, node.ID, container.CommitOptions{ | ||
Reference: target, | ||
Comment: "PROVISION SUCCEEDED", | ||
Author: "gocli", |
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.
Should the author be "The KubeVirt Authors"?
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.
Yeah, we can change it
What this PR does / why we need it:
Create the KubevirtProvider type and make it the main entity for cluster actions
Part of: #1110
Special Notes
This branch is based off
opts
. PR: #1217it introduces the same commits but after opts gets merged it will only introduce commits of the kubevirt provider
Checklist
Release note: