Skip to content

Commit a73437c

Browse files
committed
deploy: add spire manifests in helm and kustomize
Signed-off-by: TessaIO <[email protected]>
1 parent dce9ca5 commit a73437c

File tree

14 files changed

+190
-98
lines changed

14 files changed

+190
-98
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: spire
3+
repository: https://spiffe.github.io/helm-charts-hardened/
4+
version: 0.24.1
5+
digest: sha256:f3b4dc973a59682bf3aa5ca9b53322f57935dd093081e82a37b8082e00becbe9
6+
generated: "2024-12-20T16:52:40.180416+01:00"

deployment/helm/node-feature-discovery/Chart.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ keywords:
1313
- node-labels
1414
type: application
1515
version: 0.2.1
16+
dependencies:
17+
- name: spire
18+
version: 0.24.1
19+
repository: https://spiffe.github.io/helm-charts-hardened/
Binary file not shown.

deployment/helm/node-feature-discovery/templates/master.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,25 @@ spec:
144144
{{- with .Values.master.extraArgs }}
145145
{{- toYaml . | nindent 12 }}
146146
{{- end }}
147+
{{- if .Values.spire.enabled }}
148+
- "-enable-spiffe"
149+
{{- end }}
147150
volumeMounts:
151+
{{- if .Values.spire.enabled }}
152+
- name: spire-agent-socket
153+
mountPath: /run/spire/agent-sockets
154+
readOnly: true
155+
{{- end }}
148156
- name: nfd-master-conf
149157
mountPath: "/etc/kubernetes/node-feature-discovery"
150158
readOnly: true
151159
volumes:
160+
{{- if .Values.spire.enabled }}
161+
- name: spire-agent-socket
162+
hostPath:
163+
path: /run/spire/agent-sockets
164+
type: Directory
165+
{{- end }}
152166
- name: nfd-master-conf
153167
configMap:
154168
name: {{ include "node-feature-discovery.fullname" . }}-master-conf

deployment/helm/node-feature-discovery/templates/worker.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,20 @@ spec:
109109
{{- with .Values.gc.extraArgs }}
110110
{{- toYaml . | nindent 8 }}
111111
{{- end }}
112+
{{- if .Values.spire.enabled }}
113+
- "-enable-spiffe"
114+
{{- end }}
112115
ports:
113116
- containerPort: {{ .Values.worker.metricsPort | default "8081"}}
114117
name: metrics
115118
- containerPort: {{ .Values.worker.healthPort | default "8082" }}
116119
name: health
117120
volumeMounts:
121+
{{- if .Values.spire.enabled }}
122+
- name: spire-agent-socket
123+
mountPath: /run/spire/agent-sockets
124+
readOnly: true
125+
{{- end }}
118126
- name: host-boot
119127
mountPath: "/host-boot"
120128
readOnly: true
@@ -145,6 +153,12 @@ spec:
145153
mountPath: "/etc/kubernetes/node-feature-discovery"
146154
readOnly: true
147155
volumes:
156+
{{- if .Values.spire.enabled }}
157+
- name: spire-agent-socket
158+
hostPath:
159+
path: /run/spire/agent-sockets
160+
type: Directory
161+
{{- end }}
148162
- name: host-boot
149163
hostPath:
150164
path: "/boot"

deployment/helm/node-feature-discovery/values.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -597,3 +597,47 @@ prometheus:
597597
enable: false
598598
scrapeInterval: 10s
599599
labels: {}
600+
601+
spire:
602+
enabled: true
603+
global:
604+
spire:
605+
clusterName: "nfd"
606+
trustDomain: "nfd.io"
607+
spire-agent:
608+
kubeletConnectByHostname: "true"
609+
workloadAttestors:
610+
unix:
611+
enabled: true
612+
spire-server:
613+
controllerManager:
614+
enabled: true
615+
identities:
616+
clusterStaticEntries:
617+
node:
618+
parentID: spiffe://nfd.io/spire/server
619+
spiffeID: spiffe://nfd.io/root
620+
selectors:
621+
- k8s_psat:agent_ns:nfd
622+
- k8s_psat:agent_sa:nfd-agent
623+
- k8s_psat:cluster:nfd
624+
nfd:
625+
parentID: spiffe://nfd.io/root
626+
spiffeID: spiffe://nfd.io/worker
627+
selectors:
628+
- k8s:pod-label:app.kubernetes.io/name:node-feature-discovery
629+
630+
631+
caSubject:
632+
commonName: "nfd.io"
633+
country: "US"
634+
organization: "SPIFFE"
635+
636+
upstream:
637+
enabled: false
638+
spiffe-csi-driver:
639+
enabled: false
640+
spiffe-oidc-discovery-provider:
641+
enabled: false
642+
tornjak-frontend:
643+
enabled: false

docs/reference/master-commandline-reference.md

