Skip to content

Commit a5bea24

Browse files
committed
Add sriov dp admission controller to dpu operator
1 parent c82a809 commit a5bea24

17 files changed

+321
-20
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,12 @@ REGISTRY ?= $(shell hostname)
218218
# development.
219219
DPU_OPERATOR_IMAGE := $(REGISTRY):5000/dpu-operator:dev
220220
DPU_DAEMON_IMAGE := $(REGISTRY):5000/dpu-daemon:dev
221+
ADMISSION_CONTROLLERS_CERTIFICATES_INJECTOR_CA_CRT ?= $(shell kubectl get configmap -n kube-system extension-apiserver-authentication -o=jsonpath='{.data.client-ca-file}' | base64 --w=0)
221222
MARVELL_VSP_IMAGE := $(REGISTRY):5000/mrvl-vsp:dev
222223

223224
.PHONY: local-deploy-prep
224225
prep-local-deploy: tools
225-
./bin/config -registry-url $(REGISTRY) -template-file config/dev/local-images-template.yaml -output-file bin/local-images.yaml
226+
./bin/config -registry-url $(REGISTRY) -admissions-controllers-ca-crt $(ADMISSION_CONTROLLERS_CERTIFICATES_INJECTOR_CA_CRT) -template-file config/dev/local-images-template.yaml -output-file bin/local-images.yaml
226227
cp config/dev/kustomization.yaml bin
227228

228229
.PHONY: local-deploy
@@ -245,13 +246,13 @@ local-buildx: ## Build all container images necessary to run the whole operator
245246
mkdir -p $(GO_CONTAINER_CACHE)
246247
buildah manifest rm $(DPU_OPERATOR_IMAGE)-manifest || true
247248
buildah manifest create $(DPU_OPERATOR_IMAGE)-manifest
248-
buildah build --authfile /root/config.json --manifest $(DPU_OPERATOR_IMAGE)-manifest --platform linux/amd64,linux/arm64 -v $(GO_CONTAINER_CACHE):/go:z -f Dockerfile.rhel -t $(DPU_OPERATOR_IMAGE)
249+
buildah build --authfile /root/config.json --manifest $(DPU_OPERATOR_IMAGE)-manifest --platform linux/amd64 -v $(GO_CONTAINER_CACHE):/go:z -f Dockerfile.rhel -t $(DPU_OPERATOR_IMAGE)
249250
buildah manifest rm $(DPU_DAEMON_IMAGE)-manifest || true
250251
buildah manifest create $(DPU_DAEMON_IMAGE)-manifest
251-
buildah build --authfile /root/config.json --manifest $(DPU_DAEMON_IMAGE)-manifest --platform linux/amd64,linux/arm64 -v $(GO_CONTAINER_CACHE):/go:z -f Dockerfile.daemon.rhel -t $(DPU_DAEMON_IMAGE)
252+
buildah build --authfile /root/config.json --manifest $(DPU_DAEMON_IMAGE)-manifest --platform linux/amd64 -v $(GO_CONTAINER_CACHE):/go:z -f Dockerfile.daemon.rhel -t $(DPU_DAEMON_IMAGE)
252253
buildah manifest rm $(MARVELL_VSP_IMAGE)-manifest || true
253254
buildah manifest create $(MARVELL_VSP_IMAGE)-manifest
254-
buildah build --authfile /root/config.json --manifest $(MARVELL_VSP_IMAGE)-manifest --platform linux/amd64,linux/arm64 -v $(GO_CONTAINER_CACHE):/go:z -f Dockerfile.mrvlVSP.rhel -t $(MARVELL_VSP_IMAGE)
255+
buildah build --authfile /root/config.json --manifest $(MARVELL_VSP_IMAGE)-manifest --platform linux/amd64 -v $(GO_CONTAINER_CACHE):/go:z -f Dockerfile.mrvlVSP.rhel -t $(MARVELL_VSP_IMAGE)
255256

256257
.PHONY: local-pushx
257258
local-pushx: ## Push all container images necessary to run the whole operator

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# DPU Operator
1+
# DPU Operator
22

33
This operator will manage and configure data processing unit (DPUs) to be used in accelerating/offloading k8s networking functions.
44

bundle/manifests/dpu-operator.clusterserviceversion.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ metadata:
3939
]
4040
capabilities: Basic Install
4141
createdAt: "2024-10-15T19:06:53Z"
42+
createdAt: "2024-10-11T15:10:43Z"
4243
features.operators.openshift.io/cnf: "false"
4344
features.operators.openshift.io/cni: "true"
4445
features.operators.openshift.io/csi: "false"
@@ -121,6 +122,18 @@ spec:
121122
- patch
122123
- update
123124
- watch
125+
- apiGroups:
126+
- apps
127+
resources:
128+
- deployments
129+
verbs:
130+
- create
131+
- delete
132+
- get
133+
- list
134+
- patch
135+
- update
136+
- watch
124137
- apiGroups:
125138
- config.openshift.io
126139
resources:

