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

🏃 Implement conformance test via e2e test framework #782

Conversation

sbueringer
Copy link
Member

@sbueringer sbueringer commented Mar 13, 2021

This PR refactors our conformance test to use the cluster-api test framework.
It doesn't introduce additional e2e tests yet, but after this PR this will be fairly easy.
I just didn't want to make the PR even bigger.

I also synced the Makefiles with the ones from AWS .

Notes:

xref: #577

/hold

@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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 13, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 13, 2021
@sbueringer sbueringer force-pushed the caas/sbuerin/capi-prow-e2e-tests branch from 8273622 to 7054730 Compare March 15, 2021 14:25
@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 15, 2021

Build failed.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 16, 2021

Build failed.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 16, 2021

Build failed.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 16, 2021

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 16, 2021

Build failed.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

1 similar comment
@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 16, 2021

Build failed.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

2 similar comments
@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 17, 2021

Build failed.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 17, 2021

Build failed.

@sbueringer
Copy link
Member Author

@hidekazuna @prankul88 do you want to review this PR or should we just go ahead? :) It's mostly just about test code

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 24, 2021
@sbueringer sbueringer force-pushed the caas/sbuerin/capi-prow-e2e-tests branch from 1d6e07d to bade7b9 Compare March 24, 2021 05:05
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 24, 2021
@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

@@ -3,7 +3,6 @@ apiVersion: cluster.x-k8s.io/v1alpha4
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
namespace: '${NAMESPACE}'
Copy link
Contributor

Choose a reason for hiding this comment

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

This was added with #735
@sbueringer I hope it does not conflict with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I dropped it because it isn't needed. The namespaces of all CAPI resources are set even without it and our cloudsSecret.namespace defaults to the same namespace as our other resources. Actually are e2e tests are using this because they are deploying to a random generated namespace (the e2e test with multiple flavors from my other PR even 2 clusters at the same time in different namespaces)

Copy link
Contributor

@hidekazuna hidekazuna Mar 24, 2021

Choose a reason for hiding this comment

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

Yes, CAPO works without this. Only I followed CAPI recommendation
https://cluster-api.sigs.k8s.io/clusterctl/provider-contract.html#common-variables

I thought someone uses multi cloud provider and they wonder they can not use --target-namespace for CAPO.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it was okay that we had it before. My interpretation of the documentation is (now):

  • If you have places in you're YAML were you need the target namespace, you can/should use this variable. It is not necessary to use it for the metadata.namespace field as that is set by CAPI in any case

I looked at CAPG / CAPA / CAPZ / CAPV and I only could find it in CAPV. As it's not necessary and most of the other providers are not using it I thought it's cleaner to drop it.

@prankul88
Copy link
Contributor

LGTM !! Thankyou

@sbueringer
Copy link
Member Author

/test ?

@k8s-ci-robot
Copy link
Contributor

@sbueringer: The following commands are available to trigger jobs:

  • /test pull-cluster-api-provider-openstack-build
  • /test pull-cluster-api-provider-openstack-test
  • /test pull-cluster-api-provider-openstack-e2e-test
  • /test pull-cluster-api-provider-openstack-conformance-test

Use /test all to run the following jobs:

  • pull-cluster-api-provider-openstack-build
  • pull-cluster-api-provider-openstack-test

In response to this:

/test ?

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.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-conformance-test

In case anybody is wondering because the test failed, it's because of a race condition of ssh tunneling and cluster deletion. I fixed this here in the other PR:

defer timeoutCancel()
go func() {
<-timeout.Done()
bastionConn.Close()
}()
conn, err := bastionConn.Dial("tcp", fmt.Sprintf("%s:22", machineIP))
if err != nil {
_, _ = fmt.Fprintf(GinkgoWriter, "couldn't connect from the bastion host %s to the target instance %s: %s\n", bastionIP, machineIP, err)
return
}
defer conn.Close()

I wouldn't backport it as it happens frequently and I expect we will merge the other PR pretty soon, too.

