Skip to content

Commit

Permalink
move to k8s v1.18.2 release
Browse files Browse the repository at this point in the history
Also fix the plugins and e2e tests
  • Loading branch information
Dmitry Rozhkov committed Apr 17, 2020
1 parent f261b27 commit 8fc187f
Show file tree
Hide file tree
Showing 40 changed files with 376 additions and 261 deletions.
61 changes: 58 additions & 3 deletions DEVEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ in an infinite loop. A `Scan()` implementation scans the host for devices and
sends all found devices to a `deviceplugin.Notifier` instance. The
`deviceplugin.Notifier` is implemented and provided by the `deviceplugin`
package itself. The found devices are organized in an instance of
`deviceplugin.DeviceTree` object. The object is filled in with its
`deviceplugin.DeviceTree` object. The object is filled in with its
`AddDevice()` method:

```go
Expand All @@ -56,8 +56,8 @@ func (dp *devicePlugin) Scan(notifier deviceplugin.Notifier) error {
}
```

Optionally, your device plugin may also implement the
`deviceplugin.PostAllocator` interface. If implemented, its method
Optionally, your device plugin may also implement the
`deviceplugin.PostAllocator` interface. If implemented, its method
`PostAllocate()` modifies `pluginapi.AllocateResponse` responses just
before they are sent to `kubelet`. To see an example, refer to the FPGA
plugin which implements this interface to annotate its responses.
Expand Down Expand Up @@ -120,3 +120,58 @@ Otherwise, they can be logged as simple values:
```golang
klog.Warningf("Example of a warning due to an external error: %v", err)
```

How to build against a newer version of Kubernetes
==================================================

First you need to update module dependencies. The easiest way is to use the
script copied from https://github.com/kubernetes/kubernetes/issues/79384#issuecomment-521493597:

```bash
#!/bin/sh
set -euo pipefail

VERSION=${1#"v"}
if [ -z "$VERSION" ]; then
echo "Must specify version!"
exit 1
fi
MODS=($(
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod |
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
))
for MOD in "${MODS[@]}"; do
V=$(
go mod download -json "${MOD}@kubernetes-${VERSION}" |
sed -n 's|.*"Version": "\(.*\)".*|\1|p'
)
go mod edit "-replace=${MOD}=${MOD}@${V}"
done
go get "k8s.io/kubernetes@v${VERSION}"
```

Just run it inside the repo's root, e.g.

```
$ ./k8s_gomod_update.sh 1.18.1
```

Then run the code generator script which can be found at
https://github.com/kubernetes/code-generator/blob/master/generate-groups.sh

```
$ generate-groups.sh all github.com/intel/intel-device-plugins-for-kubernetes/pkg/client \
github.com/intel/intel-device-plugins-for-kubernetes/pkg/apis \
fpga.intel.com:v1
```

Please note that the script (at least of v0.18.2-beta.0) expects the device plugins
repo to be located under $GOPATH/src.

Finally run

```
$ make test
```

and fix all new compilation issues.
2 changes: 1 addition & 1 deletion build/boilerplate/boilerplate.go.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Intel Corporation. All Rights Reserved.
// Copyright 2020 Intel Corporation. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion cmd/fpga_plugin/mode.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"fmt"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -31,7 +32,7 @@ func getModeOverrideFromCluster(nodeName, kubeConfig, master, mode string) (stri
return mode, err
}

node, err := clientset.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})
node, err := clientset.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{})
if err != nil {
return mode, err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/qat_plugin/kerneldrv/kerneldrv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ func TestGetOnlineDevices(t *testing.T) {
for _, tt := range tcases {
t.Run(tt.name, func(t *testing.T) {
fcmd := fakeexec.FakeCmd{
CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{
func() ([]byte, error) {
return []byte(tt.adfCtlOutput), tt.adfCtlError
CombinedOutputScript: []fakeexec.FakeAction{
func() ([]byte, []byte, error) {
return []byte(tt.adfCtlOutput), []byte{}, tt.adfCtlError
},
},
}
Expand Down
65 changes: 32 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,45 @@ require (
github.com/fsnotify/fsnotify v1.4.7
github.com/go-ini/ini v1.46.0
github.com/google/gousb v0.0.0-20190812193832-18f4c1d8a750
github.com/onsi/ginkgo v1.10.1
github.com/onsi/ginkgo v1.11.0
github.com/onsi/gomega v1.7.0
github.com/pkg/errors v0.8.1
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456
google.golang.org/grpc v1.23.1
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7
google.golang.org/grpc v1.26.0
gopkg.in/ini.v1 v1.46.0 // indirect
k8s.io/api v0.17.3
k8s.io/apimachinery v0.17.3
k8s.io/client-go v0.17.3
k8s.io/component-base v0.17.3
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v0.18.2
k8s.io/component-base v0.18.2
k8s.io/klog v1.0.0
k8s.io/kubelet v0.17.3
k8s.io/kubernetes v1.17.3
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f
k8s.io/kubernetes v1.18.2
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89
)

replace (
k8s.io/api => k8s.io/api v0.17.3
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.3
k8s.io/apimachinery => k8s.io/apimachinery v0.17.3
k8s.io/apiserver => k8s.io/apiserver v0.17.3
k8s.io/cli-runtime => k8s.io/cli-runtime v0.17.3
k8s.io/client-go => k8s.io/client-go v0.17.3
k8s.io/cloud-provider => k8s.io/cloud-provider v0.17.3
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.17.3
k8s.io/code-generator => k8s.io/code-generator v0.17.3
k8s.io/component-base => k8s.io/component-base v0.17.3
k8s.io/cri-api => k8s.io/cri-api v0.17.3
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.17.3
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.17.3
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.17.3
k8s.io/kube-proxy => k8s.io/kube-proxy v0.17.3
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.17.3
k8s.io/kubectl => k8s.io/kubectl v0.17.3
k8s.io/kubelet => k8s.io/kubelet v0.17.3
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.17.3
k8s.io/metrics => k8s.io/metrics v0.17.3
k8s.io/api => k8s.io/api v0.18.2
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.2
k8s.io/apimachinery => k8s.io/apimachinery v0.18.3-beta.0
k8s.io/apiserver => k8s.io/apiserver v0.18.2
k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.2
k8s.io/client-go => k8s.io/client-go v0.18.2
k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.2
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.2
k8s.io/code-generator => k8s.io/code-generator v0.18.3-beta.0
k8s.io/component-base => k8s.io/component-base v0.18.2
k8s.io/cri-api => k8s.io/cri-api v0.18.3-beta.0
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.2
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.2
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.2
k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.2
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.2
k8s.io/kubectl => k8s.io/kubectl v0.18.2
k8s.io/kubelet => k8s.io/kubelet v0.18.2
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.2
k8s.io/metrics => k8s.io/metrics v0.18.2
k8s.io/node-api => k8s.io/node-api v0.17.3
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.17.3
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.17.3
k8s.io/sample-controller => k8s.io/sample-controller v0.17.3
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.2
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.18.2
k8s.io/sample-controller => k8s.io/sample-controller v0.18.2
)
Loading

0 comments on commit 8fc187f

Please sign in to comment.