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

kubeadm/join: expose the KubeConfigPath() method to joinData #74277

Merged
merged 1 commit into from
Feb 20, 2019

Conversation

neolit123
Copy link
Member

@neolit123 neolit123 commented Feb 20, 2019

What this PR does / why we need it:

This fixes the following error:
"error execution phase control-plane-join/etcd:
control-plane-join phase invoked with an invalid data struct"

The problem here is that joinData cannot be type-asserted
to the interface type under controlplanejoin.go (controlPlaneJoinData)
because joinData lacks KubeConfigPath.

Given we use KubeConfigPath in more than one place for join
it makes sense to define the method and make it return:
kubeadmconstants.GetAdminKubeConfigPath()

Which issue(s) this PR fixes:

NONE

Special notes for your reviewer:
https://k8s-testgrid.appspot.com/sig-cluster-lifecycle-all#kubeadm-kind-master

Does this PR introduce a user-facing change?:

NONE

/kind bug
/priority critical-urgent
cc @fabriziopandini @RA489
cc @kubernetes/sig-cluster-lifecycle-pr-reviews

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubeadm labels Feb 20, 2019
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
thank you, one minor typo in a comment

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 20, 2019
@ereslibre
Copy link
Contributor

ereslibre commented Feb 20, 2019

This removal was fine, the problem is that the interface in controlplanejoin.go was not adapted, nor the code there after removing this unneeded method in join.go, so:

Removing KubeConfigPath function from the interface in the controlPlaneJoinData will allow the cast to happen, with the removal of KubeConfigPath on join.go as well (basically reverting this patch).

Then, all references on this phase need adapting and calling directly to kubeadmconstants.GetAdminKubeConfigPath() instead:

kubeConfigFile := data.KubeConfigPath()

kubeConfigFile := data.KubeConfigPath()

kubeConfigFile := data.KubeConfigPath()

The problem was that KubeConfigPath() was removed from join.go but not adapted in controlplanejoin.go afterwards, so the cast fails because joinData does not implement the required KubeConfigPath function in the controlPlaneJoinData interface: all of them should be removed and use kubeadmconstants.GetAdminKubeConfigPath() instead.

cc/ @neolit123 @fabriziopandini @rosti @RA489

@neolit123
Copy link
Member Author

neolit123 commented Feb 20, 2019

/retest

the cast fails because joinData does not implement the required KubeConfigPath function in the controlPlaneJoinData interface: all of them should be removed and use kubeadmconstants.GetAdminKubeConfigPath() instead.

@ereslibre given the kubeconfig is used in more than one place in join.go and controlplanejoin.go i think it's fine to have the public joinData.KubeConfigPath() helper even if it only returns kubeadmconstants.GetAdminKubeConfigPath()

This fixes the following error:
"error execution phase control-plane-join/etcd:
control-plane-join phase invoked with an invalid data struct"

The problem here is that joinData cannot be type-asserted
to the interface type under controlplanejoin.go (controlPlaneJoinData)
because joinData lacks KubeConfigPath.

Given we use KubeConfigPath in more than one place for join
it makes sense to define define the method and make it return:
kubeadmconstants.GetAdminKubeConfigPath()
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 20, 2019
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neolit123 thanks for the quick investigation on this problem
Eventually we will reconsider this in the audit of join phases
/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 20, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini, neolit123

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

@k8s-ci-robot k8s-ci-robot merged commit b0f6857 into kubernetes:master Feb 20, 2019
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. area/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants