-
Notifications
You must be signed in to change notification settings - Fork 41.6k
refactor(kubeadm): including dns addon version to signature #134847
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
base: master
Are you sure you want to change the base?
refactor(kubeadm): including dns addon version to signature #134847
Conversation
|
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
|
Hi @prometherion. Thanks for your PR. I'm waiting for a github.com 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-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: prometherion 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 |
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 this is generally fine @prometherion
added a few comments.
/ok-to-test
| clientset "k8s.io/client-go/kubernetes" | ||
| "k8s.io/klog/v2" | ||
|
|
||
| versionutil "k8s.io/apimachinery/pkg/util/version" |
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.
is this needed?
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.
It was ready there:
| versionutil "k8s.io/apimachinery/pkg/util/version" |
|
|
||
| func (f *fakeVersionGetter) DNSAddonVersion() (string, error) { | ||
| return dns.DeployedDNSAddon(f.client) | ||
| } |
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 be at the bottom of the list of methods.
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.
instead of creating a client, this fake getter should just return a 'faked string' version for coredns like the rest of the methods 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.
We can't, since we have a test case which requires a failure (get stable version from CI label failed)
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.
the negative case can be simulated with a 'returnError bool` field from the feke version getter struct.
i think it's more consistent if you drop the fake client and return strings / fake errors.
| kubeletVersion: v1Y0.String(), | ||
| kubeadmVersion: v1Y0.String(), | ||
| etcdVersion: fakeCurrentEtcdVersion, | ||
| client: fakeClient, |
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.
then here it could be just a string version instead of the client, IIUC.
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.
Given that we were using a client with the previous implementation, I kept the original test behaviour without changing its logic. We can refactor the entire suite if you prefer by returning the version and the error. However, this client simulates scenarios with multiple CoreDNS installations; in such cases, the upgrade computation should fail.
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.
any missing cases for the DNS getter should be added in TestDeployedDNSAddon, IMO
7fb2977 to
aae5e3e
Compare
aae5e3e to
37e7b39
Compare
Signed-off-by: Dario Tranchitella <[email protected]>
37e7b39 to
4551366
Compare
What type of PR is this?
/kind feature
What this PR does / why we need it:
Although
kubeadmhas not been designed to run as a library, the code base can still be imported and used via public functions.The
kubeadmfunctionGetAvailableUpgradescan be used to extract the available upgrades for the given Control Plane, and it allows some mocking using theVersionGetterinterface, which allows extensibility (e.g.: in case of air-gapped environments, or the need to interact with specific network desigs).The
VersionGetteralready reports the following signatures:ClusterVersionKubeadmVersionVersionFromCILabelKubeletVersionsComponentVersionsSome of the functions must interact with the API Server to extract information, and having them wrapped in an interface is vital; however, the
GetAvailableUpgradesis not providing any interface to extract the CoreDNS version.kubernetes/cmd/kubeadm/app/phases/upgrade/compute.go
Lines 148 to 151 in 8cd57a9
The proposed changes extend the signature for the
VersionGettersince it's responsible for retrieving component versions, and CoreDNS/DNS is part of those.A positive outcome for implementing this would be able to reuse the function
GetAvailableUpgradesby implementing a newVersionGetterwhen the state for the given cluster has been "frozen" (e.g.: Control Plane scaled to zero): otherwise, afakeClientshould be used since it's injected currently from the function signature, and it's just used for such a purpose. Thus, we could decrease the number of arguments and achieve more elegance and maintainability in the code.Which issue(s) this PR is related to:
None
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
NONE