+16
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,19 @@ Example:
306306
```bash
307307
nfd-master -resync-period=2h
308308
```
309+
310+
### -enable-spiffe
311+
312+
the `-enable-spiffe` flag enables SPIFFE verification for the created NodeFeature
313+
objects created by the worker. When enabled, master verifies the signature that
314+
is put on the annotations part of the NodeFeature object, and updates
315+
Kubernetes nodes if the signature is verified. The feature should be enabled,
316+
after deploying SPIFFE, and you can do it through the Helm chart.
317+
318+
Default: false.
319+
320+
Example:
321+
322+
```bash
323+
nfd-master -enable-spiffe
324+
```

docs/reference/worker-commandline-reference.md

+16
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,19 @@ Default: 0
273273
Comma-separated list of `pattern=N` settings for file-filtered logging.
274274

275275
Default: *empty*
276+
277+
### -enable-spiffe
278+
279+
the `-enable-spiffe` flag enables signing NodeFeature spec on the worker side
280+
and puts the signature in the annotations side of the NodeFeature object.
281+
The signature is verified afterwards by the master. The feature
282+
should be enabled, after deploying SPIFFE, and you can do it through
283+
the Helm chart.
284+
285+
Default: false.
286+
287+
Example:
288+
289+
```bash
290+
nfd-master -enable-spiffe
291+
```

