Skip to content
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

Fix image related bugs when enabling addons #15984

Merged
merged 2 commits into from
Mar 10, 2023

Conversation

spowelljr
Copy link
Member

Bug 1

In SelectAndPersistImages we have if viper.IsSet(config.AddonImages) and if viper.IsSet(config.AddonRegistries). However, in cmd we have viper.Set(config.AddonImages, images) and viper.Set(config.AddonRegistries, registries) so viper.IsSet is always true and more advanced logic is being performed when not needed. To resolve this I wrapped the viper.Set lines with if <var> != "" { as it doesn't make sense to set the variable if it's empty.

Bug 2

In SelectAndPersistImages if an addon image was passed via flag but the image isn't used in the addon we're enabling we would output the message Ignoring unknown custom image {{.name}} but we didn't strip it from the map, so it was actually getting saved to the cluster config even though we said we were ignoring it. Resolved this by removing the image from the map if we encounter this.

Bug 3

Saved custom images were being ignored if a different image was being passed via flag. Example, image1 one is saved to the cluster config already, addon is enabled and image2 is passed a custom image via flag, image1 custom image will be ignored and and will use default image while image2 use the custom image as expected. This was resolved by replacing images = overrideDefaults(addonDefaultImages, newImages) with images = overrideDefaults(images, newImages).

Bug 4

Existing custom registries saved to the cluster config were getting stripped when a new custom registry was passed via flag while SelectAndPersistImages was returning the existing custom registry. Resolved this so now the existing custom registry is not being stripped and what's being returned from SelectAndPersistImages matches what is stored in the cluster config.

Also added in-depth tests for SelectAndPersistImages.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 6, 2023
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 6, 2023
@spowelljr
Copy link
Member Author

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Mar 7, 2023
@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 15984) |
+----------------+----------+---------------------+
| minikube start | 54.8s    | 56.6s               |
| enable ingress | 27.5s    | 28.3s               |
+----------------+----------+---------------------+

Times for minikube start: 51.6s 54.9s 56.9s 56.3s 54.2s
Times for minikube (PR 15984) start: 56.4s 57.2s 56.8s 56.9s 55.5s

Times for minikube ingress: 24.8s 29.8s 25.8s 28.8s 28.3s
Times for minikube (PR 15984) ingress: 28.8s 28.7s 28.3s 26.3s 29.3s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 15984) |
+----------------+----------+---------------------+
| minikube start | 26.5s    | 26.6s               |
| enable ingress | 22.4s    | 21.9s               |
+----------------+----------+---------------------+

Times for minikube start: 25.6s 26.2s 27.4s 25.8s 27.7s
Times for minikube (PR 15984) start: 26.4s 25.9s 26.4s 27.4s 27.1s

Times for minikube ingress: 22.6s 23.1s 23.1s 22.1s 21.1s
Times for minikube (PR 15984) ingress: 21.1s 21.6s 22.1s 22.1s 22.7s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 15984) |
+----------------+----------+---------------------+
| minikube start | 23.3s    | 23.5s               |
| enable ingress | 35.2s    | 32.2s               |
+----------------+----------+---------------------+

Times for minikube (PR 15984) start: 22.8s 23.5s 23.0s 24.2s 24.1s
Times for minikube start: 23.2s 23.4s 23.4s 23.6s 23.1s

Times for minikube ingress: 32.6s 31.6s 31.7s 32.6s 47.6s
Times for minikube (PR 15984) ingress: 31.6s 32.6s 32.6s 31.6s 32.6s

@minikube-pr-bot
Copy link

These are the flake rates of all failed tests.

Environment Failed Tests Flake Rate (%)
none_Linux TestFunctional/parallel/ServiceCmd/DeployApp (gopogh) n/a
none_Linux TestFunctional/parallel/ServiceCmd/Format (gopogh) n/a
none_Linux TestFunctional/parallel/ServiceCmd/HTTPS (gopogh) n/a
none_Linux TestFunctional/parallel/ServiceCmd/JSONOutput (gopogh) n/a
none_Linux TestFunctional/parallel/ServiceCmd/List (gopogh) n/a
none_Linux TestFunctional/parallel/ServiceCmd/URL (gopogh) n/a
Hyper-V_Windows TestNetworkPlugins/group/bridge/Start (gopogh) 4.17 (chart)
Hyper-V_Windows TestFunctional/parallel/ImageCommands/ImageLoadDaemon (gopogh) 49.32 (chart)
Hyper-V_Windows TestFunctional/parallel/ImageCommands/ImageLoadFromFile (gopogh) 49.32 (chart)
Hyper-V_Windows TestFunctional/parallel/ImageCommands/ImageReloadDaemon (gopogh) 49.32 (chart)
Hyper-V_Windows TestFunctional/parallel/ImageCommands/ImageSaveDaemon (gopogh) 49.32 (chart)
Hyper-V_Windows TestFunctional/parallel/ImageCommands/ImageSaveToFile (gopogh) 49.32 (chart)
Hyper-V_Windows TestFunctional/parallel/ImageCommands/ImageTagAndLoadDaemon (gopogh) 49.32 (chart)
Hyper-V_Windows TestFunctional/parallel/ImageCommands/Setup (gopogh) 49.32 (chart)
Hyper-V_Windows TestNoKubernetes/serial/StartWithK8s (gopogh) 56.16 (chart)
Hyper-V_Windows TestRunningBinaryUpgrade (gopogh) 72.60 (chart)
Hyper-V_Windows TestStoppedBinaryUpgrade/Upgrade (gopogh) 83.56 (chart)
Docker_Linux TestMultiNode/serial/DeployApp2Nodes (gopogh) 100.00 (chart)
Docker_Linux TestMultiNode/serial/PingHostFrom2Pods (gopogh) 100.00 (chart)
Docker_macOS TestIngressAddonLegacy/serial/ValidateIngressAddonActivation (gopogh) 100.00 (chart)
Docker_macOS TestIngressAddonLegacy/serial/ValidateIngressAddons (gopogh) 100.00 (chart)
Docker_macOS TestIngressAddonLegacy/serial/ValidateIngressDNSAddonActivation (gopogh) 100.00 (chart)
Docker_macOS TestIngressAddonLegacy/StartLegacyK8sCluster (gopogh) 100.00 (chart)
Docker_macOS TestKubernetesUpgrade (gopogh) 100.00 (chart)
Docker_macOS TestMissingContainerUpgrade (gopogh) 100.00 (chart)
Docker_macOS TestMultiNode/serial/DeployApp2Nodes (gopogh) 100.00 (chart)
Docker_macOS TestMultiNode/serial/PingHostFrom2Pods (gopogh) 100.00 (chart)
Docker_macOS TestRunningBinaryUpgrade (gopogh) 100.00 (chart)
Docker_macOS TestStartStop/group/old-k8s-version/serial/AddonExistsAfterStop (gopogh) 100.00 (chart)
Docker_macOS TestStartStop/group/old-k8s-version/serial/DeployApp (gopogh) 100.00 (chart)
More tests... Continued...

Too many tests failed - See test logs for more details.

To see the flake rates of all tests by environment, click here.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: medyagh, spowelljr

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@spowelljr spowelljr merged commit 50b0730 into kubernetes:master Mar 10, 2023
@spowelljr spowelljr deleted the fixAddons branch March 10, 2023 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants