-
Notifications
You must be signed in to change notification settings - Fork 240
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 an option for tasks to mutate the State object #2528
Conversation
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
/cherrypick release/v1.5 |
@xmudrii: once the present PR merges, I will cherry-pick it on top of release/v1.5 in a new PR and assign it to you. In response to this:
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. |
/cherrypick release/v1.4 |
@xmudrii: once the present PR merges, I will cherry-pick it on top of release/v1.4 in a new PR and assign it to you. In response to this:
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. |
LGTM label has been added. Git tree hash: 1a19b608c6e286857a15e6661488b6f400eb85cb
|
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahmedwaleedmalik 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 |
@xmudrii: new pull request created: #2529 In response to this:
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. |
@xmudrii: #2528 failed to apply on top of branch "release/v1.4":
In response to this:
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. |
What this PR does / why we need it:
We have a task to determine the pause image by asking kubeadm what pause image we should use:
kubeone/pkg/tasks/kubeadm_config.go
Lines 30 to 54 in 5a489d6
The output from kubeadm is taken and the State object is updated by using
state.PauseImage = ...
. However, that doesn't work because when running a task, we're creating a shallow copy of the State object and we use that one for running the task:kubeone/pkg/state/task.go
Line 67 in 5a489d6
Copying the State object is required because we might be running a task concurrently and multiple goroutines editing the same struct concurrently is never a good idea. But we still need a way to mutate the State from a task, for example, in this case, the only way to get the pause image is to ask kubeadm.
This issue is addressed by adding a state mutator function to the task executor (
RunTaskOnNodes
). This mutator function is guarded with a mutex so that it's safe to run it concurrently. This PR also integrates this mutator into a task responsible for getting the pause image, so this is now supposed to work properly.What type of PR is this?
/kind bug
Does this PR introduce a user-facing change? Then add your Release Note here:
Documentation: