diff --git a/charts/snapshot/templates/_helpers.tpl b/charts/snapshot/templates/_helpers.tpl index c785fb249..52e6db7a3 100644 --- a/charts/snapshot/templates/_helpers.tpl +++ b/charts/snapshot/templates/_helpers.tpl @@ -199,6 +199,11 @@ reads for rootfs-diff capture, and CRI-O config.json fallback). {{/* Remote agents must never run without the corresponding admission guard. */}} {{- define "snapshot.provenanceChecks" -}} +{{- if and .Values.operator.enabled (not .Values.operator.mountArtifactPVC) -}} + {{- if or (not .Values.provenance.consumer.enabled) .Values.daemonset.enabled -}} + {{- fail "operator.mountArtifactPVC=false requires a provenance consumer without a local agent" -}} + {{- end -}} +{{- end -}} {{- if .Values.provenance.consumer.enabled -}} {{- if not .Values.operator.enabled -}}{{- fail "provenance.consumer requires operator.enabled=true" -}}{{- end -}} {{- $_ := required "provenance.consumer.namespace is required" .Values.provenance.consumer.namespace -}} diff --git a/charts/snapshot/templates/operator-deployment.yaml b/charts/snapshot/templates/operator-deployment.yaml index 357839003..f43dfe63b 100644 --- a/charts/snapshot/templates/operator-deployment.yaml +++ b/charts/snapshot/templates/operator-deployment.yaml @@ -106,8 +106,15 @@ spec: readOnly: true volumes: - name: checkpoints + {{- if .Values.operator.mountArtifactPVC }} persistentVolumeClaim: claimName: {{ .Values.storage.pvc.name }} + {{- else }} + # Remote agents own every artifact. Local maintenance sees an empty + # directory; the workload claim may be pinned to a virtual node. + emptyDir: + sizeLimit: 16Mi + {{- end }} - name: storage-config configMap: name: {{ include "snapshot.fullname" . }}-config diff --git a/charts/snapshot/tests/artifact_cleanup_test.yaml b/charts/snapshot/tests/artifact_cleanup_test.yaml index 5667fb606..6f45de748 100644 --- a/charts/snapshot/tests/artifact_cleanup_test.yaml +++ b/charts/snapshot/tests/artifact_cleanup_test.yaml @@ -5,6 +5,43 @@ suite: PodSnapshotContent artifact cleanup templates: - templates/operator-deployment.yaml tests: + - it: keeps a remote-only consumer independent of workload PVC scheduling + set: + daemonset.enabled: false + operator.mountArtifactPVC: false + operator.artifactCleanup.remoteAgentNodes: [virtual-a] + provenance.consumer: + enabled: true + namespace: source + asserts: + - equal: + path: spec.template.spec.volumes[0].emptyDir.sizeLimit + value: 16Mi + - notExists: + path: spec.template.spec.volumes[0].persistentVolumeClaim + - contains: + path: spec.template.spec.containers[0].args + content: --artifact-cleanup-remote-agent-nodes=virtual-a + - it: refuses to remove artifact access from an operator with a local agent + set: + operator.mountArtifactPVC: false + operator.artifactCleanup.remoteAgentNodes: [virtual-a] + provenance.consumer: + enabled: true + namespace: source + asserts: + - failedTemplate: + errorPattern: operator.mountArtifactPVC=false requires a provenance consumer without a local agent + - it: refuses to remove artifact access without remote cleanup delegation + set: + daemonset.enabled: false + operator.mountArtifactPVC: false + provenance.consumer: + enabled: true + namespace: source + asserts: + - failedTemplate: + errorPattern: provenance.consumer requires artifactCleanup.remoteAgentNodes - it: mounts shared artifact storage and wires cleanup defaults asserts: - equal: diff --git a/charts/snapshot/values.yaml b/charts/snapshot/values.yaml index c7be09e63..ce74be31c 100644 --- a/charts/snapshot/values.yaml +++ b/charts/snapshot/values.yaml @@ -23,6 +23,10 @@ replicaCount: 1 operator: enabled: true + # Remote-only consumers delegate artifact access to provider agents. They + # use an empty scratch directory instead of mounting the provider's PVC. + # Disabling this requires consumer provenance and a disabled local agent. + mountArtifactPVC: true resources: limits: cpu: 500m diff --git a/docs/operations/liqo-control-plane.md b/docs/operations/liqo-control-plane.md index 5236142ea..524af1327 100644 --- a/docs/operations/liqo-control-plane.md +++ b/docs/operations/liqo-control-plane.md @@ -22,6 +22,18 @@ acknowledgements are written to the consumer; Pod conditions and finalizers are written to the provider. Liqo carries the Pod status back to the consumer. Snapshot objects and their UIDs are never copied to another API server. +For a consumer with no local agents, set `operator.mountArtifactPVC: false` +alongside `daemonset.enabled: false`, consumer provenance and the delegated +`operator.artifactCleanup.remoteAgentNodes`. The operator uses an empty scratch +directory for local maintenance instead of mounting the workload artifact +claim. This lets it stay on a control-plane node when that claim is bound to a +provider virtual node. Provider agents still mount the real artifact PVC; +the consumer's workload Pods still reference their scheduling claim. +Mixed local/remote installations and clusters with existing native content must +keep the operator's PVC mount enabled. Inventory existing content before +disabling the mount; local maintenance cannot inspect another store through +the scratch directory. + ## Required binding An agent binds exactly one consumer namespace, accepted Liqo NamespaceMap