Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
00c4694
Update syncthing packages to v1.29.7
renovate-bot Jun 4, 2025
ef8d29c
Update k8s.io/utils digest to 4c0f3b2
renovate-bot Jun 5, 2025
abcc1e4
update changelog for v0.13.0-rc.3
tesshuflower Jun 12, 2025
d9c3ab7
Update codecov/codecov-action action to v5.4.3
renovate-bot May 16, 2025
cee7cf8
Bump requests from 2.32.0 to 2.32.4 in /test-e2e
dependabot[bot] Jun 10, 2025
8ec1f43
helm chart version to v0.13.0 in prep for release
tesshuflower Jun 13, 2025
86ef9d9
Update pre-commit hook renovatebot/pre-commit-hooks to v40.57.1
renovate-bot Jun 16, 2025
ae8ca3d
Bump golang.org/x/net from 0.26.0 to 0.38.0 in /custom-scorecard-tests
dependabot[bot] Apr 16, 2025
4812b28
use go 1.23 for cust scorecard tests
tesshuflower Jun 13, 2025
e90def2
stop ffwding main to release-0.13
tesshuflower Jun 17, 2025
4ebf83f
Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.3.0
dependabot[bot] Jun 27, 2025
20e5feb
Update module github.com/go-logr/logr to v1.4.3
renovate-bot May 30, 2025
19cf6ae
Update actions/download-artifact action to v4.3.0
renovate-bot Jul 2, 2025
54d28ca
Update pre-commit hook renovatebot/pre-commit-hooks to v41
renovate-bot Jun 30, 2025
9075357
Bump urllib3 from 2.4.0 to 2.5.0 in /test-e2e
dependabot[bot] Jun 19, 2025
35fccf6
Update dependency kubernetes-sigs/kustomize to v5.7.0
renovate-bot Jul 1, 2025
753c2e6
Update pre-commit hook renovatebot/pre-commit-hooks to v41.23.4
renovate-bot Jul 7, 2025
be7a278
Update actions/setup-go action to v5.5.0
renovate-bot Jul 7, 2025
a86045c
Update dependency pipenv to v2025
renovate-bot Jul 8, 2025
4073c76
Update dependency golangci/golangci-lint to v2.2.1
renovate-bot Jul 1, 2025
fa8ec77
allow utils as pkg name for linter
tesshuflower Jul 8, 2025
b3b3692
Update syncthing packages to v1.30.0
renovate-bot Jul 8, 2025
7476cef
versioning for next release v0.14, changelog etc
tesshuflower Jul 16, 2025
67af2a0
update ffwd from main->release0.14
tesshuflower Jul 16, 2025
d4ae885
Update pre-commit hook renovatebot/pre-commit-hooks to v41.23.5
renovate-bot Jul 14, 2025
8bc15f4
Update pre-commit hook renovatebot/pre-commit-hooks to v41.40.0
renovate-bot Jul 21, 2025
d85e2da
Bump golang.org/x/oauth2 in /custom-scorecard-tests
dependabot[bot] Jul 18, 2025
fc797ad
feat(kopia): implement Kopia API types and mover types
perfectra1n Aug 4, 2025
8572022
feat(kopia): implement tests for Kopia
perfectra1n Aug 4, 2025
e94fb78
feat(kopia): start Kopia documentation
perfectra1n Aug 4, 2025
3c45fc2
feat(kopia): implement additional fields for kopia api types
perfectra1n Aug 4, 2025
415de15
feat(kopia): update the kopia mover entry.sh for execute_action
perfectra1n Aug 4, 2025
599a739
feat(kopia): format kopia files for linting, reduce complexity to pas…
perfectra1n Aug 4, 2025
a6308dd
feat(kopia): update description for kopia api objects
perfectra1n Aug 4, 2025
70f1d7b
feat(kopia): add documentation examples for kopia usage
perfectra1n Aug 4, 2025
386fd8d
feat(kopia): catch capital "FATAL" in log filter
perfectra1n Aug 4, 2025
1b882e2
feat(kopia): add kopia e2e tests, and actually have them pass
perfectra1n Aug 4, 2025
7202a08
feat(kopia): bump golang version and set correct kopia version for do…
perfectra1n Aug 4, 2025
547e28c
feat(kopia): hopefully finish the kopia usage docs
perfectra1n Aug 4, 2025
5d6a09d
feat(kopia): add kopia override support to the helm chart and run-in-…
perfectra1n Aug 4, 2025
85e4746
feat(kopia): add missing environment variables needed for kopia cmd
perfectra1n Aug 4, 2025
b88b7d4
feat(kopia): update entry script to get repository prefix, and add so…
perfectra1n Aug 4, 2025
b228a38
feat(kopia): remove annoying log line about disabling tls
perfectra1n Aug 4, 2025
e690350
feat(kopia): add documentation around optional overrides for convenience
perfectra1n Aug 4, 2025
3fded99
feat(kopia): allow for username/hostname overrides in kopia repositories
perfectra1n Aug 4, 2025
3c44481
feat(kopia): create tests for optional overrides, and for multitenancy
perfectra1n Aug 4, 2025
47abe2c
feat(kopia): add Promtheus metrics for kopia objects
perfectra1n Aug 4, 2025
275e457
feat(kopia): add example PrometheusRule for Kopia
perfectra1n Aug 4, 2025
569e1ec
feat(kopia): update documentation for kopia metrics
perfectra1n Aug 5, 2025
0456c46
feat(kopia): also allow for overriding hostnames
perfectra1n Aug 5, 2025
84d8c77
feat(docs): implement temporary documentation action
perfectra1n Aug 5, 2025
f978f02
feat(docs): override the warning flag for releasing docs
perfectra1n Aug 5, 2025
cd20b4e
feat(kopia): add environment variables for missing kopia backends
perfectra1n Aug 5, 2025
90e8314
feat(helm): implement packaging the helm chart with the docs job
perfectra1n Aug 5, 2025
5722291
feat(readme): update readme to clarify that it's a fork and where to …
perfectra1n Aug 5, 2025
dbd42d7
feat(kopia): add documentation for all providers
perfectra1n Aug 5, 2025
a06910c
feat(kopia): mount credentials for gcs and sftp correctly
perfectra1n Aug 5, 2025
e73304b
feat(readme): update readme to specify mover image too
perfectra1n Aug 5, 2025
be0ee6d
feat(kopia): tests now pass after fixing imports
perfectra1n Aug 5, 2025
d470fb1
feat(kopia): support manual config options
perfectra1n Aug 5, 2025
b884618
feat(helm): increment chart version
perfectra1n Aug 5, 2025
2cf0c0e
feat(ci): disable additional unused jobs
perfectra1n Aug 5, 2025
3270f6f
feat(kopia): resolve bug due to kopia prometheus metrics
perfectra1n Aug 5, 2025
343b04a
feat(kopia): allow the user to not have to define KOPIA_S3_BUCKET and…
perfectra1n Aug 5, 2025
c5fc992
feat(kopia): support even more environment variables
perfectra1n Aug 5, 2025
80033a8
feat(kopia): add some more tests for kopia
perfectra1n Aug 6, 2025
5fd81f6
feat(kopia): don't print access keys to logs for debug anymore
perfectra1n Aug 6, 2025
be8e00d
feat(kopia): check if variables are set or not set
perfectra1n Aug 6, 2025
3988d5a
feat(kopia): use replicationsource name as username
perfectra1n Aug 6, 2025
c9e5810
feat(kopia): support not specifying a cache PVC, and implement fallba…
perfectra1n Aug 6, 2025
f589f74
feat(kopia): update metrics and tests for new emptydir cache type
perfectra1n Aug 6, 2025
6c0346a
feat(docs): add grafana dashboard example
perfectra1n Aug 6, 2025
15de1fd
feat(readme): update README for fork
perfectra1n Aug 6, 2025
19b4c82
feat(kopia): update example kopia alert metrics
perfectra1n Aug 6, 2025
65baf78
Update dependency golangci/golangci-lint to v2.3.1
renovate-bot Aug 6, 2025
ab935e3
fix(kopia): add missing `jq` binary to dockerfile
perfectra1n Aug 7, 2025
07f0a83
feat(kopia): support repositoryConfig object type
perfectra1n Aug 7, 2025
9e6702c
feat(kopia): implement repositoryConfig for Kopia mover
perfectra1n Aug 7, 2025
ebfa71e
feat(kopia): add repositoryConfig CRD to bundle manifests
perfectra1n Aug 7, 2025
e2c2968
fix(controller): add Finalizers to stop sync loops
perfectra1n Aug 7, 2025
2f5e7d1
feat(kopia): use ReplicationSource name for username, and namespace f…
perfectra1n Aug 7, 2025
2989184
feat(kopia): support previous field for ReplicationDestination
perfectra1n Aug 7, 2025
3b23221
feat(kopia): split up huge index docs page into multiple
perfectra1n Aug 7, 2025
af7c874
feat(kopia): support sourceIdentity CRD for easy restoration
perfectra1n Aug 8, 2025
1231acd
feat(readme): update readme examples as well
perfectra1n Aug 8, 2025
75dbe55
feat(readme): add another example
perfectra1n Aug 8, 2025
84eaa06
feat(readme): also update readme for container
perfectra1n Aug 8, 2025
dd9b189
feat(kopia): also support sourceIdentity tests
perfectra1n Aug 8, 2025
74b1671
fix(kopia): resolve duplicated function in entry mover
perfectra1n Aug 8, 2025
1b7da27
fix(kopia): resolve broken jq parsing for snapshots
perfectra1n Aug 8, 2025
87eb3d7
feat(helm): add sourceIdentity for Kopia
perfectra1n Aug 8, 2025
338d0c6
feat(readme): update helm chart version
perfectra1n Aug 8, 2025
0c0dd1c
feat(kopia): support sourcePVC and the discovery of it for Replicatio…
perfectra1n Aug 8, 2025
098ca14
feat(kopia): add sourcePVC docs to sourceIdentity docs
perfectra1n Aug 8, 2025
4ff3887
fix(kopia): add to `kopia snapshot restore` command to avoid unneeded…
perfectra1n Aug 8, 2025
87afa75
feat(kopia): use the replicationdestination namespace if one isn't de…
perfectra1n Aug 8, 2025
f84be74
feat(kopia): update the entry script for listing snapshots
perfectra1n Aug 8, 2025
7a666bb
feat(helm): increment the helm version again
perfectra1n Aug 8, 2025
f56d9a2
feat(kopia): add working autodiscovery tests
perfectra1n Aug 8, 2025
09ef3a7
fix(kopia): trailing slash fun
perfectra1n Aug 8, 2025
3c1f259
fix(kopia): try to squash the weird `//data.kopia-entry` error
perfectra1n Aug 8, 2025
1af075a
fix(kopia): since it keeps trying to write in the parent directory, l…
perfectra1n Aug 8, 2025
e75d5bb
fix(kopia): update the data path that it looks for in snapshots
perfectra1n Aug 8, 2025
70bdc29
feat(readme): update readme for working example
perfectra1n Aug 8, 2025
c2430f4
feat(kopia): support sourcePathOverride in ReplicationDestination
perfectra1n Aug 8, 2025
6aececd
feat(helm): bump helm chart version for updated CRDs too
perfectra1n Aug 8, 2025
a6af21f
fix(kopia): fix the mount path depending on if it's a source or desti…
perfectra1n Aug 9, 2025
b5a340b
feat(kopia): also "smartly" discover the `kopia.repository` from `sou…
perfectra1n Aug 9, 2025
4a88d5c
feat(helm): increment the helm chart
perfectra1n Aug 9, 2025
930cc0e
feat(docs): update docs for sourceIdentity
perfectra1n Aug 9, 2025
3143a5e
feat(readme): update readme example
perfectra1n Aug 9, 2025
2b2d1b1
feat(kopia): also support `filesystemDestination` for ReplicationSource
perfectra1n Aug 11, 2025
62b2a74
feat(ci): recreate old Helm Chart versions because I'm dumb
perfectra1n Aug 11, 2025
18110e0
feat(kopia): use `repositoryPVC` instead of `filesystemDestination`
perfectra1n Aug 11, 2025
7097ad3
feat(helm): increment chart version
perfectra1n Aug 11, 2025
aba6f38
feat(kopia): throw errors if requirements aren't met for ReplicationD…
perfectra1n Aug 11, 2025
1bcdd00
feat(helm): also increment helm chart version
perfectra1n Aug 11, 2025
975f3ea
feat(docs): clarify identity requirements for ReplicationDestinations
perfectra1n Aug 11, 2025
b2f76c7
feat(kopia): provide better metrics for passing/failing ReplicationSo…
perfectra1n Aug 11, 2025
1a9832f
feat(readme): add discord to readme
perfectra1n Aug 11, 2025
2dc2611
feat(kopia): just have the `namespace` be the `hostname` in kopia bac…
perfectra1n Aug 11, 2025
39c9b28
feat(kopia): hostnames should just be the namespace
perfectra1n Aug 11, 2025
e5abfb4
feat(kopia): set up `enableFileDeletion` and docs for not having to s…
perfectra1n Aug 11, 2025
6c13c19
feat(kopia): have the username just be the `ReplicationSource` name
perfectra1n Aug 11, 2025
8a3cd1e
feat(helm): increment chart version
perfectra1n Aug 11, 2025
c0d448c
fix(kopia): resolve issue with nil pointer dereference
perfectra1n Aug 12, 2025
33a8791
do not check for kopia updates from github
onedr0p Aug 12, 2025
7ab9424
if snapshots don't exist don't error during restore
onedr0p Aug 12, 2025
8352c3a
feat(ci): add container building step
perfectra1n Aug 12, 2025
23f5d45
feat(ci): use a matrix instead for the container
perfectra1n Aug 12, 2025
4936084
feat(ci): use a matrix instead for the container
perfectra1n Aug 13, 2025
91fbc72
fix(kopia): remove finalizers, and per onedr0p: "delaying my testing …
perfectra1n Aug 13, 2025
3d7e1bd
feat(kopia): increment helm version
perfectra1n Aug 13, 2025
d141fb0
maybe this is the right way to check if no snapshots exist
onedr0p Aug 13, 2025
bc09e9f
feat(kopia): further support global kopia repository configs
perfectra1n Aug 13, 2025
6f0c533
feat(kopia): update docs for modifying kopia repository configs
perfectra1n Aug 13, 2025
0d74426
feat(kopia): support the specification of compression in kopia reposi…
perfectra1n Aug 14, 2025
7485fbe
feat(helm): increment helm chart version
perfectra1n Aug 14, 2025
2a8914e
feat(docker): try to use bfd instead of gold in arm64
perfectra1n Aug 14, 2025
5fb1c81
fix(kopia): fix incorrect compression statement
perfectra1n Aug 14, 2025
95c55e5
feat(kopia): no longer validate compression input
perfectra1n Aug 14, 2025
6d41296
feat(kopia): update comments on volsync crds for kopia
perfectra1n Aug 15, 2025
8fc10d3
feat(kopia): support the use of additional arguments for kopia
perfectra1n Aug 16, 2025
b45410c
feat(kopia): add docs for additional args
perfectra1n Aug 16, 2025
ef5095a
feat(helm): increment version for additional args
perfectra1n Aug 16, 2025
c79b7f2
feat(kopia): allow all args
perfectra1n Aug 16, 2025
1405e66
fix(kopia): reverse the kopia snapshot selection so it shows the "mos…
perfectra1n Aug 27, 2025
b869768
fix(kopia): also implement useful unit test to make sure kopia snapsh…
perfectra1n Aug 27, 2025
7a1fefc
feat(kopia): resolve conflicts
perfectra1n Aug 27, 2025
e2e59ff
feat(kopia): continue to modify files that aren't needed for upstream
perfectra1n Aug 27, 2025
9d063d4
feat(kopia): continue to modify files that aren't needed for upstream
perfectra1n Aug 27, 2025
58490ff
feat(kopia): continue to modify files that aren't needed for upstream
perfectra1n Aug 27, 2025
35aded1
feat(kopia): continue to modify files that aren't needed for upstream
perfectra1n Aug 27, 2025
86c4be2
fix(kopia): add log level and retention controls to prevent cache PVC…
perfectra1n Aug 30, 2025
5d7eefc
feat(kopia): also change the default logging to be info, and create d…
perfectra1n Aug 30, 2025
2daa3d7
feat(docs): update defaults in docs for kopia changes
perfectra1n Aug 30, 2025
90fb931
fix(kopia): instead of setting env var, provide custom ca to s3 command
perfectra1n Sep 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions Dockerfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to warn you, we are not yet ready to move to golang 1.24 - there's actually an issue with building on arm64 right now with golang 1.24. I would also like to move to golang 1.24 separately from the mover PR. So this would either have to wait, or you can start with a build that works with 1.23.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related golang issue: golang/go#75074

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest Kopia releases only build with Golang 1.24, so unless we get the release binary instead of building from source, I'm not quite sure...

Copy link
Author

@perfectra1n perfectra1n Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did fix that in my Dockerfile though, so I'm able to build on ARM64 via this change, but I'm not sure if that aligns.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thanks for that - I may try using that myself as the golang issue seems to still be unresolved for the moment. At least that would unblock us for moving to 1.24.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
######################################################################
# Establish a common builder image for all golang-based images
FROM golang:1.23 AS golang-builder
FROM golang:1.24 AS golang-builder
USER root
WORKDIR /workspace
# We don't vendor modules. Enforce that behavior
Expand Down Expand Up @@ -46,7 +46,8 @@ WORKDIR /workspace/rclone
# Make sure the Rclone version tag matches the git hash we're expecting
RUN /bin/bash -c "[[ $(git rev-list -n 1 HEAD) == ${RCLONE_GIT_HASH} ]]"

RUN make rclone
# Tell Go to use the standard BFD linker instead of gold
RUN make rclone BUILD_ARGS="-ldflags='-extldflags=-fuse-ld=bfd'"


######################################################################
Expand All @@ -61,6 +62,22 @@ WORKDIR /workspace/restic
RUN go run build.go --enable-cgo


######################################################################
# Build kopia
FROM golang-builder AS kopia-builder

ARG KOPIA_VERSION="v0.21.1"
ARG KOPIA_GIT_HASH="0733cb4d2a731dbb92d927f66230694e014f4df2"

RUN git clone --depth 1 -b ${KOPIA_VERSION} https://github.com/kopia/kopia.git
WORKDIR /workspace/kopia

# Make sure we have the correct Kopia release
RUN /bin/bash -c "[[ $(git rev-list -n 1 HEAD) == ${KOPIA_GIT_HASH} ]]"

RUN go build -o kopia


######################################################################
# Build syncthing
FROM golang-builder AS syncthing-builder
Expand Down Expand Up @@ -117,6 +134,7 @@ WORKDIR /
RUN microdnf --refresh update -y && \
microdnf --nodocs --setopt=install_weak_deps=0 install -y \
acl `# rclone - getfacl/setfacl` \
jq `# kopia - JSON parsing in entry.sh` \
openssh `# rsync/ssh - ssh key generation in operator` \
openssh-clients `# rsync/ssh - ssh client` \
openssh-server `# rsync/ssh - ssh server` \
Expand Down Expand Up @@ -146,6 +164,12 @@ COPY /mover-restic/entry.sh \
/mover-restic/
RUN chmod a+rx /mover-restic/*.sh

##### kopia
COPY --from=kopia-builder /workspace/kopia/kopia /usr/local/bin/kopia
COPY /mover-kopia/entry.sh \
/mover-kopia/
RUN chmod a+rx /mover-kopia/*.sh

##### rsync (ssh)
COPY /mover-rsync/source.sh \
/mover-rsync/destination.sh \
Expand Down
39 changes: 33 additions & 6 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ const (
)

const (
ConditionSynchronizing string = "Synchronizing"
SynchronizingReasonSync string = "SyncInProgress"
SynchronizingReasonSched string = "WaitingForSchedule"
SynchronizingReasonManual string = "WaitingForManual"
SynchronizingReasonCleanup string = "CleaningUp"
SynchronizingReasonError string = "Error"
ConditionSynchronizing string = "Synchronizing"
SynchronizingReasonSync string = "SyncInProgress"
SynchronizingReasonSched string = "WaitingForSchedule"
SynchronizingReasonManual string = "WaitingForManual"
SynchronizingReasonError string = "Error"
)

const (
Expand Down Expand Up @@ -149,6 +148,34 @@ type CustomCASpec struct {
Key string `json:"key,omitempty"`
}

// KopiaPolicySpec defines configuration for Kopia policy files
type KopiaPolicySpec struct {
// The name of a Secret that contains Kopia policy configuration files
// If SecretName is used then ConfigMapName should not be set
SecretName string `json:"secretName,omitempty"`

// The name of a ConfigMap that contains Kopia policy configuration files
// If ConfigMapName is used then SecretName should not be set
ConfigMapName string `json:"configMapName,omitempty"`

// GlobalPolicyFilename specifies the filename for the global policy configuration.
// This file should contain a JSON policy configuration that will be applied globally.
// Defaults to "global-policy.json" if not specified.
//+optional
GlobalPolicyFilename string `json:"globalPolicyFilename,omitempty"`

// RepositoryConfigFilename specifies the filename for the repository configuration.
// This file should contain repository-specific settings like actions enablement.
// Defaults to "repository.config" if not specified.
//+optional
RepositoryConfigFilename string `json:"repositoryConfigFilename,omitempty"`

// RepositoryConfig is a multiline JSON string containing Kopia repository configuration
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Optional
RepositoryConfig *string `json:"repositoryConfig,omitempty"`
}

type MoverConfig struct {
// MoverSecurityContext allows specifying the PodSecurityContext that will
// be used by the data mover
Expand Down
139 changes: 139 additions & 0 deletions api/v1alpha1/replicationdestination_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ type ReplicationDestinationSpec struct {
// restic defines the configuration when using Restic-based replication.
//+optional
Restic *ReplicationDestinationResticSpec `json:"restic,omitempty"`
// kopia defines the configuration when using Kopia-based replication.
//+optional
Kopia *ReplicationDestinationKopiaSpec `json:"kopia,omitempty"`
// external defines the configuration when using an external replication
// provider.
//+optional
Expand Down Expand Up @@ -264,6 +267,139 @@ type ReplicationDestinationResticSpec struct {
MoverConfig `json:",inline"`
}

type ReplicationDestinationKopiaCA CustomCASpec

// KopiaSourceIdentity defines helper fields to identify the source of snapshots to restore.
// This is the RECOMMENDED way to configure identity for Kopia ReplicationDestination.
// At minimum, SourceName must be provided (SourceNamespace defaults to current namespace).
type KopiaSourceIdentity struct {
// SourceName is the name of the ReplicationSource that created the snapshots.
// This field is REQUIRED when using SourceIdentity.
// +optional
SourceName string `json:"sourceName,omitempty"`
// SourceNamespace is the namespace of the ReplicationSource that created the snapshots.
// If not specified, defaults to the namespace of this ReplicationDestination.
// +optional
SourceNamespace string `json:"sourceNamespace,omitempty"`
// SourcePVCName is the name of the PVC that was backed up by the ReplicationSource.
// This is used to generate the exact same hostname/identity as the source.
// If not provided, VolSync will attempt to auto-discover it from the ReplicationSource.
// If auto-discovery fails, the destination PVC name will be used as a fallback.
// +optional
SourcePVCName string `json:"sourcePVCName,omitempty"`
// SourcePathOverride is the path override from the ReplicationSource.
// If not provided, VolSync will attempt to auto-discover it from the ReplicationSource.
// This allows the destination to restore from the correct snapshot path when the source
// used a different path name in the snapshot than the actual filesystem path.
// +kubebuilder:validation:Pattern="^/.*"
// +optional
SourcePathOverride *string `json:"sourcePathOverride,omitempty"`
}

// ReplicationDestinationKopiaSpec defines the field for kopia in replicationDestination.
// Identity configuration is OPTIONAL. When not provided, VolSync automatically generates:
// - Username: <destination-name>
// - Hostname: <namespace>
// This works perfectly for simple same-namespace restores when the destination name matches the source.
// For cross-namespace restores or custom identity, use SourceIdentity or provide both Username AND Hostname.
type ReplicationDestinationKopiaSpec struct {
ReplicationDestinationVolumeOptions `json:",inline"`
// Repository is the secret name containing repository info.
// When using SourceIdentity, this can be auto-discovered from the ReplicationSource.
Repository string `json:"repository,omitempty"`
// customCA is a custom CA that will be used to verify the remote
CustomCA ReplicationDestinationKopiaCA `json:"customCA,omitempty"`
// cacheCapacity can be used to set the size of the kopia metadata cache volume
//+optional
CacheCapacity *resource.Quantity `json:"cacheCapacity,omitempty"`
// cacheStorageClassName can be used to set the StorageClass of the kopia
// metadata cache volume
//+optional
CacheStorageClassName *string `json:"cacheStorageClassName,omitempty"`
// accessModes can be used to set the accessModes of kopia metadata cache volume
//+optional
CacheAccessModes []corev1.PersistentVolumeAccessMode `json:"cacheAccessModes,omitempty"`
// Set this to true to delete the kopia cache PVC (dynamically provisioned
// by VolSync) at the end of each successful ReplicationDestination sync iteration.
// Cache PVCs will always be deleted if the owning ReplicationDestination is
// removed, even if this setting is false.
// The default is false.
//+optional
CleanupCachePVC bool `json:"cleanupCachePVC,omitempty"`
// RestoreAsOf refers to the backup that is most recent as of that time.
// +kubebuilder:validation:Format="date-time"
//+optional
RestoreAsOf *string `json:"restoreAsOf,omitempty"`
// Shallow defines the shallow restore depth (only restore recent snapshots)
//+optional
Shallow *int32 `json:"shallow,omitempty"`
// Previous specifies the number of snapshots to skip before selecting one to restore from
//+optional
Previous *int32 `json:"previous,omitempty"`
// PolicyConfig defines configuration for Kopia policy files
//+optional
PolicyConfig *KopiaPolicySpec `json:"policyConfig,omitempty"`
// SourceIdentity provides an easy way to specify which ReplicationSource's snapshots to restore.
// When specified, it will be used to generate the username and hostname automatically.
// Use this for cross-namespace restores or when the destination has a different name than the source.
// Optional: When omitted, automatic identity is used based on the destination's name and namespace.
//+optional
SourceIdentity *KopiaSourceIdentity `json:"sourceIdentity,omitempty"`
// Username for Kopia repository access.
// When provided, MUST be used together with Hostname.
// Optional: If not specified, defaults to <destination-name>-<namespace>.
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]$|^[a-zA-Z0-9]$"
//+optional
Username *string `json:"username,omitempty"`
// Hostname for Kopia repository access.
// When provided, MUST be used together with Username.
// Optional: If not specified, defaults to the namespace name.
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]$|^[a-zA-Z0-9]$"
//+optional
Hostname *string `json:"hostname,omitempty"`
// enableFileDeletion will clean the destination directory before restore to ensure
// it exactly matches the snapshot. Files and directories in the destination that don't
// exist in the snapshot will be removed (except lost+found).
// Defaults to false.
//+optional
EnableFileDeletion *bool `json:"enableFileDeletion,omitempty"`
// AdditionalArgs allows specifying additional command-line arguments for Kopia.
// These arguments will be passed to Kopia restore commands during restore operations.
// This provides flexibility for advanced users to utilize Kopia features not directly
// exposed by VolSync. Use with caution as invalid arguments may cause restore failures.
// Security-sensitive flags like --password and --config-file are not allowed.
// Example: ["--ignore-permission-errors", "--parallel=8"]
// +kubebuilder:validation:MaxItems=20
// +optional
AdditionalArgs []string `json:"additionalArgs,omitempty"`

MoverConfig `json:",inline"`
}

// KopiaIdentityInfo provides information about available Kopia snapshot identities
type KopiaIdentityInfo struct {
// Identity is the username@hostname identifier
Identity string `json:"identity"`
// SnapshotCount is the number of snapshots for this identity
SnapshotCount int32 `json:"snapshotCount"`
// LatestSnapshot is the timestamp of the most recent snapshot
//+optional
LatestSnapshot *metav1.Time `json:"latestSnapshot,omitempty"`
}

// ReplicationDestinationKopiaStatus defines status information for Kopia-based replication.
type ReplicationDestinationKopiaStatus struct {
// RequestedIdentity is the username@hostname that was requested for restore
//+optional
RequestedIdentity string `json:"requestedIdentity,omitempty"`
// SnapshotsFound is the number of snapshots found for the requested identity
//+optional
SnapshotsFound int32 `json:"snapshotsFound,omitempty"`
// AvailableIdentities lists the identities available in the repository
//+optional
AvailableIdentities []KopiaIdentityInfo `json:"availableIdentities,omitempty"`
}

// ReplicationDestinationStatus defines the observed state of ReplicationDestination
type ReplicationDestinationStatus struct {
// lastSyncTime is the time of the most recent successful synchronization.
Expand Down Expand Up @@ -299,6 +435,9 @@ type ReplicationDestinationStatus struct {
// used.
//+optional
External map[string]string `json:"external,omitempty"`
// kopia contains status information for Kopia-based replication.
//+optional
Kopia *ReplicationDestinationKopiaStatus `json:"kopia,omitempty"`
// conditions represent the latest available observations of the
// destination's state.
Conditions []metav1.Condition `json:"conditions,omitempty"`
Expand Down
Loading