feat: add InitContainers, Volumes, VolumeMounts for Fulcio and CTLog - #2175
feat: add InitContainers, Volumes, VolumeMounts for Fulcio and CTLog#2175sampras343 wants to merge 3 commits into
Conversation
PR Summary by Qodofeat: signer-agnostic InitContainers, Volumes, VolumeMounts and Auth for Fulcio/CTlog
AI Description
Diagram
High-Level Assessment
Files changed (19)
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2175 +/- ##
==========================================
- Coverage 56.71% 56.38% -0.33%
==========================================
Files 285 285
Lines 16168 16365 +197
==========================================
+ Hits 9169 9228 +59
- Misses 6046 6178 +132
- Partials 953 959 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review by Qodo
1.
|
bbd4fb6 to
6f9e6c1
Compare
6f9e6c1 to
ac30fc2
Compare
b2e9985 to
92cf893
Compare
92cf893 to
27b64a4
Compare
27b64a4 to
9315a79
Compare
|
/retest |
1 similar comment
|
/retest |
osmman
left a comment
There was a problem hiding this comment.
The user pod-resource logic (ReconcileUserPodResources) is nested inside ensureFileCADeployment/ensureCommonDeployment. It should be its own entry in the CreateOrUpdate(...) list, split from the base deployment and from the signer-specific part:
kubernetes.CreateOrUpdate(ctx, i.Client, dp,
i.ensureDeployment(instance, RBACName, labels), // generic: replicas, selector, labels, SA, ports, probes
i.ensureFileSigner(instance), // file-CA specific: args, cert/config/oidc volumes+mounts
deployment.PodResources(instance.Spec.InitContainers, instance.Spec.Volumes,
instance.Spec.VolumeMounts, containerName),
ensure.ControllerReference[*v1.Deployment](instance, i.Client),
ensure.Labels[*v1.Deployment](...),
deployment.PodRequirements(instance.Spec.PodRequirements, containerName),
deployment.PodSecurityContext(),
)Reason: whatever the user sets in Spec.InitContainers/Volumes/VolumeMounts should just get applied to the deployment — the ensure function has no business knowing which signer is active. And since it's generic, the same fields and the same PodResources trait belong on Rekor, TSA, and TUF too, not something reimplemented per component. Nesting it in Fulcio's file-CA function blocks all of that.
Same applies to CTLog's ensureDeployment.
|
kubernetes.CreateOrUpdate(ctx, i.Client, dp,
deployment.PodResources(instance.Spec.InitContainers,
instance.Spec.Volumes, instance.Spec.VolumeMounts, containerName),
i.ensureFileCADeployment(instance, RBACName, labels),
ensure.ControllerReference[*v1.Deployment](instance, i.Client),
ensure.Labels[*v1.Deployment](...),
deployment.PodRequirements(...),
deployment.PodSecurityContext(),
...
)The inner
|
0af195e to
f60f363
Compare
|
/retest |
1 similar comment
|
/retest |
5c4badc to
79aa923
Compare
2e02efb to
5411254
Compare
|
Addressing all review comments from @bouskaJ in commit 888a83d:
All changes tested on OCP 4.22 — stack deployed in file mode, cosign sign + verify passed. |
|
@osmman — Your review comment about extracting With 888a83d, the signature is further simplified — deployment.PodResources(instance.Spec.PodExtensions, containerName),Both Fulcio and CTLog use identical call sites in their |
Add signer-agnostic pod customization fields to FulcioSpec and CTlogSpec, enabling users to inject init containers, volumes, and volume mounts regardless of which signer backend is active. API changes: - InitContainerSpec in common.go — curated corev1.Container subset - InitContainers, Volumes, VolumeMounts on FulcioSpec and CTlogSpec Controller changes: - User-defined resources applied in shared deployment path before signer type branching - CTLog operator-managed "keys" volume set after user volumes so operator always wins on reserved names - Shared helpers: HasVolume, EnsureVolumeDefaultMode, ReconcileInitContainers - Fulcio ensureCommonDeployment extracted for shared scaffolding Housekeeping: - Remove dead HasMountPath function - v1alpha1 conversion preserves new fields via MarshalData annotations - Roundtrip fuzzer coverage for new fields Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion Move user pod-resource reconciliation (InitContainers, Volumes, VolumeMounts) from inside ensureCommonDeployment/ensureDeployment into a standalone deployment.PodResources() ensure function in the CreateOrUpdate chain. This makes the user pod-resource logic signer-agnostic and composable — the same PodResources ensure function can be reused by Rekor, TSA, and TUF without reimplementation per component. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sachin Sampras M <sampras343@gmail.com>
Address review feedback from bouskaJ: 1. VolumeMount reconciliation now assigns the whole struct instead of copying fields individually, preserving SubPathExpr, MountPropagation, and RecursiveReadOnly. 2. Add +listType=map / +listMapKey=name SSA markers on InitContainers, Volumes, VolumeMounts, and Env fields for server-side apply support. 3. Group InitContainers, Volumes, and VolumeMounts into a reusable PodExtensions struct embedded with json:",inline". This enables adding the same fields to Rekor, TSA, and TUF without duplication. 4. Replace raw core.Volume with AdditionalVolume, restricting volume sources to Secret, ConfigMap, EmptyDir, PVC, CSI, and Projected. This reduces CRD OpenAPI schema by ~7400 lines and prevents users from specifying unsupported cloud-provider volume types. 5. Add restartPolicy field to InitContainerSpec with Enum=Always validation, enabling native sidecar containers (Kubernetes 1.29+). Tested on OCP 4.22 in file mode with cosign sign/verify. Signed-off-by: Sachin Sampras M <sampras343@gmail.com>
888a83d to
2ee5264
Compare
Summary
Add signer-agnostic pod customization fields to
FulcioSpecandCTlogSpec, enabling users to inject init containers, volumes, and volume mounts regardless of which signer backend is active. This is the first of two PRs — a follow-up PR (#2181) addsAuthsupport onFulcioSigner/CTlogSigner.API Changes
InitContainerSpecincommon.go— curatedcorev1.Containersubset (name, image, command, args, env, envFrom, volumeMounts, resources, securityContext, imagePullPolicy)InitContainers []InitContainerSpeconFulcioSpecandCTlogSpec— top-level, pod-wideVolumes []corev1.VolumeonFulcioSpecandCTlogSpec— additional pod volumesVolumeMounts []corev1.VolumeMountonFulcioSpecandCTlogSpec— main server container mountsController Changes
InitContainers/Volumes/VolumeMountsapplied in shared deployment path before branching on signer type — works in file mode, not gated behind any specific backendReconcileUserPodResourceshelper inensure/pod_spec.gocalled by both Fulcio and CTLog to eliminate duplicationfulcio-config,fulcio-cert,oidc-info, CTLogkeys) use fullVolumeSourcereplacement withEnsureVolumeDefaultMode— operator always wins on reserved names, prevents infinite reconciliation loopskeysvolume set after user volumes so operator always wins if a user volume has the same nameensureCommonDeploymentextracted for shared scaffolding across signer modesHasVolume,EnsureVolumeDefaultMode,ReconcileInitContainers,ReconcileUserPodResourcesHousekeeping
HasMountPathfunctionfindVolumetest helper: return&volumes[i]instead of&v(pointer to range-variable copy)MarshalDataannotationsMarshalData/UnmarshalDatarestore pathReview Comments Addressed
(from PR #2128):
ensure/pod_spec.goensureCommonDeployment+ReconcileUserPodResourcessignerVolumesFuzzerFuncs+ctlogVolumesFuzzerFuncsReconcileUserPodResourcesshared helperTest plan
go build ./...andgo vet ./...passReconcileInitContainers,EnsureVolumeDefaultMode,HasVolumeinitContainers/volumesin file mode — fields applied to podDepends on: #2179
🤖 Generated with Claude Code