Skip to content

Conversation

@mythi
Copy link
Contributor

@mythi mythi commented Feb 5, 2021

Closes: #556

@mythi mythi force-pushed the PR-2021-009 branch 2 times, most recently from 65d1deb to 3771a4b Compare February 9, 2021 14:07
@mythi mythi changed the title operator: move DevicePlugins CRDs to cluster scope operator: move deviceplugin/v1 CRDs to cluster scope Feb 9, 2021
@mythi mythi marked this pull request as ready for review February 9, 2021 15:23
@mythi mythi requested review from bart0sh, kad and rojkov as code owners February 9, 2021 15:23
Comment on lines 154 to 155
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to split these into two because one was still too "complex"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps moving *.SetupWebhookWithManager() into *.SetupReconsiler() could also work. Then we could introduce a mapping of operator names to *.SetupReconsiler functions and call the functions inside the loop. This way the code would be much shorter:

for _, device := range []string{"dsa", "fpga", "gpu", "qat", "sgx"} {
        if err := setupReconcilerAndWebhookFuncs[device](mgr, ns, device); err != nil {
                setupLog.Error(...)
                os.Exit(1)
        }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rojkov I submitted v2.

@mythi mythi force-pushed the PR-2021-009 branch 2 times, most recently from f230a5f to 19196e2 Compare February 11, 2021 07:46
rojkov
rojkov previously approved these changes Feb 11, 2021
Copy link
Contributor

@rojkov rojkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Please merge if the nitpicking comment doesn't look legit. I'm ok with the code as it is now.

Comment on lines 48 to 50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: when choosing between increased cyclomatics and complex logical expressions I'd take the former. I guess it would be more readable with an additional if for withWebhook and without negation:

if err := controllers.SetupWithManager(mgr, c, devicepluginv1.GroupVersion.String(), "GpuDevicePlugin", ownerKey); err != nil {
        return err
}

if withWebhook {
        return (&devicepluginv1.GpuDevicePlugin{}).SetupWebhookWithManager(mgr)
}

return nil

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good comment, changed, v3 pushed

The device plugins daemonsets are cluster wide and currently only
one device plugin instance per device is possible so making the
corresponding deviceplugin/v1 CRDs non-namespaced (i.e., scope: cluster)
fits better.

Previously, the device plugin daemonset was deployed in the same
namespace as the CR for that device but with the cluster scoped CRDs
we default to use the same namespace as the operator, unless overridden
via DEVICEPLUGIN_NAMESPACE env variable or a command line parameter
to operator manager deployment.

Three additional changes in this commit:
- enable DSA envtest tests
- update controller-runtime to v0.8.1
- change device plugin envtest suite to use klog/v2

Signed-off-by: Mikko Ylinen <[email protected]>
Copy link
Contributor

@rojkov rojkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@rojkov rojkov merged commit 89ad053 into intel:master Feb 11, 2021
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

Successfully merging this pull request may close these issues.

make xDevicePlugin CRDs cluster scoped

2 participants