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

kubetest: add "KubectlCommand" to "deployer" interface #10216

Merged
merged 5 commits into from
Nov 30, 2018
Merged

kubetest: add "KubectlCommand" to "deployer" interface #10216

merged 5 commits into from
Nov 30, 2018

Conversation

gyuho
Copy link
Member

@gyuho gyuho commented Nov 22, 2018

For kubernetes/kubernetes#71322 and https://github.com/aws/aws-k8s-tester.

  • Update EKS test plugin vendor to configure kubectl download path
  • Use that download path to configure "kubectl version" commands in e2e tests

Our issue was that all e2e tests were failing as below:

W1121 23:44:50.939] 2018/11/21 23:44:50 main.go:312: Something went wrong: encountered 2 errors: [error during ./cluster/kubectl.sh --match-server-version=false version: exit status 1 error during ./hack/ginkgo-e2e.sh --ginkgo.focus=[Conformance] --ginkgo.skip=[Slow]|[Serial]|[Disruptive]|[Flaky]|[Feature:.+] --minStartupPods=8 --report-dir=/workspace/_artifacts --disable-log-dump=true: exit status 1]

And this Something went wrong error happens when

test-infra/kubetest/main.go

Lines 406 to 408 in db6a12c

if err := run(deploy, *o); err != nil {
return err
}

ref. #9814

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 22, 2018
@k8s-ci-robot k8s-ci-robot added the area/config Issues or PRs related to code in /config label Nov 22, 2018
@gyuho
Copy link
Member Author

gyuho commented Nov 26, 2018

@BenTheElder @krzyzacy Please review. Had to disable EKS jobs (by deleting release binaries) because getKubectlVersion kept failing for eks provider :)

@krzyzacy
Copy link
Member

how about make it into the deployer interface?

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 26, 2018
@gyuho gyuho changed the title kubetest/e2e.go: make "getKubectlVersion" configurable per provider kubetest: add "GetKubectlVersion" to deployer interface Nov 27, 2018
@gyuho
Copy link
Member Author

gyuho commented Nov 27, 2018

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 27, 2018
}
log.Print("Failed to reach api. Sleeping for 10 seconds before retrying...")
time.Sleep(10 * time.Second)
}
Copy link
Member

Choose a reason for hiding this comment

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

I would say conformance deployer should do noop?

Copy link
Member

Choose a reason for hiding this comment

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

also @BenTheElder we can probably get rid of the old dind conformance deployer?

Copy link
Member Author

Choose a reason for hiding this comment

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

@krzyzacy @BenTheElder Just removed and made it no-op in kubetest/conformance. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

yeah I don't think anyone is using the conformance deployer, I'll figure out something else for kind very soon...

}
log.Print("Failed to reach api. Sleeping for 10 seconds before retrying...")
time.Sleep(10 * time.Second)
}
Copy link
Member

Choose a reason for hiding this comment

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

this is duplicated logic.. maybe move the getKubectlVersion to util package so you can reuse it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@krzyzacy Found out that would make util package import process package, thus cyclic imports. Do you have any other suggestion?

Copy link
Member

Choose a reason for hiding this comment

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

we should probably break those up into more specific sub-packages

Copy link
Member Author

Choose a reason for hiding this comment

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

@BenTheElder Can't think of better place to put getKubectlVersion other than kubetest/e2e package. Or maybe kubetest/client?

Copy link
Member

Choose a reason for hiding this comment

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

or simply make a new package.. other deployers will need some cleanup to move to their own packages as well

@BenTheElder
Copy link
Member

Thought: what if we made the path to kubectl or a method to obtain an exec.Command to it instead? GetKubectlVersion seems like an awfully specific thing for deployers to re-implement.

@gyuho
Copy link
Member Author

gyuho commented Nov 27, 2018

@BenTheElder Good idea. Let me change GetKubectlVersion to something else and let each provider provide parameters to kubectl.

@gyuho gyuho changed the title kubetest: add "GetKubectlVersion" to deployer interface kubetest: add "KubectlArgs" to "deployer" interface Nov 27, 2018
@gyuho
Copy link
Member Author