cmd/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,13 @@ func main() {
103103
setupLog.Error(err, "Failed to set DPU_DAEMON_IMAGE env var")
104104
os.Exit(1)
105105
}
106+
injectorWebhookCA := os.Getenv("ADMISSION_CONTROLLERS_CA_CRT")
107+
if injectorWebhookCA == "" {
108+
setupLog.Error(err, "Failed to set ADMISSION_CONTROLLERS_CERTIFICATES_INJECTOR_CA_CRT env var")
109+
os.Exit(1)
110+
}
106111

107-
b := controller.NewDpuOperatorConfigReconciler(mgr.GetClient(), mgr.GetScheme(), dpuDaemonImage, vspImages)
112+
b := controller.NewDpuOperatorConfigReconciler(mgr.GetClient(), mgr.GetScheme(), dpuDaemonImage, vspImages, injectorWebhookCA)
108113

109114
if value, ok := os.LookupEnv("IMAGE_PULL_POLICIES"); ok {
110115
b = b.WithImagePullPolicy(value)

config/dev/local-images-template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ spec:
2424
value: {{ .RegistryURL }}:5000/intel_vsp:dev
2525
- name: MarvellVspImage
2626
value: {{ .RegistryURL }}:5000/mrvl-vsp:dev
27+
- name: ADMISSION_CONTROLLERS_CA_CRT
28+
value: {{ .AdmissionControllersCaCrt }}
2729
- name: IMAGE_PULL_POLICIES
2830
value: Always
2931
image: {{ .RegistryURL }}:5000/dpu-operator:dev

config/rbac/auth_proxy_client_clusterrole.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ rules:
1414
- "/metrics"
1515
verbs:
1616
- get
17+

config/rbac/role.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ rules:
2828
- patch
2929
- update
3030
- watch
31+
- apiGroups:
32+
- admissionregistration.k8s.io
33+
resources:
34+
- mutatingwebhookconfigurations
35+
verbs:
36+
- create
37+
- delete
38+
- get
39+
- list
40+
- patch
41+
- update
42+
- watch
3143
- apiGroups:
3244
- apiextensions.k8s.io
3345
resources:
@@ -46,6 +58,18 @@ rules:
4658
- patch
4759
- update
4860
- watch
61+
- apiGroups:
62+
- apps
63+
resources:
64+
- deployments
65+
verbs:
66+
- create
67+
- delete
68+
- get
69+
- list
70+
- patch
71+
- update
72+
- watch
4973
- apiGroups:
5074
- config.openshift.io
5175
resources:

hack/make_fast.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
# Define a function to check OpenShift cluster nodes
4+
check_ocp() {
5+
local KUBECONFIG_PATH=$1
6+
7+
export KUBECONFIG=$KUBECONFIG_PATH
8+
9+
if oc get nodes; then
10+
return 0
11+
else
12+
return 1
13+
fi
14+
}
15+
16+
deploy_cluster_and_dpu_operator() {
17+
bash hack/prepare.sh
18+
bash hack/ipu_host_deploy.sh
19+
bash hack/ipu_deploy.sh
20+
bash hack/deploy_traffic_flow_tests.sh
21+
}
22+
23+
deploy_local_dpu_operator() {
24+
echo "deploying local"
25+
bash hack/prepare.sh
26+
#bash hack/ipu_host_deploy_post.sh
27+
#bash hack/ipu_deploy_post.sh
28+
#bash hack/deploy_traffic_flow_tests.sh
29+
30+
}
31+
32+
check_ocp "/root/kubeconfig.ocpcluster"
33+
result_ocp=$? # Store the return value (0 for true, 1 for false)
34+
35+
check_ocp "/root/kubeconfig.microshift"
36+
result_microshift=$? # Store the return value (0 for true, 1 for false)
37+
38+
# Check if both OCP and MicroShift checks succeeded
39+
if [ $result_ocp -eq 0 ] && [ $result_microshift -eq 0 ]; then
40+
echo "Both OCP and MicroShift cluster checks succeeded!"
41+
deploy_local_dpu_operator
42+
else
43+
echo "Cluster config is not proper... deploying cluster and dpu operator"
44+
#deploy_cluster_and_dpu_operator
45+
fi
46+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: network-resources-injector-service
5+
namespace: openshift-dpu-operator
6+
annotations:
7+
service.alpha.openshift.io/serving-cert-secret-name: network-resources-injector-secret
8+
spec:
9+
ports:
10+
- port: 443
11+
targetPort: 8443
12+
selector:
13+
app: network-resources-injector
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
namespace: openshift-dpu-operator
5+
name: network-resources-injector-sa
6+

0 commit comments

Comments
 (0)