Skip to content

Commit

Permalink
Merge pull request openshift#220 from bnshr/daemonset-lib
Browse files Browse the repository at this point in the history
Use privileged Daemonset library
  • Loading branch information
openshift-merge-robot authored Sep 7, 2022
2 parents 6a833b5 + ab4b1c5 commit 564feba
Show file tree
Hide file tree
Showing 10 changed files with 335 additions and 20 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0
github.com/test-network-function/l2discovery v0.0.0-20220817163120-5aa77e3c1d0c
github.com/test-network-function/privileged-daemonset v0.0.0-20220826123400-aaf1694908af
github.com/yourbasic/graph v0.0.0-20210606180040-8ecfec1c2869
k8s.io/api v0.25.0
k8s.io/apiextensions-apiserver v0.25.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/test-network-function/l2discovery v0.0.0-20220817163120-5aa77e3c1d0c h1:Jzc6aQ/FI63ec410oiT35WG3ciyJ4b13GYoXpo3lr9A=
github.com/test-network-function/l2discovery v0.0.0-20220817163120-5aa77e3c1d0c/go.mod h1:fRZ3dlxBG5bwgVIaMhCKBv3431r9X40C2lYM3r4iwHE=
github.com/test-network-function/privileged-daemonset v0.0.0-20220826123400-aaf1694908af h1:hz/L249lHk6QBaO723lbIRgz/VHVnbaMBoMhxwark80=
github.com/test-network-function/privileged-daemonset v0.0.0-20220826123400-aaf1694908af/go.mod h1:psbuW1xPzS2+9x+lXtL0HrlEJtBEHrD8cZ2X6mbnyOU=
github.com/yourbasic/graph v0.0.0-20210606180040-8ecfec1c2869 h1:7v7L5lsfw4w8iqBBXETukHo4IPltmD+mWoLRYUmeGN8=
github.com/yourbasic/graph v0.0.0-20210606180040-8ecfec1c2869/go.mod h1:Rfzr+sqaDreiCaoQbFCu3sTXxeFq/9kXRuyOoSlGQHE=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
7 changes: 5 additions & 2 deletions test/conformance/ptp/ptp.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/ptp-operator/test/utils"
"github.com/openshift/ptp-operator/test/utils/daemonsets"
"github.com/openshift/ptp-operator/test/utils/event"
"github.com/openshift/ptp-operator/test/utils/l2discovery"

Expand All @@ -34,6 +33,8 @@ import (
"github.com/openshift/ptp-operator/test/utils/nodes"
"github.com/openshift/ptp-operator/test/utils/pods"
"github.com/openshift/ptp-operator/test/utils/testconfig"

k8sPriviledgedDs "github.com/test-network-function/privileged-daemonset"
)

type TestCase string
Expand Down Expand Up @@ -1030,8 +1031,10 @@ func rebootSlaveNode(fullConfig testconfig.TestConfig) {
imageWithVersion = "quay.io/testnetworkfunction/debug-partner:latest"
)

// Create the client of Priviledged Daemonset
k8sPriviledgedDs.SetDaemonSetClient(client.Client.Interface)
// 1. create a daemon set for the node reboot
rebootDaemonSetRunningPods, err := daemonsets.CreateDaemonSet(rebootDaemonSetName, rebootDaemonSetNamespace, rebootDaemonSetContainerName, imageWithVersion, timeoutIn5Minutes)
rebootDaemonSetRunningPods, err := k8sPriviledgedDs.CreateDaemonSet(rebootDaemonSetName, rebootDaemonSetNamespace, rebootDaemonSetContainerName, imageWithVersion, timeoutIn5Minutes)
if err != nil {
logrus.Errorf("error : +%v\n", err.Error())
}
Expand Down
9 changes: 6 additions & 3 deletions test/utils/l2discovery/l2discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import (
"github.com/openshift/ptp-operator/test/utils/nodes"
"github.com/openshift/ptp-operator/test/utils/pods"

"github.com/openshift/ptp-operator/test/utils/daemonsets"
l2 "github.com/test-network-function/l2discovery/export"

"github.com/sirupsen/logrus"
"github.com/yourbasic/graph"
v1core "k8s.io/api/core/v1"

k8sPriviledgedDs "github.com/test-network-function/privileged-daemonset"
)

func init() {
Expand Down Expand Up @@ -350,10 +351,12 @@ func (config *L2DiscoveryConfig) DiscoverL2Connectivity(client *client.ClientSet
logrus.Errorf("could not retrieve ptp interface list")
}

// Create the client of Priviledged Daemonset
k8sPriviledgedDs.SetDaemonSetClient(client.Interface)
// Create L2 discovery daemonset
config.L2DsMode = StringToL2Mode(os.Getenv("L2_DAEMONSET"))
if config.L2DsMode == Managed {
_, err = daemonsets.CreateDaemonSet(L2DiscoveryDsName, L2DiscoveryNsName, L2DiscoveryContainerName, l2DiscoveryImage, timeoutDaemon)
_, err = k8sPriviledgedDs.CreateDaemonSet(L2DiscoveryDsName, L2DiscoveryNsName, L2DiscoveryContainerName, l2DiscoveryImage, timeoutDaemon)
if err != nil {
logrus.Errorf("error creating l2 discovery daemonset, err=%s", err)
}
Expand Down Expand Up @@ -385,7 +388,7 @@ func (config *L2DiscoveryConfig) DiscoverL2Connectivity(client *client.ClientSet

// Delete L2 discovery daemonset
if config.L2DsMode == Managed {
err = daemonsets.DeleteDaemonSet(L2DiscoveryDsName, L2DiscoveryNsName)
err = k8sPriviledgedDs.DeleteDaemonSet(L2DiscoveryDsName, L2DiscoveryNsName)
if err != nil {
logrus.Errorf("error deleting l2 discovery daemonset, err=%s", err)
}
Expand Down

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

201 changes: 201 additions & 0 deletions vendor/github.com/test-network-function/privileged-daemonset/LICENSE

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.

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

Loading

0 comments on commit 564feba

Please sign in to comment.