mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
Merge pull request #1392 from mythi/PR-2023-019
sgx: stop using local source hooks for EPC registration
This commit is contained in:
commit
ed08d11aa3
@ -23,14 +23,12 @@ The default operator deployment depends on NFD and cert-manager. Those component
|
|||||||
|
|
||||||
### NFD
|
### NFD
|
||||||
|
|
||||||
Install NFD (if it's not already installed) and node labelling rules (requires NFD v0.10+):
|
Install NFD (if it's not already installed) and node labelling rules (requires NFD v0.13+):
|
||||||
|
|
||||||
```
|
```
|
||||||
# either with default NFD installation
|
# deploy NFD
|
||||||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd?ref=<RELEASE_VERSION>'
|
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd?ref=<RELEASE_VERSION>'
|
||||||
# or when setting up with SGX
|
# deploy NodeFeatureRules
|
||||||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/sgx?ref=<RELEASE_VERSION>'
|
|
||||||
# and finally, NodeFeatureRules
|
|
||||||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules?ref=<RELEASE_VERSION>'
|
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules?ref=<RELEASE_VERSION>'
|
||||||
```
|
```
|
||||||
Make sure both NFD master and worker pods are running:
|
Make sure both NFD master and worker pods are running:
|
||||||
|
@ -84,7 +84,7 @@ Where `<RELEASE_VERSION>` needs to be substituted with the desired [release tag]
|
|||||||
First, deploy `node-feature-discovery`:
|
First, deploy `node-feature-discovery`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/sgx?ref=<RELEASE_VERSION>'
|
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/?ref=<RELEASE_VERSION>'
|
||||||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules?ref=<RELEASE_VERSION>'
|
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules?ref=<RELEASE_VERSION>'
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -110,13 +110,13 @@ $ kubectl apply -f 'https://raw.githubusercontent.com/intel/intel-device-plugins
|
|||||||
There are two alternative ways to deploy SGX device plugin using `kubectl`.
|
There are two alternative ways to deploy SGX device plugin using `kubectl`.
|
||||||
|
|
||||||
The first approach involves deployment of the [SGX DaemonSet YAML](/deployments/sgx_plugin/base/intel-sgx-plugin.yaml)
|
The first approach involves deployment of the [SGX DaemonSet YAML](/deployments/sgx_plugin/base/intel-sgx-plugin.yaml)
|
||||||
and [node-feature-discovery](/deployments/nfd/overlays/sgx/kustomization.yaml)
|
and [node-feature-discovery](/deployments/nfd/kustomization.yaml)
|
||||||
with the necessary configuration.
|
with the necessary configuration.
|
||||||
|
|
||||||
The following kustomizations are needed for deploying everything:
|
The following kustomizations are needed for deploying everything:
|
||||||
```bash
|
```bash
|
||||||
# first, deploy NFD and the necessary NodeFeatureRules
|
# first, deploy NFD and the necessary NodeFeatureRules
|
||||||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/sgx'
|
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd'
|
||||||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules'
|
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules'
|
||||||
# and then, deploy SGX plugin
|
# and then, deploy SGX plugin
|
||||||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/sgx_plugin/overlays/epc-nfd/'
|
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/sgx_plugin/overlays/epc-nfd/'
|
||||||
@ -150,9 +150,9 @@ $ kubectl describe node <node name> | grep sgx.intel.com
|
|||||||
sgx.intel.com/enclave: 20
|
sgx.intel.com/enclave: 20
|
||||||
sgx.intel.com/epc: 98566144
|
sgx.intel.com/epc: 98566144
|
||||||
sgx.intel.com/provision: 20
|
sgx.intel.com/provision: 20
|
||||||
sgx.intel.com/enclave 1 1
|
sgx.intel.com/enclave 0 0
|
||||||
sgx.intel.com/epc 400 400
|
sgx.intel.com/epc 0 0
|
||||||
sgx.intel.com/provision 1 1
|
sgx.intel.com/provision 0 0
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing and Demos
|
## Testing and Demos
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
bases:
|
bases:
|
||||||
- "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref=v0.12.1"
|
- "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref=v0.13.1"
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1alpha1
|
|
||||||
kind: Component
|
|
||||||
|
|
||||||
patchesJson6902:
|
|
||||||
- target:
|
|
||||||
group: apps
|
|
||||||
version: v1
|
|
||||||
kind: Deployment
|
|
||||||
name: nfd-master
|
|
||||||
path: master-args.yaml
|
|
||||||
- target:
|
|
||||||
group: rbac.authorization.k8s.io
|
|
||||||
version: v1
|
|
||||||
kind: ClusterRole
|
|
||||||
name: nfd-master
|
|
||||||
path: master-rbac.yaml
|
|
@ -1,3 +0,0 @@
|
|||||||
- op: add
|
|
||||||
path: /spec/template/spec/containers/0/args
|
|
||||||
value: ["--resource-labels=sgx.intel.com/epc", "--extra-label-ns=sgx.intel.com"]
|
|
@ -1,3 +0,0 @@
|
|||||||
- op: add
|
|
||||||
path: /rules/0/resources
|
|
||||||
value: ["nodes", "nodes/status"]
|
|
@ -86,14 +86,16 @@ spec:
|
|||||||
- name: "intel.sgx"
|
- name: "intel.sgx"
|
||||||
labels:
|
labels:
|
||||||
"intel.feature.node.kubernetes.io/sgx": "true"
|
"intel.feature.node.kubernetes.io/sgx": "true"
|
||||||
|
extendedResources:
|
||||||
|
sgx.intel.com/epc: "@cpu.security.sgx.epc"
|
||||||
matchFeatures:
|
matchFeatures:
|
||||||
- feature: cpu.cpuid
|
- feature: cpu.cpuid
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
SGX: {op: Exists}
|
SGX: {op: Exists}
|
||||||
SGXLC: {op: Exists}
|
SGXLC: {op: Exists}
|
||||||
- feature: cpu.sgx
|
- feature: cpu.security
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
enabled: {op: IsTrue}
|
sgx.enabled: {op: IsTrue}
|
||||||
- feature: kernel.config
|
- feature: kernel.config
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
X86_SGX: {op: Exists}
|
X86_SGX: {op: Exists}
|
||||||
|
@ -90,6 +90,8 @@ spec:
|
|||||||
- name: "intel.sgx"
|
- name: "intel.sgx"
|
||||||
labels:
|
labels:
|
||||||
"intel.feature.node.kubernetes.io/sgx": "true"
|
"intel.feature.node.kubernetes.io/sgx": "true"
|
||||||
|
extendedResources:
|
||||||
|
sgx.intel.com/epc: "@cpu.security.sgx.epc"
|
||||||
matchFeatures:
|
matchFeatures:
|
||||||
- feature: cpu.cpuid
|
- feature: cpu.cpuid
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
bases:
|
|
||||||
- ../../base
|
|
||||||
|
|
||||||
components:
|
|
||||||
- ../../components/sgx
|
|
@ -4,7 +4,6 @@ metadata:
|
|||||||
name: sgxdeviceplugin-sample
|
name: sgxdeviceplugin-sample
|
||||||
spec:
|
spec:
|
||||||
image: intel/intel-sgx-plugin:0.26.0
|
image: intel/intel-sgx-plugin:0.26.0
|
||||||
initImage: intel/intel-sgx-initcontainer:0.26.0
|
|
||||||
enclaveLimit: 110
|
enclaveLimit: 110
|
||||||
provisionLimit: 110
|
provisionLimit: 110
|
||||||
logLevel: 4
|
logLevel: 4
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: DaemonSet
|
|
||||||
metadata:
|
|
||||||
name: intel-sgx-plugin
|
|
||||||
spec:
|
|
||||||
template:
|
|
||||||
spec:
|
|
||||||
initContainers:
|
|
||||||
- name: intel-sgx-initcontainer
|
|
||||||
image: intel/intel-sgx-initcontainer:devel
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
securityContext:
|
|
||||||
readOnlyRootFilesystem: true
|
|
||||||
allowPrivilegeEscalation: false
|
|
||||||
volumeMounts:
|
|
||||||
- mountPath: /etc/kubernetes/node-feature-discovery/source.d/
|
|
||||||
name: nfd-features
|
|
||||||
volumes:
|
|
||||||
- name: nfd-features
|
|
||||||
hostPath:
|
|
||||||
path: /etc/kubernetes/node-feature-discovery/source.d/
|
|
||||||
type: DirectoryOrCreate
|
|
@ -1,5 +1,3 @@
|
|||||||
bases:
|
bases:
|
||||||
- ../../base
|
- ../../base
|
||||||
- ../../../sgx_admissionwebhook/overlays/default-with-certmanager
|
- ../../../sgx_admissionwebhook/overlays/default-with-certmanager
|
||||||
patches:
|
|
||||||
- path: add-epc-nfd-initcontainer.yaml
|
|
||||||
|
@ -53,10 +53,6 @@ func (r *SgxDevicePlugin) Default() {
|
|||||||
if len(r.Spec.Image) == 0 {
|
if len(r.Spec.Image) == 0 {
|
||||||
r.Spec.Image = "intel/intel-sgx-plugin:" + sgxMinVersion.String()
|
r.Spec.Image = "intel/intel-sgx-plugin:" + sgxMinVersion.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.Spec.InitImage) == 0 {
|
|
||||||
r.Spec.InitImage = "intel/intel-sgx-initcontainer:" + sgxMinVersion.String()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// +kubebuilder:webhook:verbs=create;update,path=/validate-deviceplugin-intel-com-v1-sgxdeviceplugin,mutating=false,failurePolicy=fail,groups=deviceplugin.intel.com,resources=sgxdeviceplugins,versions=v1,name=vsgxdeviceplugin.kb.io,sideEffects=None,admissionReviewVersions=v1
|
// +kubebuilder:webhook:verbs=create;update,path=/validate-deviceplugin-intel-com-v1-sgxdeviceplugin,mutating=false,failurePolicy=fail,groups=deviceplugin.intel.com,resources=sgxdeviceplugins,versions=v1,name=vsgxdeviceplugin.kb.io,sideEffects=None,admissionReviewVersions=v1
|
||||||
@ -93,5 +89,9 @@ func (r *SgxDevicePlugin) validatePlugin() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r.Spec.InitImage == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return validatePluginImage(r.Spec.InitImage, "intel-sgx-initcontainer", sgxMinVersion)
|
return validatePluginImage(r.Spec.InitImage, "intel-sgx-initcontainer", sgxMinVersion)
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ func setupFirstNode() []byte {
|
|||||||
framework.Logf("kube-apiserver version: %s", serverVersion.GitVersion)
|
framework.Logf("kube-apiserver version: %s", serverVersion.GitVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.Kubectl("node-feature-discovery", "apply", "-k", "deployments/nfd/overlays/sgx/kustomization.yaml")
|
utils.Kubectl("node-feature-discovery", "apply", "-k", "deployments/nfd/kustomization.yaml")
|
||||||
|
|
||||||
utils.Kubectl("node-feature-discovery", "apply", "-k", "deployments/nfd/overlays/node-feature-rules/kustomization.yaml")
|
utils.Kubectl("node-feature-discovery", "apply", "-k", "deployments/nfd/overlays/node-feature-rules/kustomization.yaml")
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ const (
|
|||||||
ns = "inteldeviceplugins-system"
|
ns = "inteldeviceplugins-system"
|
||||||
timeout = time.Second * 120
|
timeout = time.Second * 120
|
||||||
kustomizationWebhook = "deployments/sgx_admissionwebhook/overlays/default-with-certmanager/kustomization.yaml"
|
kustomizationWebhook = "deployments/sgx_admissionwebhook/overlays/default-with-certmanager/kustomization.yaml"
|
||||||
kustomizationPlugin = "deployments/sgx_plugin/overlays/epc-hook-initcontainer/kustomization.yaml"
|
kustomizationPlugin = "deployments/sgx_plugin/base/kustomization.yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
Loading…
Reference in New Issue
Block a user