Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ The [DSA device plugin](cmd/dsa_plugin/README.md) supports acceleration using th

## Device Plugins Operator

Currently the operator has support for the QAT, GPU, FPGA and SGX device plugins:
Currently the operator has support for the QAT, GPU, FPGA, SGX and DSA device plugins:
it validates container image references and extends reported statuses.

To run an operator instance in the container run
Expand Down
10 changes: 10 additions & 0 deletions cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

devicepluginv1 "github.com/intel/intel-device-plugins-for-kubernetes/pkg/apis/deviceplugin/v1"
fpgav2 "github.com/intel/intel-device-plugins-for-kubernetes/pkg/apis/fpga/v2"
"github.com/intel/intel-device-plugins-for-kubernetes/pkg/controllers/dsa"
"github.com/intel/intel-device-plugins-for-kubernetes/pkg/controllers/fpga"
"github.com/intel/intel-device-plugins-for-kubernetes/pkg/controllers/gpu"
"github.com/intel/intel-device-plugins-for-kubernetes/pkg/controllers/qat"
Expand Down Expand Up @@ -74,6 +75,15 @@ func main() {
os.Exit(1)
}

if err = dsa.SetupReconciler(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DsaDevicePlugin")
os.Exit(1)
}
if err = (&devicepluginv1.DsaDevicePlugin{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "DsaDevicePlugin")
os.Exit(1)
}