go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ require (
1818
github.com/prometheus/client_golang v1.19.1
1919
github.com/smartystreets/goconvey v1.8.1
2020
github.com/spf13/cobra v1.8.1
21+
github.com/spiffe/go-spiffe/v2 v2.4.0
2122
github.com/stretchr/testify v1.10.0
2223
github.com/vektra/errors v0.0.0-20140903201135-c64d83aba85a
2324
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
@@ -68,6 +69,7 @@ require (
6869
github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect
6970
github.com/felixge/httpsnoop v1.0.4 // indirect
7071
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
72+
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
7173
github.com/go-logr/logr v1.4.2 // indirect
7274
github.com/go-logr/stdr v1.2.2 // indirect
7375
github.com/go-ole/go-ole v1.2.6 // indirect
@@ -120,6 +122,7 @@ require (
120122
github.com/stoewer/go-strcase v1.3.0 // indirect
121123
github.com/stretchr/objx v0.5.2 // indirect
122124
github.com/x448/float16 v0.8.4 // indirect
125+
github.com/zeebo/errs v1.3.0 // indirect
123126
go.etcd.io/etcd/api/v3 v3.5.16 // indirect
124127
go.etcd.io/etcd/client/pkg/v3 v3.5.16 // indirect
125128
go.etcd.io/etcd/client/v3 v3.5.16 // indirect

go.sum

+6-22
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/
6666
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
6767
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
6868
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
69+
github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E=
70+
github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc=
6971
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
7072
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
7173
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@@ -113,27 +115,6 @@ github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgY
113115
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
114116
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
115117
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
116-
github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
117-
github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
118-
github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
119-
github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k=
120-
github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k=
121-
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
122-
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
123-
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
124-
github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=
125-
github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM=
126-
github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM=
127-
github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c=
128-
github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo=
129-
github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=
130-
github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8=
131-
github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI=
132-
github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI=
133-
github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw=
134-
github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI=
135-
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
136-
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
137118
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
138119
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
139120
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
@@ -249,14 +230,15 @@ github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
249230
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
250231
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
251232
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
233+
github.com/spiffe/go-spiffe/v2 v2.4.0 h1:j/FynG7hi2azrBG5cvjRcnQ4sux/VNj8FAVc99Fl66c=
234+
github.com/spiffe/go-spiffe/v2 v2.4.0/go.mod h1:m5qJ1hGzjxjtrkGHZupoXHo/FDWwCB1MdSyBzfHugx0=
252235
github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
253236
github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
254237
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
255238
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
256239
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
257240
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
258241
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
259-
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
260242
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
261243
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
262244
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -274,6 +256,8 @@ github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 h1:S2dVYn90KE98chq
274256
github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
275257
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
276258
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
259+
github.com/zeebo/errs v1.3.0 h1:hmiaKqgYZzcVgRL1Vkc1Mn2914BbzB0IBxs+ebeutGs=
260+
github.com/zeebo/errs v1.3.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
277261
go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0=
278262
go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
279263
go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0=

pkg/nfd-master/nfd-master.go

+17-57
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,19 @@ import (
5252
"sigs.k8s.io/yaml"
5353

5454
nfdclientset "sigs.k8s.io/node-feature-discovery/api/generated/clientset/versioned"
55-
klogutils "sigs.k8s.io/node-feature-discovery/pkg/utils/klog"
56-
spiffe "sigs.k8s.io/node-feature-discovery/pkg/utils/spiffe"
57-
58-
taintutils "k8s.io/kubernetes/pkg/util/taints"
59-
"sigs.k8s.io/yaml"
60-
6155
"sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
6256
nfdv1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
6357
"sigs.k8s.io/node-feature-discovery/pkg/apis/nfd/nodefeaturerule"
6458
"sigs.k8s.io/node-feature-discovery/pkg/apis/nfd/validate"
6559
nfdfeatures "sigs.k8s.io/node-feature-discovery/pkg/features"
6660
"sigs.k8s.io/node-feature-discovery/pkg/utils"
6761
klogutils "sigs.k8s.io/node-feature-discovery/pkg/utils/klog"
62+
spiffe "sigs.k8s.io/node-feature-discovery/pkg/utils/spiffe"
6863
"sigs.k8s.io/node-feature-discovery/pkg/version"
6964
)
7065

7166
// SocketPath specifies Spiffe Socket Path
72-
const SocketPath = "unix:///run/spire/sockets/agent.sock"
67+
const SocketPath = "unix:///run/spire/agent-sockets/api.sock"
7368

7469
// Labels are a Kubernetes representation of discovered features.
7570
type Labels map[string]string
@@ -700,6 +695,14 @@ func (m *nfdMaster) getAndMergeNodeFeatures(nodeName string) (*nfdv1alpha1.NodeF
700695
return filteredObjs[i].Namespace < filteredObjs[j].Namespace
701696
})
702697

698+
// If spiffe is enabled, we should filter out the non verified NFD objects
699+
if m.config.EnableSpiffe {
700+
filteredObjs, err = m.getVerifiedNFDObjects(filteredObjs)
701+
if err != nil {
702+
return &nfdv1alpha1.NodeFeature{}, err
703+
}
704+
}
705+
703706
if len(filteredObjs) > 0 {
704707
// Merge in features
705708
//
@@ -755,55 +758,6 @@ func (m *nfdMaster) nfdAPIUpdateOneNode(cli k8sclient.Interface, node *corev1.No
755758
return fmt.Errorf("failed to merge NodeFeature objects for node %q: %w", node.Name, err)
756759
}
757760

758-
// Sort our objects
759-
sort.Slice(objs, func(i, j int) bool {
760-
// Objects in our nfd namespace gets into the beginning of the list
761-
if objs[i].Namespace == m.namespace && objs[j].Namespace != m.namespace {
762-
return true
763-
}
764-
if objs[i].Namespace != m.namespace && objs[j].Namespace == m.namespace {
765-
return false
766-
}
767-
// After the nfd namespace, sort objects by their name
768-
if objs[i].Name != objs[j].Name {
769-
return objs[i].Name < objs[j].Name
770-
}
771-
// Objects with the same name are sorted by their namespace
772-
return objs[i].Namespace < objs[j].Namespace
773-
})
774-
775-
// If spiffe is enabled, we should filter out the non verified NFD objects
776-
if m.config.EnableSpiffe {
777-
objs, err = m.getVerifiedNFDObjects(objs)
778-
if err != nil {
779-
return err
780-
}
781-
}
782-
783-
klog.V(1).InfoS("processing of node initiated by NodeFeature API", "nodeName", node.Name)
784-
785-
features := nfdv1alpha1.NewNodeFeatureSpec()
786-
787-
if len(objs) > 0 {
788-
// Merge in features
789-
//
790-
// NOTE: changing the rule api to support handle multiple objects instead
791-
// of merging would probably perform better with lot less data to copy.
792-
features = objs[0].Spec.DeepCopy()
793-
if m.config.AutoDefaultNs {
794-
features.Labels = addNsToMapKeys(features.Labels, nfdv1alpha1.FeatureLabelNs)
795-
}
796-
for _, o := range objs[1:] {
797-
s := o.Spec.DeepCopy()
798-
if m.config.AutoDefaultNs {
799-
s.Labels = addNsToMapKeys(s.Labels, nfdv1alpha1.FeatureLabelNs)
800-
}
801-
s.MergeInto(features)
802-
}
803-
804-
klog.V(4).InfoS("merged nodeFeatureSpecs", "newNodeFeatureSpec", utils.DelayedDumper(features))
805-
}
806-
807761
// Update node labels et al. This may also mean removing all NFD-owned
808762
// labels (et al.), for example in the case no NodeFeature objects are
809763
// present.
@@ -1528,7 +1482,13 @@ func (m *nfdMaster) getVerifiedNFDObjects(objs []*v1alpha1.NodeFeature) ([]*v1al
15281482
}
15291483

15301484
for _, obj := range objs {
1531-
isSignatureVerified, err := spiffe.VerifyDataSignature(obj.Spec, obj.Annotations["signature"], workerPrivateKey, workerPublicKey)
1485+
spiffeObj := spiffe.SpiffeObject{
1486+
Spec: obj.Spec,
1487+
Name: obj.Name,
1488+
Namespace: obj.Namespace,
1489+
Labels: obj.Labels,
1490+
}
1491+
isSignatureVerified, err := spiffe.VerifyDataSignature(spiffeObj, obj.Annotations["signature"], workerPrivateKey, workerPublicKey)
15321492
if err != nil {
15331493
return nil, fmt.Errorf("failed to verify NodeFeature signature: %w", err)
15341494
}

0 commit comments

Comments
 (0)