Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Updated
remove_extra_resources
function used inmicrok8s reset
command to delete extra resources (e.g.,services
). As the command created in this function did not include the resources to delete and executing the command insubprocess.run
would possibly fail silently, those resources were available even after the reset (see change below).This in turn might lead and lead to unintended side-effects. For example, surviving resources caused the configuration issue described in #1823 in my local setup.
Closes #3243
References #1823
Changes
In line 235 I added the
rs
variable from thefor
loop to the creation of thecmd
variable (similar to line 128).Testing
Build and installed microk8s locally following (https://github.com/canonical/microk8s/blob/master/docs/build.md)[https://github.com/canonical/microk8s/blob/master/docs/build.md].
Created test
service
andconfigMap
using the following filesand
service
andconfigMap
in default namespace using the following commands:sudo microk8s kubectl get svc
sudo microk8s kubectl get configMaps
Executed
microk8s reset
Verified that resources were deleted as expected using command from step 3.
Possible Regressions
As changes are local to only one function of the
reset.py
script, it is believed that no other functions are impactedChecklist
Notes
As far as I could see, the
reset.py
script was not covered by unit test, however, the changes and the expected behavior was successfully tested manually as described above.