Comment on lines +155 to +166
apiVersion: addons.cluster.x-k8s.io/v1alpha4
kind: ClusterResourceSet
metadata:
name: "${CLUSTER_NAME}-crs-0"
spec:
strategy: ApplyOnce
clusterSelector:
matchLabels:
cni: "${CLUSTER_NAME}-crs-0"
resources:
- name: "cni-${CLUSTER_NAME}-crs-0"
kind: ConfigMap
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to update templates to use ClusterResourceSet in templates directory as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should keep it as is. In almost all of the templates of the other providers it is only used for testing. I think it would break the quickstart documentation to change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I found ClusterResourceSet is still experimental, after GA we would use it in templates.

Comment on lines +51 to +63
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is noisy.. I am not familiar with law, but do we really need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

The copyright header?

I would keep it as is for now. But, I wanted to do a follow-up anyway to get rid of the whole /usr/local/bin/ci-artifacts.sh file in this YAML anyway. There are some reasons why we are not using the upstream function to add this functionality:

  1. they are using gsutil instead of curl. Thus they install google cloud sdk first which adds ~3-5 minutes to to node startup in our environment (probably in all environments)
  2. they are also pulling the "kube-apiserver" "kube-controller-manager" "kube-scheduler" for worker nodes, which is not necessary and also adds time to the test
    3/ when we use the upstream method to patch our KubeadmControlPlane and KubeadmConfigTemplate to add the /usr/local/bin/ci-artifacts.shscript we will lose the/etc/kubernetes/cloud.confand/etc/certs/cacertfiles because the wholefiles` array is overwritten. This is a limitation of kustomize, but I assume with the fixes merged to kustomize a week ago we are able to improve this (Strategic merge support for CRDs kustomize#2825) (although it's not completely trivial)

I wanted to do a follow-up to improve all those things in the cluster-api util func GenerateCIArtifactsInjectedTemplateForDebian I currently copied into tmp_template.go and then drop this in our repo. I think until know I would like to keep the diff as small as possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

I opened a issue for it here: #804

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, understand.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-make-conformance

/hold

@hidekazuna Would be nice if you can take a look and lgtm in case you agree with my comments. Thank you :)

I would merge after your lgtm and a successful test-run. I rebased onto master because of a conflict in hack/tools/go.mod

@k8s-ci-robot
Copy link
Contributor

@sbueringer: The specified target(s) for /test were not found.
The following commands are available to trigger jobs:

  • /test pull-cluster-api-provider-openstack-build
  • /test pull-cluster-api-provider-openstack-test
  • /test pull-cluster-api-provider-openstack-e2e-test
  • /test pull-cluster-api-provider-openstack-conformance-test

Use /test all to run the following jobs:

  • pull-cluster-api-provider-openstack-build
  • pull-cluster-api-provider-openstack-test

In response to this:

/test pull-cluster-api-provider-openstack-make-conformance

/hold

@hidekazuna Would be nice if you can take a look and lgtm in case you agree with my comments. Thank you :)

I would merge after your lgtm and a successful test-run. I rebased onto master because of a conflict in hack/tools/go.mod

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.

@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 Mar 25, 2021
@sbueringer
Copy link
Member Author

/test pull-cluster-api-provider-openstack-conformance-test

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Mar 25, 2021

@sbueringer: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-cluster-api-provider-openstack-make-conformance bade7b9 link /test pull-cluster-api-provider-openstack-make-conformance

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@sbueringer
Copy link
Member Author

sbueringer commented Mar 25, 2021

/test pull-cluster-api-provider-openstack-conformance-test

(let's see if it reoccurs, pretty much had 100% stable tests before the last rebase)

@hidekazuna
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 25, 2021
@sbueringer
Copy link
Member Author

/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 Mar 25, 2021
@k8s-ci-robot k8s-ci-robot merged commit 2456b1a into kubernetes-sigs:master Mar 25, 2021
@sbueringer sbueringer deleted the caas/sbuerin/capi-prow-e2e-tests branch March 26, 2021 06:05
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants