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

Git URL rewriting and make cluster-up (i.e. local cluster testing) #1124

Open
constcrist opened this issue Oct 14, 2022 · 3 comments
Open

Git URL rewriting and make cluster-up (i.e. local cluster testing) #1124

constcrist opened this issue Oct 14, 2022 · 3 comments
Assignees

Comments

@constcrist
Copy link

constcrist commented Oct 14, 2022

What happened:
make cluster-up would stop without properly configuring the local cluster.
Somewhere midway the installation scripts:

  1. would wipe out the cloned _kubevirtci repository, reclone it;
  2. try to access _kubevirtci/_ci-configs/k8s-1.22/.kubectl which is no longer there (maybe because it is not re-compiled?)
  3. fail

Snippet from the logs dumped by make cluster-up:

...
selecting docker as container runtime
+ [[ k8s-1.22 =~ ^(okd|ocp)-.*2865759 ]]
++ ./cluster/kubectl.sh get nodes --no-headers
++ awk '{print $1}'
Cloning into '/home/cco/go/src/github.com/kubernetes-nmstate/_kubevirtci'...
X11 forwarding request failed on channel 0
remote: Enumerating objects: 11859, done.
remote: Counting objects: 100% (106/106), done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 11859 (delta 63), reused 88 (delta 54), pack-reused 11753
Receiving objects: 100% (11859/11859), 26.41 MiB | 2.54 MiB/s, done.
Resolving deltas: 100% (6792/6792), done.
Note: switching to '2210070932-bcdea3e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at bcdea3e Update sonobuoy version to v0.56.9 (#857)
selecting docker as container runtime
/home/cco/go/src/github.com/kubernetes-nmstate/_kubevirtci/cluster-up//cluster/ephemeral-provider-common.sh: line 155: /home/cco/go/src/github.com/kubernetes-nmstate/_kubevirtci/_ci-configs/k8s-1.22/.kubectl: No such file or directory
+ echo 'Enabling and starting up openvswitch'
Enabling and starting up openvswitch
++ ./cluster/kubectl.sh get nodes --no-headers
++ awk '{print $1}'
Cloning into '/home/cco/go/src/github.com/kubernetes-nmstate/_kubevirtci'...
X11 forwarding request failed on channel 0
remote: Enumerating objects: 11859, done.
remote: Counting objects: 100% (106/106), done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 11859 (delta 63), reused 87 (delta 53), pack-reused 11753
Receiving objects: 100% (11859/11859), 26.41 MiB | 4.25 MiB/s, done.
Resolving deltas: 100% (6792/6792), done.
Note: switching to '2210070932-bcdea3e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at bcdea3e Update sonobuoy version to v0.56.9 (#857)
selecting docker as container runtime
/home/cco/go/src/github.com/kubernetes-nmstate/_kubevirtci/cluster-up//cluster/ephemeral-provider-common.sh: line 155: /home/cco/go/src/github.com/kubernetes-nmstate/_kubevirtci/_ci-configs/k8s-1.22/.kubectl: No such file or directory

I have traced this back to:

  1. git configuration on the test machine is rewriting the git URL in .gitconfig:
[url "[email protected]:"]
    insteadOf = https://github.com/
  1. the following test in the cluster/kubevirtci.sh script fails and triggers re-cloning:
function kubevirtci::install() {
    # Remove cloned kubevirtci repository if it does not match the requested one
    if [[ -d ${KUBEVIRTCI_PATH} ]]; then
        if [[ $(kubevirtci::_get_repo) != ${KUBEVIRTCI_REPO} || $(kubevirtci::_get_tag) != ${KUBEVIRTCI_TAG} ]]; then
            rm -rf ${KUBEVIRTCI_PATH}
        fi
    fi
...

As soon as I modify the KUBEVIRTCI_REPO to point to [email protected]:kubevirt/kubevirtci.git (which matches what is used on the test machine) installation works.

What you expected to happen:
Imo, ideally make cluster-up should work regardless of the git URL re-writing rules.
Maybe, at least the documentation here:
https://nmstate.io/kubernetes-nmstate/deployment/local-cluster.html
should tell the user to set-up accordingly the KUBEVIRTCI_REPO in the cluster/kubevirtci.sh script.

How to reproduce it (as minimally and precisely as possible):

  1. configure some git URL rewriting rule.
  2. do a make cluster-up

Anything else we need to know?:

Environment:

  • NodeNetworkState on affected nodes (use kubectl get nodenetworkstate <node_name> -o yaml):
  • Problematic NodeNetworkConfigurationPolicy:
  • kubernetes-nmstate image (use kubectl get pods --all-namespaces -l app=kubernetes-nmstate -o jsonpath='{.items[0].spec.containers[0].image}'):
  • NetworkManager version (use nmcli --version)
  • Kubernetes version (use kubectl version):
  • OS (e.g. from /etc/os-release):
  • Others:
@dougsland
Copy link
Contributor

/assign

@dougsland
Copy link
Contributor

dougsland commented Oct 31, 2022

@phoracek is this one working as expected or needs some work?

@phoracek
Copy link
Member

phoracek commented Nov 1, 2022

@dougsland I don't know how common is the insteadOf config, but I'd agree that the script should be resilient enough to bring up a cluster even if there is a special config in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants