Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Or Shoval <oshoval@redhat.com>
  • Loading branch information
oshoval committed Jul 21, 2024
1 parent ef0ec97 commit 97aa82d
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ go.work

# output dir for the hack/cluster.sh artifacts and e2e tests
.output

passt/_kubevirt
22 changes: 22 additions & 0 deletions passt/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM docker.io/library/golang:1.22 as builder

WORKDIR /workspace

COPY passt/_kubevirt/cmd/cniplugins/passt-binding/cmd/ cmd/cniplugins/passt-binding/cmd/
COPY passt/_kubevirt/cmd/cniplugins/passt-binding/pkg/ cmd/cniplugins/passt-binding/pkg/
COPY passt/_kubevirt/pkg/util/ /workspace/pkg/util/
COPY passt/_kubevirt/staging/ staging/

COPY passt/_kubevirt/go.mod go.mod
COPY passt/_kubevirt/go.sum go.sum
RUN go mod edit -replace=kubevirt.io/kubevirt/cmd/cniplugins/passt-binding/pkg/plugin=/workspace/cmd/cniplugins/passt-binding/pkg/plugin
RUN go mod edit -replace=kubevirt.io/kubevirt/pkg/util/sysctl=/workspace/pkg/util/sysctl
RUN go mod edit -replace=kubevirt.io/kubevirt/pkg/util=/workspace/pkg/util
RUN go mod download

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o network-passt-binding cmd/cniplugins/passt-binding/cmd/cni.go

FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /
RUN mkdir /cni
COPY --from=builder /workspace/network-passt-binding /cni/network-passt-binding
49 changes: 49 additions & 0 deletions passt/install-kubevirt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash -e
#
# This file is part of the KubeVirt project
#
# 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.
#
# Copyright 2024 Red Hat, Inc.
#

export KUBEVIRT_COMMIT=01c651ba0677f759220ce0fa43530477bbe8ee23

KUBEVIRT_REPO='https://github.com/kubevirt/kubevirt.git'
REPO_PATH=${REPO_PATH:-"passt/_kubevirt"}

function cluster::_get_repo() {
git --git-dir ${REPO_PATH}/.git config --get remote.origin.url
}

function cluster::_get_sha() {
git --git-dir ${REPO_PATH}/.git rev-parse HEAD
}

function cluster::install() {
if [ -d ${REPO_PATH} ]; then
if [ $(cluster::_get_repo) != ${KUBEVIRT_REPO} -o $(cluster::_get_sha) != ${KUBEVIRT_COMMIT} ]; then
rm -rf ${REPO_PATH}
fi
fi

if [ ! -d ${REPO_PATH} ]; then
git clone ${KUBEVIRT_REPO} ${REPO_PATH}
(
cd ${REPO_PATH}
git checkout ${KUBEVIRT_COMMIT}
)
fi
}

cluster::install

0 comments on commit 97aa82d

Please sign in to comment.