Skip to content

Commit

Permalink
bump kubvirt.io to v0.25.0
Browse files Browse the repository at this point in the history
Signed-off-by: Ram Lavi <ralavi@redhat.com>
  • Loading branch information
RamLavi committed Feb 12, 2020
1 parent da639c1 commit d1cc39a
Show file tree
Hide file tree
Showing 28 changed files with 927 additions and 1,023 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ script:
- sudo cp ./cluster/dind-cluster/kubectl /usr/bin/kubectl
- make test
- make deploy-test-cluster
- KUBECONFIG="`pwd`/cluster/dind-cluster/config" go test -timeout 60m -v -race ./tests/...
- KUBECONFIG="`pwd`/cluster/dind-cluster/config" go test -timeout 30m -v -race ./tests/...

deploy:
- provider: script
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Build the manager binary
FROM golang:1.12.12 as builder
ARG GO_VERSION
FROM golang:${GO_VERSION} as builder

# Copy in the go src
WORKDIR /go/src/github.com/k8snetworkplumbingwg/kubemacpool
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ docker-generate: docker-builder

# Build the docker image
docker-build: docker-builder
docker build . -t ${REGISTRY}/${IMG}:${IMAGE_TAG}
docker build . -t ${REGISTRY}/${IMG}:${IMAGE_TAG} --build-arg GO_VERSION=1.12.12

# Build the docker builder image
docker-builder:
docker build ${DOCKER_BUILDER_LOCATION} -t ${REGISTRY}/${IMG}:kubemacpool_builder
docker build ${DOCKER_BUILDER_LOCATION} -t ${REGISTRY}/${IMG}:kubemacpool_builder --build-arg GO_VERSION=1.12.12

# Push the docker image
docker-push:
Expand Down
13 changes: 2 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,21 @@ module github.com/k8snetworkplumbingwg/kubemacpool
go 1.12

require (
github.com/Azure/go-autorest v11.2.8+incompatible // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/containernetworking/cni v0.6.0 // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
github.com/go-logr/logr v0.1.0
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/intel/multus-cni v0.0.0-20190127194101-cd6f9880ac19
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/olekukonko/tablewriter v0.0.1 // indirect
github.com/onsi/ginkgo v1.10.1
github.com/onsi/gomega v1.7.0
github.com/openshift/custom-resource-status v0.0.0-20190822192428-e62f2f3b79f3 // indirect
github.com/prometheus/procfs v0.0.8 // indirect
github.com/qinqon/kube-admission-webhook v0.3.0
k8s.io/api v0.18.0-alpha.2
k8s.io/apiextensions-apiserver v0.17.2 // indirect
k8s.io/apimachinery v0.18.0-alpha.2
k8s.io/client-go v11.0.0+incompatible
k8s.io/code-generator v0.18.0-alpha.2
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a // indirect
k8s.io/utils v0.0.0-20200109141947-94aeca20bf09 // indirect
kubevirt.io/client-go v0.20.4
kubevirt.io/containerized-data-importer v1.10.6 // indirect
kubevirt.io/kubevirt v0.20.4
kubevirt.io/client-go v0.25.0
kubevirt.io/kubevirt v0.25.0
sigs.k8s.io/controller-runtime v0.4.0
sigs.k8s.io/controller-tools v0.2.4
)
Expand Down
37 changes: 20 additions & 17 deletions go.sum

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions hack/deploy-test-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ kubectl config view --raw > ./cluster/dind-cluster/config
./cluster/dind-cluster/kubectl create -f https://github.com/kubevirt/kubevirt/releases/download/v0.20.4/kubevirt-operator.yaml
./cluster/dind-cluster/kubectl create -f https://github.com/kubevirt/kubevirt/releases/download/v0.20.4/kubevirt-cr.yaml

REGISTRY="localhost:5000" make docker-generate
if [[ -n "$(git status --porcelain)" ]] ; then echo "It seems like you need to run make. Please run it and commit the changes"; git status --porcelain; false; fi

# Build kubemacpool
REGISTRY="localhost:5000" make docker-build
REGISTRY="localhost:5000" make docker-push

REGISTRY="localhost:5000" make docker-generate
if [[ -n "$(git status --porcelain)" ]] ; then echo "It seems like you need to run make. Please run it and commit the changes"; git status --porcelain; false; fi

# wait for cluster operator
./cluster/dind-cluster/kubectl wait networkaddonsconfig cluster --for condition=Available --timeout=800s

Expand Down
3 changes: 2 additions & 1 deletion hack/docker-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM golang:1.12.12
ARG GO_VERSION
FROM golang:${GO_VERSION}

RUN apt-get clean && apt-get update && apt-get install -y unzip && apt-get upgrade -y

Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package controller

import (
"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
"sigs.k8s.io/controller-runtime/pkg/manager"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
)

