Identity Plugin - #288
Conversation
|
@atpugtihsrah this is interesting. I did some work in the istio/isovalent ecosystem for SPIRE. Lmk if you need any help |
11f5595 to
ff81182
Compare
0748a95 to
e355b5e
Compare
|
7b49520 to
ec86027
Compare
|
good meeting this morning @atpugtihsrah! Note to other reviewers contributor is going to clean up the vendor issues and boost the plugin getting started guide. |
cadcd8d to
c3a1707
Compare
|
heads up needs rebase :-) we've been busy getting ready for a release |
c3a1707 to
b86c62e
Compare
Signed-off-by: Harshit Gupta <hg2t4e@gmail.com>
b46ddf1 to
3358c45
Compare
|
Ran the test instructions to success using kind... We can add this later: |
mikebrow
left a comment
There was a problem hiding this comment.
LGTM very nice...
would like to get this in and iterate
| type plugin struct { | ||
| stub stub.Stub | ||
| delegatedIdentityConn *grpc.ClientConn | ||
| delegatedIdentityClient delegatedidentityv1.DelegatedIdentityClient |
There was a problem hiding this comment.
Broker Endpoint API was just merged into SPIFFE and SPIRE
There was a problem hiding this comment.
maybe a TODO for covering the new broker endpoint api..
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Adds a WIP “Identity Plugin” (identity-injector) to fetch X.509 SVIDs via SPIRE’s Delegated Identity API and inject them into workload containers, along with kustomize manifests and a local-cluster setup guide.
Changes:
- Introduces the identity-injector plugin implementation (gRPC streaming watchers, file writes, annotation parsing) and a unit test for annotation parsing.
- Adds kustomize base/overlay resources to deploy the plugin as a DaemonSet.
- Adds a detailed setup guide for SPIRE/SPIFFE + local build/test flow, and wires the plugin tests into the main Makefile.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/identity-injector/identity-injector.go | Implements the identity-injector plugin, certificate/bundle streaming watchers, and annotation parsing. |
| plugins/identity-injector/identity-injector_test.go | Adds unit tests for parsing identity annotations. |
| plugins/identity-injector/go.mod | Defines the plugin module and dependencies (SPIFFE/SPIRE SDK, gRPC, yaml, etc.). |
| plugins/identity-injector/go.sum | Locks dependency checksums for the plugin module. |
| contrib/kustomize/identity-injector/kustomization.yaml | Adds a kustomize entry point for the identity-injector deployment. |
| contrib/kustomize/identity-injector/base/kustomization.yaml | Defines base resources, image override, and common labels for deployment. |
| contrib/kustomize/identity-injector/base/daemonset.yaml | Adds the DaemonSet manifest to run the plugin and mount required host paths/sockets. |
| plugins/identity-injector/setup.md | Documents end-to-end local setup for SPIRE + plugin + test workload. |
| Makefile | Adds a test target for the new identity-injector plugin. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| apiVersion: apps/v1 | ||
| kind: DaemonSet | ||
| metadata: | ||
| name: nri-plugin-identity | ||
| spec: | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: nri-plugin-identity | ||
| image: plugin:latest |
| volumeMounts: | ||
| - name: nri-socket | ||
| mountPath: /var/run/nri/nri.sock | ||
| - name: spire-admin-socket | ||
| mountPath: /run/spire/admin-socket/admin.sock | ||
| - name: spiffe-certs | ||
| mountPath: /var/run/spiffe/secrets/ | ||
| volumes: |
| - name: spire-admin-socket | ||
| hostPath: | ||
| path: /run/spire/admin-socket/admin.sock | ||
| type: Socket |
| func (p *plugin) startCertificateWatcher(ctx context.Context, pod *api.PodSandbox, ctr *api.Container, pid int32, hostDir string, config *identityConfig) error { | ||
| watcherKey := filepath.Join(pod.GetUid(), ctr.Name) | ||
|
|
||
| // Check if watcher already exists | ||
| p.watchersMu.RLock() | ||
| if _, exists := p.watchers[watcherKey]; exists { | ||
| p.watchersMu.RUnlock() | ||
| log.Debugf("%s: certificate watcher already running", containerName(pod, ctr)) | ||
| return nil | ||
| } | ||
| p.watchersMu.RUnlock() |
| p.watchersMu.RUnlock() | ||
|
|
||
| // Create cancellable context for this watcher | ||
| watcherCtx, cancel := context.WithCancel(context.Background()) |
|
|
||
| } | ||
|
|
||
| // TODO create test cases for processDelegatedIdentityUpdate() |
| sudo mkdir /tmp/spire-data | ||
|
|
||
| sudo chmod 777 /tmp/spire-data |
| sudo mkdir /var/run/spiffe/ | ||
| sudo mkdir /var/run/spiffe/secrets/ | ||
| sudo chmod 777 /var/run/spiffe/secrets/ |
| log.Errorf("%s: watcher context cancelled: %v", containerName(pod, ctr), err) | ||
| return | ||
| } | ||
|
|
||
| resp, err := stream.Recv() | ||
| if err != nil { | ||
| log.Errorf("%s: bundle stream error: %v", containerName(pod, ctr), err) |
| @@ -0,0 +1,550 @@ | |||
| This document describes how to get a test setup up and running to test the NRI Identity Plugin | |||
Identity Plugin WIP
RFC PR: #245
Relates to #240
PR Assisted by IBM Bob.