if err = gpu.SetupReconciler(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "GpuDevicePlugin")
os.Exit(1)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: dsadeviceplugins.deviceplugin.intel.com
spec:
additionalPrinterColumns:
- JSONPath: .status.desiredNumberScheduled
name: Desired
type: integer
- JSONPath: .status.numberReady
name: Ready
type: integer
- JSONPath: .spec.nodeSelector
name: Node Selector
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: deviceplugin.intel.com
names:
kind: DsaDevicePlugin
listKind: DsaDevicePluginList
plural: dsadeviceplugins
singular: dsadeviceplugin
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: DsaDevicePlugin is the Schema for the dsadeviceplugins API. It
represents the DSA device plugin responsible for advertising Intel DSA hardware
resources to the kubelet.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: DsaDevicePluginSpec defines the desired state of DsaDevicePlugin.
properties:
image:
description: Image is a container image with DSA device plugin executable.
type: string
logLevel:
description: LogLevel sets the plugin's log level.
minimum: 0
type: integer
nodeSelector:
additionalProperties:
type: string
description: NodeSelector provides a simple way to constrain device
plugin pods to nodes with particular labels.
type: object
sharedDevNum:
description: SharedDevNum is a number of containers that can share the
same DSA device.
minimum: 1
type: integer
type: object
status:
description: DsaDevicePluginStatus defines the observed state of DsaDevicePlugin.
properties:
controlledDaemonSet:
description: ControlledDaemoSet references the DaemonSet controlled
by the operator.
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of an
entire object, this string should contain a valid JSON/Go field
access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen only
to have some well-defined way of referencing a part of an object.
TODO: this design is not final and this field is subject to change
in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference is
made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
desiredNumberScheduled:
description: The total number of nodes that should be running the device
plugin pod (including nodes correctly running the device plugin pod).
format: int32
type: integer
nodeNames:
description: The list of Node names where the device plugin pods are
running.
items:
type: string
type: array
numberReady:
description: The number of nodes that should be running the device plugin
pod and have one or more of the device plugin pod running and ready.
format: int32
type: integer
required:
- desiredNumberScheduled
- numberReady
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ spec:
minimum: 0
type: integer
mode:
description: Mode is a mode the plugin's operation.
description: Mode is a mode of the plugin's operation.
enum:
- af
- region
Expand Down
1 change: 1 addition & 0 deletions deployments/operator/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resources:
- bases/deviceplugin.intel.com_qatdeviceplugins.yaml
- bases/deviceplugin.intel.com_fpgadeviceplugins.yaml
- bases/deviceplugin.intel.com_sgxdeviceplugins.yaml
- bases/deviceplugin.intel.com_dsadeviceplugins.yaml
- bases/fpga.intel.com_acceleratorfunctions.yaml
- bases/fpga.intel.com_fpgaregions.yaml
# +kubebuilder:scaffold:crdkustomizeresource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ spec:
kind: SgxDevicePlugin
name: sgxdeviceplugins.deviceplugin.intel.com
version: v1
description: DsaDevicePlugin is the Schema for the dsadeviceplugins API. It represents the DSA device plugin responsible for advertising Intel DSA hardware resources to the kubelet.
displayName: Intel DSA Device Plugin
kind: DsaDevicePlugin
name: dsadeviceplugins.deviceplugin.intel.com
version: v1
description: |
[Intel Device Plugins for Kubernetes](https://github.com/intel/intel-device-plugins-for-kubernetes) is a collection of
[device plugins](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/) advertising Intel specific hardware resources
to the kubelet. Currently the operator has basic support for the QAT, GPU, FPGA and SGX device plugins: it validates container image references and extends
to the kubelet. Currently the operator has basic support for the QAT, GPU, FPGA, SGX and DSA device plugins: it validates container image references and extends
reported statuses.
displayName: Intel Device Plugins Operator
icon:
Expand Down
20 changes: 20 additions & 0 deletions deployments/operator/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ rules:
verbs:
- get
- update
- apiGroups:
- deviceplugin.intel.com
resources:
- dsadeviceplugins
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- deviceplugin.intel.com
resources:
- dsadeviceplugins/status
verbs:
- get
- patch
- update
- apiGroups:
- deviceplugin.intel.com
resources:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: deviceplugin.intel.com/v1
kind: DsaDevicePlugin
metadata:
name: dsadeviceplugin-sample
spec:
image: intel/intel-dsa-plugin:0.18.0
sharedDevNum: 10
logLevel: 4
40 changes: 40 additions & 0 deletions deployments/operator/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ metadata:
creationTimestamp: null
name: mutating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-deviceplugin-intel-com-v1-dsadeviceplugin
failurePolicy: Fail
name: mdsadeviceplugin.kb.io
rules:
- apiGroups:
- deviceplugin.intel.com
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- dsadeviceplugins
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand Down Expand Up @@ -134,6 +154,26 @@ metadata:
creationTimestamp: null
name: validating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-deviceplugin-intel-com-v1-dsadeviceplugin
failurePolicy: Fail
name: vdsadeviceplugin.kb.io
rules:
- apiGroups:
- deviceplugin.intel.com
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- dsadeviceplugins
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand Down
95 changes: 95 additions & 0 deletions pkg/apis/deviceplugin/v1/dsadeviceplugin_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// 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.
// 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.

package v1

import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// DsaDevicePluginSpec defines the desired state of DsaDevicePlugin.
type DsaDevicePluginSpec struct {
// Important: Run "make generate" to regenerate code after modifying this file

// Image is a container image with DSA device plugin executable.
Image string `json:"image,omitempty"`

// SharedDevNum is a number of containers that can share the same DSA device.
// +kubebuilder:validation:Minimum=1
SharedDevNum int `json:"sharedDevNum,omitempty"`

// LogLevel sets the plugin's log level.
// +kubebuilder:validation:Minimum=0
LogLevel int `json:"logLevel,omitempty"`

// NodeSelector provides a simple way to constrain device plugin pods to nodes with particular labels.
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}

// DsaDevicePluginStatus defines the observed state of DsaDevicePlugin.
type DsaDevicePluginStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make generate" to regenerate code after modifying this file

// ControlledDaemoSet references the DaemonSet controlled by the operator.
// +optional
ControlledDaemonSet v1.ObjectReference `json:"controlledDaemonSet,omitempty"`

// The total number of nodes that should be running the device plugin
// pod (including nodes correctly running the device plugin pod).
DesiredNumberScheduled int32 `json:"desiredNumberScheduled"`

// The number of nodes that should be running the device plugin pod and have one
// or more of the device plugin pod running and ready.
NumberReady int32 `json:"numberReady"`

// The list of Node names where the device plugin pods are running.
// +optional
NodeNames []string `json:"nodeNames,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Desired",type=integer,JSONPath=`.status.desiredNumberScheduled`
// +kubebuilder:printcolumn:name="Ready",type=integer,JSONPath=`.status.numberReady`
// +kubebuilder:printcolumn:name="Node Selector",type=string,JSONPath=`.spec.nodeSelector`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +operator-sdk:csv:customresourcedefinitions:displayName="Intel DSA Device Plugin"

// DsaDevicePlugin is the Schema for the dsadeviceplugins API. It represents
// the DSA device plugin responsible for advertising Intel DSA hardware resources to
// the kubelet.
type DsaDevicePlugin struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec DsaDevicePluginSpec `json:"spec,omitempty"`
Status DsaDevicePluginStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// DsaDevicePluginList contains a list of DsaDevicePlugin.
type DsaDevicePluginList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DsaDevicePlugin `json:"items"`
}

func init() {
SchemeBuilder.Register(&DsaDevicePlugin{}, &DsaDevicePluginList{})
}
Loading