// AddToManagerFuncs is a list of functions to add all Controllers to the Manager
Expand Down
5 changes: 3 additions & 2 deletions pkg/controller/pod/pod_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"github.com/intel/multus-cni/logging"
"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -31,6 +30,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
"sigs.k8s.io/controller-runtime/pkg/source"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
)

var log = logf.Log.WithName("Pod Controller")
Expand Down Expand Up @@ -81,7 +82,7 @@ func (r *ReconcilePolicy) Reconcile(request reconcile.Request) (reconcile.Result
if errors.IsNotFound(err) {
err := r.poolManager.ReleasePodMac(fmt.Sprintf("%s/%s", request.Namespace, request.Name))
if err != nil {
logging.Errorf("failed to release mac for pod %s: %v", request.NamespacedName, err)
logging.Printf(logging.ErrorLevel, "failed to release mac for pod %s: %v", request.NamespacedName, err)
}
return reconcile.Result{}, nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/virtualmachine/virtualmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ import (

"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
kubevirt "kubevirt.io/client-go/api/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
"sigs.k8s.io/controller-runtime/pkg/source"

pool_manager "github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
helper "github.com/k8snetworkplumbingwg/kubemacpool/pkg/utils"
kubevirt "kubevirt.io/client-go/api/v1"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
)

var log = logf.Log.WithName("VirtualMachine Controller")
Expand Down
7 changes: 4 additions & 3 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ import (
"time"

"github.com/go-logr/logr"
"github.com/k8snetworkplumbingwg/kubemacpool/pkg/controller"
poolmanager "github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
"github.com/k8snetworkplumbingwg/kubemacpool/pkg/webhook"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/leaderelection"
kubevirt_api "kubevirt.io/client-go/api/v1"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/manager"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/controller"
poolmanager "github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
"github.com/k8snetworkplumbingwg/kubemacpool/pkg/webhook"
)

var log logr.Logger
Expand Down
3 changes: 2 additions & 1 deletion pkg/webhook/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import (
"encoding/json"
"net/http"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
webhookserver "github.com/qinqon/kube-admission-webhook/pkg/webhook/server"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
)

var log = logf.Log.WithName("Webhook mutatepods")
Expand Down
4 changes: 2 additions & 2 deletions pkg/webhook/virtualmachine/virtualmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"net/http"
"reflect"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
webhookserver "github.com/qinqon/kube-admission-webhook/pkg/webhook/server"
admissionv1beta1 "k8s.io/api/admission/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -32,6 +31,8 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
)

var log = logf.Log.WithName("Webhook mutatevirtualmachines")
Expand Down Expand Up @@ -61,7 +62,6 @@ func (a *virtualMachineAnnotator) Handle(ctx context.Context, req admission.Requ
if virtualMachine.Annotations == nil {
virtualMachine.Annotations = map[string]string{}
}

if virtualMachine.Namespace == "" {
virtualMachine.Namespace = req.AdmissionRequest.Namespace
}
Expand Down
11 changes: 6 additions & 5 deletions pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package webhook
import (
"fmt"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/names"
"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
webhookserver "github.com/qinqon/kube-admission-webhook/pkg/webhook/server"
"github.com/qinqon/kube-admission-webhook/pkg/webhook/server/certificate"
admissionregistration "k8s.io/api/admissionregistration/v1beta1"
Expand All @@ -30,10 +28,13 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/manager"

"github.com/k8snetworkplumbingwg/kubemacpool/pkg/names"
"github.com/k8snetworkplumbingwg/kubemacpool/pkg/pool-manager"
)

const (
mutatingWebhookConfigurationName = "kubemacpool-mutator"
WebhookServerPort = 8000
)

// AddToManagerFuncs is a list of functions to add all Controllers to the Manager
Expand All @@ -50,7 +51,7 @@ var AddToWebhookFuncs []func(*webhookserver.Server, *pool_manager.PoolManager) e

// AddToManager adds all Controllers to the Manager
func AddToManager(mgr manager.Manager, poolManager *pool_manager.PoolManager) error {
s := webhookserver.New(mgr, mutatingWebhookConfigurationName, certificate.MutatingWebhook, webhookserver.WithPort(8000))
s := webhookserver.New(mgr, names.MUTATE_WEBHOOK_CONFIG, certificate.MutatingWebhook, webhookserver.WithPort(WebhookServerPort))

for _, f := range AddToWebhookFuncs {
if err := f(s, poolManager); err != nil {
Expand Down Expand Up @@ -118,7 +119,7 @@ func CreateOwnerRefForService(kubeClient *kubernetes.Clientset, managerNamespace
Port: 443,
TargetPort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 8000,
IntVal: WebhookServerPort,
}}}}}
_, err = kubeClient.CoreV1().Services(managerNamespace).Create(svcObject)
return err
Expand Down
2 changes: 2 additions & 0 deletions vendor/github.com/hashicorp/golang-lru/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 22 additions & 4 deletions vendor/github.com/hashicorp/golang-lru/lru.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions vendor/github.com/hashicorp/golang-lru/simplelru/lru.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d1cc39a

Please sign in to comment.