gyuho commented Nov 27, 2018

@BenTheElder @krzyzacy Now this adds KubectlArgs to deployer interface, so that each provider configures its own parameters to test API reachability.

@gyuho
Copy link
Member Author

gyuho commented Nov 28, 2018

@BenTheElder @krzyzacy Kindly ping. Thanks!

@krzyzacy
Copy link
Member

looks sane, punt to @BenTheElder see if this matches his thoughts :-)

@@ -291,6 +291,10 @@ func (k *kubernetesAnywhere) GetClusterCreated(gcpProject string) (time.Time, er
return time.Time{}, errors.New("not implemented")
}

func (_ *kubernetesAnywhere) KubectlArgs() ([]string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

seems that KubectlArgs actually returns one of:

  • nil
  • []string{cmd, args...}

Maybe call this KubectlCommand and return an *exec.Cmd or nil
If it's nil, then kubetest can use a default via a wrapper like runKubectl, and if it's non-nil kubetest can still append to the args with Cmd.Args = append(Cmd.Args, ...)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. Let me change it :)

Copy link
Member

Choose a reason for hiding this comment

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

thanks 👍

kubetest/e2e.go Outdated
if err != nil {
return err
}
if len(args) < 1 { // no-op
Copy link
Member

Choose a reason for hiding this comment

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

probably we should default to just "kubectl" instead?

@gyuho gyuho changed the title kubetest: add "KubectlArgs" to "deployer" interface kubetest: add "KubectlCommand" to "deployer" interface Nov 29, 2018
@gyuho
Copy link
Member Author

gyuho commented Nov 30, 2018

@BenTheElder All addressed. PTAL. Thanks!

return err
}
if cmd == nil {
cmd = exec.Command("./cluster/kubectl.sh")
Copy link
Member

Choose a reason for hiding this comment

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

note to self / @krzyzacy : eventually we should stop using cluster/*.sh

I think this is indeed correct for now though of course :-)

Copy link
Member

Choose a reason for hiding this comment

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

yeah... I wonder if we should just dump the extracted kubectl into PATH or something...

Copy link
Member Author

Choose a reason for hiding this comment

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

@krzyzacy Can we get this merged first? Please let me know if there's anything else to be done here :)

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
/hold
thanks -- @krzyzacy any last comments?

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Nov 30, 2018
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 3815fe5bf7dde51367e90b7fba851139f5f60654

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, gyuho

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 30, 2018
@krzyzacy
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 30, 2018
@gyuho
Copy link
Member Author

gyuho commented Nov 30, 2018

/test pull-test-infra-verify-deps

@k8s-ci-robot k8s-ci-robot merged commit 0587c47 into kubernetes:master Nov 30, 2018
@k8s-ci-robot
Copy link
Contributor

@gyuho: Updated the job-config configmap using the following files:

  • key k8s-aws-eks-1.10.yaml using file config/jobs/kubernetes/sig-aws/eks/k8s-aws-eks-1.10.yaml

In response to this:

For kubernetes/kubernetes#71322 and https://github.com/aws/aws-k8s-tester.

  • Update EKS test plugin vendor to configure kubectl download path
  • Use that download path to configure "kubectl version" commands in e2e tests

Our issue was that all e2e tests were failing as below:

W1121 23:44:50.939] 2018/11/21 23:44:50 main.go:312: Something went wrong: encountered 2 errors: [error during ./cluster/kubectl.sh --match-server-version=false version: exit status 1 error during ./hack/ginkgo-e2e.sh --ginkgo.focus=[Conformance] --ginkgo.skip=[Slow]|[Serial]|[Disruptive]|[Flaky]|[Feature:.+] --minStartupPods=8 --report-dir=/workspace/_artifacts --disable-log-dump=true: exit status 1]

And this Something went wrong error happens when

test-infra/kubetest/main.go

Lines 406 to 408 in db6a12c

if err := run(deploy, *o); err != nil {
return err
}

ref. #9814

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.

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/config Issues or PRs related to code in /config cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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