├── pkg
├── config
│ └── config.go
├── migrator
│ ├── validateController.go
│ ├── validatePods.go
│ ├── destination.go
│ ├── validateUtils.go
│ ├── validate.go
│ └── migrator.go
├── mover
│ ├── exec.go
│ ├── wait.go
│ └── mover.go
└── strategies
│ ├── strategy.go
│ ├── import.go
│ ├── export.go
│ └── copyTwiceName.go
├── main.go
├── mover
├── Dockerfile
└── entrypoint.sh
├── Makefile
├── .github
├── workflows
│ ├── korb-build.yml
│ ├── release.yml
│ ├── mover-build.yml
│ └── codeql-analysis.yml
└── dependabot.yml
├── .gitignore
├── hack
└── test-deployment.yaml
├── .goreleaser.yml
├── go.mod
├── cmd
└── root.go
├── README.md
├── go.sum
└── LICENSE
/pkg/config/config.go:
--------------------------------------------------------------------------------
1 | package config
2 |
3 | var ContainerImage = "ghcr.io/beryju/korb-mover:v2"
4 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "beryju.org/korb/v2/cmd"
4 |
5 | func main() {
6 | cmd.Execute()
7 | }
8 |
--------------------------------------------------------------------------------
/mover/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine:3
2 |
3 | RUN apk add --no-cache rsync bash tar && rm -rf /var/cache/apk/*
4 |
5 | VOLUME [ "/source", "/dest" ]
6 |
7 | COPY ./entrypoint.sh /bin/entrypoint
8 |
9 | ENTRYPOINT [ "/bin/entrypoint" ]
10 |
--------------------------------------------------------------------------------
/mover/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -xe
2 | if [[ $1 == "sync" ]]; then
3 | rsync -aHA --progress /source/ /dest
4 | elif [[ $1 == "sleep" ]]; then
5 | cat
6 | else
7 | echo "No command given. Make sure to use the correct mover image for your korb version."
8 | exit 1
9 | fi
10 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: build mover
2 |
3 | build:
4 | go build -v -o bin/korb
5 |
6 | build-final:
7 | GOOS=linux GOARCH=arm go build -v -o bin/korb-linux-arm
8 | GOOS=linux GOARCH=arm64 go build -v -o bin/korb-linux-arm64
9 | GOOS=linux GOARCH=amd64 go build -v -o bin/korb-linux-amd64
10 | GOOS=darwin GOARCH=amd64 go build -v -o bin/korb-darwin-amd64
11 |
12 | all: build
13 |
--------------------------------------------------------------------------------
/.github/workflows/korb-build.yml:
--------------------------------------------------------------------------------
1 | name: ci-build
2 |
3 | on:
4 | push:
5 | branches: [main]
6 | pull_request:
7 | branches: [main]
8 |
9 | jobs:
10 | build:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v6
14 | - uses: actions/setup-go@v6
15 | with:
16 | go-version-file: go.mod
17 | cache: true
18 | - name: Get dependencies
19 | run: |
20 | go get -v -t -d ./...
21 | - name: Build
22 | run: go build -v .
23 | - name: Test
24 | run: go test -v .
25 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "github-actions"
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 | time: "04:00"
8 | open-pull-requests-limit: 10
9 | assignees:
10 | - BeryJu
11 | - package-ecosystem: gomod
12 | directory: "/"
13 | schedule:
14 | interval: daily
15 | time: "04:00"
16 | open-pull-requests-limit: 10
17 | assignees:
18 | - BeryJu
19 | - package-ecosystem: docker
20 | directory: "/mover"
21 | schedule:
22 | interval: daily
23 | time: "04:00"
24 | open-pull-requests-limit: 10
25 | assignees:
26 | - BeryJu
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.toptal.com/developers/gitignore/api/go
2 | # Edit at https://www.toptal.com/developers/gitignore?templates=go
3 |
4 | ### Go ###
5 | # Binaries for programs and plugins
6 | *.exe
7 | *.exe~
8 | *.dll
9 | *.so
10 | *.dylib
11 |
12 | # Test binary, built with `go test -c`
13 | *.test
14 |
15 | # Output of the go coverage tool, specifically when used with LiteIDE
16 | *.out
17 |
18 | # Dependency directories (remove the comment below to include it)
19 | # vendor/
20 |
21 | ### Go Patch ###
22 | /vendor/
23 | /Godeps/
24 |
25 | # End of https://www.toptal.com/developers/gitignore/api/go
26 |
27 | bin/**
28 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: release
2 | on:
3 | push:
4 | tags:
5 | - "v*"
6 | jobs:
7 | goreleaser:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - name: Checkout
11 | uses: actions/checkout@v6
12 | - name: Unshallow
13 | run: git fetch --prune --unshallow
14 | - name: Set up Go
15 | uses: actions/setup-go@v6
16 | with:
17 | go-version-file: go.mod
18 | cache: true
19 | - name: Run GoReleaser
20 | uses: goreleaser/goreleaser-action@v6.4.0
21 | with:
22 | version: latest
23 | args: release --clean
24 | env:
25 | GITHUB_TOKEN: ${{ secrets.PAT }}
26 |
--------------------------------------------------------------------------------
/pkg/migrator/validateController.go:
--------------------------------------------------------------------------------
1 | package migrator
2 |
3 | import (
4 | appsv1 "k8s.io/api/apps/v1"
5 | corev1 "k8s.io/api/core/v1"
6 | )
7 |
8 | func (m *Migrator) getPVCControllers(pvcToCheck *corev1.PersistentVolumeClaim) ([]interface{}, error) {
9 | pods, err := m.getPVCPods(pvcToCheck)
10 | if err != nil {
11 | return nil, err
12 | }
13 |
14 | for _, pod := range pods {
15 | for _, owner := range m.resolveOwner(pod.ObjectMeta, &appsv1.StatefulSet{}) {
16 | switch owner.(type) {
17 | case *appsv1.Deployment:
18 | m.log.Debug("Found deployment")
19 | case *appsv1.StatefulSet:
20 | m.log.Debug("Found statefulset")
21 | }
22 | }
23 | }
24 |
25 | return nil, nil
26 | }
27 |
--------------------------------------------------------------------------------
/pkg/migrator/validatePods.go:
--------------------------------------------------------------------------------
1 | package migrator
2 |
3 | import (
4 | v1 "k8s.io/api/core/v1"
5 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6 | )
7 |
8 | func (m *Migrator) getPVCPods(pvcToCheck *v1.PersistentVolumeClaim) ([]v1.Pod, error) {
9 | nsPods, err := m.kClient.CoreV1().Pods(m.SourceNamespace).List(m.ctx, metav1.ListOptions{})
10 | if err != nil {
11 | return []v1.Pod{}, err
12 | }
13 |
14 | var pods []v1.Pod
15 |
16 | for _, pod := range nsPods.Items {
17 | pvcs := getPVCs(pod.Spec.Volumes)
18 |
19 | for _, pvc := range pvcs {
20 | if pvc.PersistentVolumeClaim.ClaimName == pvcToCheck.Name {
21 | m.log.WithField("pod", pod.Name).Debug("Found pod which mounts source PVC")
22 | pods = append(pods, pod)
23 | }
24 | }
25 | }
26 |
27 | return pods, nil
28 | }
29 |
--------------------------------------------------------------------------------
/hack/test-deployment.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: source-pvc
5 | spec:
6 | accessModes:
7 | - ReadWriteOnce
8 | resources:
9 | requests:
10 | storage: 10Gi
11 | ---
12 | apiVersion: apps/v1
13 | kind: Deployment
14 | metadata:
15 | name: test-deployment
16 | spec:
17 | selector:
18 | matchLabels:
19 | app: test-deployment
20 | template:
21 | metadata:
22 | labels:
23 | app: test-deployment
24 | spec:
25 | containers:
26 | - name: test-deployment
27 | image: ubuntu:latest
28 | # Just spin & wait forever
29 | command: [ "/bin/bash", "-c", "--" ]
30 | args: [ "while true; do sleep 30; done;" ]
31 | volumeMounts:
32 | - name: source-pvc
33 | mountPath: /source
34 | volumes:
35 | - name: source-pvc
36 | persistentVolumeClaim:
37 | claimName: source-pvc
38 |
--------------------------------------------------------------------------------
/.github/workflows/mover-build.yml:
--------------------------------------------------------------------------------
1 | name: ci-mover-build
2 |
3 | on:
4 | push:
5 | branches: [main]
6 | pull_request:
7 | branches: [main]
8 |
9 | jobs:
10 | build:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v6
14 | - name: Set up QEMU
15 | uses: docker/setup-qemu-action@v3
16 | - name: Set up Docker Buildx
17 | uses: docker/setup-buildx-action@v3
18 | - name: Login to GitHub Container Registry
19 | uses: docker/login-action@v3
20 | with:
21 | registry: ghcr.io
22 | username: ${{ github.repository_owner }}
23 | password: ${{ secrets.GITHUB_TOKEN }}
24 | - name: Build and push Docker images
25 | uses: docker/build-push-action@v6.18.0
26 | with:
27 | context: mover
28 | tags: ghcr.io/beryju/korb-mover:v2
29 | push: ${{ github.ref == 'refs/heads/main' }}
30 | platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
31 |
--------------------------------------------------------------------------------
/.goreleaser.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | before:
3 | hooks:
4 | - go mod tidy
5 | builds:
6 | - env:
7 | - CGO_ENABLED=0
8 | mod_timestamp: '{{ .CommitTimestamp }}'
9 | flags:
10 | - -trimpath
11 | ldflags:
12 | - '-s -w -X beryju.org/korb/cmd.Version={{.Version}}'
13 | goos:
14 | - freebsd
15 | - windows
16 | - linux
17 | - darwin
18 | goarch:
19 | - amd64
20 | - arm
21 | - arm64
22 | ignore:
23 | - goos: darwin
24 | goarch: 'arm'
25 | binary: '{{ .ProjectName }}'
26 | archives:
27 | - id: raw
28 | formats: binary
29 | name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}'
30 | - id: tar
31 | formats: tar.gz
32 | name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
33 | checksum:
34 | name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
35 | algorithm: sha256
36 | homebrew_casks:
37 | - ids:
38 | - raw
39 | commit_author:
40 | name: goreleaserbot
41 | email: goreleaser@beryju.org
42 | repository:
43 | owner: beryju
44 | name: homebrew-tap
45 | homepage: 'https://github.com/beryju/{{ .ProjectName }}'
46 | description: 'Move Kubernetes PVCs between Storage Classes and Namespaces'
47 | hooks:
48 | post:
49 | install: |
50 | if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
51 | system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/{{ .ProjectName }}"]
52 | end
53 |
--------------------------------------------------------------------------------
/pkg/mover/exec.go:
--------------------------------------------------------------------------------
1 | package mover
2 |
3 | import (
4 | "bytes"
5 | "io"
6 | "os"
7 |
8 | "github.com/goware/prefixer"
9 | v1 "k8s.io/api/core/v1"
10 | "k8s.io/client-go/kubernetes/scheme"
11 | "k8s.io/client-go/rest"
12 | "k8s.io/client-go/tools/remotecommand"
13 | )
14 |
15 | func (m *MoverJob) Exec(pod v1.Pod, config *rest.Config, cmd []string, input io.Reader, output io.Writer) error {
16 | req := m.kClient.CoreV1().RESTClient().Post().Resource("pods").Name(pod.Name).Namespace(m.Namespace).SubResource("exec")
17 | req.VersionedParams(
18 | &v1.PodExecOptions{
19 | Container: ContainerName,
20 | Command: cmd,
21 | Stdin: input != nil,
22 | Stdout: true,
23 | Stderr: true,
24 | },
25 | scheme.ParameterCodec,
26 | )
27 | exec, err := remotecommand.NewSPDYExecutor(config, "POST", req.URL())
28 | if err != nil {
29 | return err
30 | }
31 | errBuff := bytes.NewBuffer([]byte{})
32 | prefixReader := prefixer.New(errBuff, "[mover logs]: ")
33 | done := false
34 | go func() {
35 | for {
36 | _, err := io.Copy(os.Stdout, prefixReader)
37 | if err != nil && err == io.EOF {
38 | m.log.Debug("log stream complete")
39 | break
40 | }
41 |
42 | if err != nil {
43 | m.log.WithError(err).Warning("failed to copy")
44 | }
45 | if done {
46 | return
47 | }
48 | }
49 | }()
50 | err = exec.StreamWithContext(m.ctx, remotecommand.StreamOptions{
51 | Stdin: input,
52 | Stdout: output,
53 | Stderr: os.Stdout,
54 | })
55 | done = true
56 | if err != nil {
57 | return err
58 | }
59 | return nil
60 | }
61 |
--------------------------------------------------------------------------------
/pkg/migrator/destination.go:
--------------------------------------------------------------------------------
1 | package migrator
2 |
3 | import (
4 | v1 "k8s.io/api/core/v1"
5 | "k8s.io/apimachinery/pkg/api/resource"
6 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
7 | )
8 |
9 | func (m *Migrator) GetDestPVCSize(fallback resource.Quantity) resource.Quantity {
10 | var destSize resource.Quantity
11 | if m.DestPVCSize != "" {
12 | destSize = resource.MustParse(m.DestPVCSize)
13 | } else {
14 | destSize = fallback
15 | }
16 | return destSize
17 | }
18 |
19 | func (m *Migrator) GetDestPVCAccessModes(fallback []v1.PersistentVolumeAccessMode) []v1.PersistentVolumeAccessMode {
20 | var destAccessModes []v1.PersistentVolumeAccessMode
21 | if len(m.DestPVCAccessModes) > 0 {
22 | for _, accessMode := range m.DestPVCAccessModes {
23 | destAccessModes = append(destAccessModes, v1.PersistentVolumeAccessMode(accessMode))
24 | }
25 | } else {
26 | destAccessModes = fallback
27 | }
28 | return destAccessModes
29 | }
30 |
31 | func (m *Migrator) GetDestinationPVCTemplate(sourcePVC *v1.PersistentVolumeClaim) *v1.PersistentVolumeClaim {
32 | var sc *string
33 | if m.DestPVCStorageClass != "" {
34 | sc = &m.DestPVCStorageClass
35 | }
36 | destPVC := &v1.PersistentVolumeClaim{
37 | ObjectMeta: metav1.ObjectMeta{
38 | Name: m.SourcePVCName,
39 | Namespace: m.DestNamespace,
40 | Labels: sourcePVC.Labels,
41 | },
42 | Spec: v1.PersistentVolumeClaimSpec{
43 | AccessModes: m.GetDestPVCAccessModes(sourcePVC.Spec.AccessModes),
44 | Resources: v1.VolumeResourceRequirements{
45 | Requests: v1.ResourceList{
46 | v1.ResourceName(v1.ResourceStorage): m.GetDestPVCSize(*sourcePVC.Spec.Resources.Requests.Storage()),
47 | },
48 | },
49 | StorageClassName: sc,
50 | },
51 | }
52 | return destPVC
53 | }
54 |
--------------------------------------------------------------------------------
/pkg/migrator/validateUtils.go:
--------------------------------------------------------------------------------
1 | package migrator
2 |
3 | import (
4 | appsv1 "k8s.io/api/apps/v1"
5 | v1 "k8s.io/api/core/v1"
6 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
7 | )
8 |
9 | func (m *Migrator) resolveOwner(meta metav1.ObjectMeta, expectedType interface{}) []interface{} {
10 | m.log.WithField("meta", meta.Name).Debug("Walking owners")
11 | owners := make([]interface{}, 0)
12 | for _, owner := range meta.OwnerReferences {
13 | l := m.log.WithField("meta", meta.Name).WithField("owner", owner.Name).WithField("kind", owner.Kind)
14 | var ownerInstance interface{}
15 | var err error
16 | var meta metav1.ObjectMeta
17 | if owner.Kind == "ReplicaSet" {
18 | var rs *appsv1.ReplicaSet
19 | rs, err = m.kClient.AppsV1().ReplicaSets(m.SourceNamespace).Get(m.ctx, owner.Name, metav1.GetOptions{})
20 | ownerInstance = rs
21 | meta = rs.ObjectMeta
22 | } else if owner.Kind == "Deployment" {
23 | var deployment *appsv1.Deployment
24 | deployment, err = m.kClient.AppsV1().Deployments(m.SourceNamespace).Get(m.ctx, owner.Name, metav1.GetOptions{})
25 | ownerInstance = deployment
26 | meta = deployment.ObjectMeta
27 | }
28 | if err != nil {
29 | l.Warningf("Failed to get owning %s", owner.Kind)
30 | continue
31 | }
32 | owners = append(owners, m.resolveOwner(meta, expectedType)...)
33 | // if reflect.TypeOf(ownerInstance) == reflect.TypeOf(expectedType) {
34 | // l.Debug("Found matching owner")
35 | // }
36 | owners = append(owners, ownerInstance)
37 | }
38 | return owners
39 | }
40 |
41 | func getPVCs(volumes []v1.Volume) []v1.Volume {
42 | var pvcs []v1.Volume
43 |
44 | for _, volume := range volumes {
45 | if volume.VolumeSource.PersistentVolumeClaim != nil {
46 | pvcs = append(pvcs, volume)
47 | }
48 | }
49 |
50 | return pvcs
51 | }
52 |
--------------------------------------------------------------------------------
/pkg/strategies/strategy.go:
--------------------------------------------------------------------------------
1 | package strategies
2 |
3 | import (
4 | "context"
5 | "time"
6 |
7 | log "github.com/sirupsen/logrus"
8 |
9 | v1 "k8s.io/api/core/v1"
10 | "k8s.io/client-go/kubernetes"
11 | "k8s.io/client-go/rest"
12 | )
13 |
14 | type BaseStrategy struct {
15 | kConfig *rest.Config
16 | kClient *kubernetes.Clientset
17 |
18 | log *log.Entry
19 | tolerateAllNodes bool
20 | timeout time.Duration
21 | copyTimeout *time.Duration
22 | ctx context.Context
23 | }
24 |
25 | type BaseStrategyOpts struct {
26 | Config *rest.Config
27 | Client *kubernetes.Clientset
28 | TolerateAllNodes bool
29 | Timeout *time.Duration
30 | CopyTimeout *time.Duration
31 | Ctx context.Context
32 | }
33 |
34 | func NewBaseStrategy(opts *BaseStrategyOpts) BaseStrategy {
35 | var t time.Duration
36 | if opts.Timeout == nil {
37 | t = 60 * time.Second
38 | } else {
39 | t = *opts.Timeout
40 | }
41 | return BaseStrategy{
42 | kConfig: opts.Config,
43 | kClient: opts.Client,
44 | tolerateAllNodes: opts.TolerateAllNodes,
45 | timeout: t,
46 | copyTimeout: opts.CopyTimeout,
47 | ctx: opts.Ctx,
48 | log: log.WithField("component", "strategy"),
49 | }
50 | }
51 |
52 | type Strategy interface {
53 | CompatibleWithContext(MigrationContext) error
54 | Description() string
55 | Identifier() string
56 | Do(sourcePVC *v1.PersistentVolumeClaim, destTemplate *v1.PersistentVolumeClaim, WaitForTempDestPVCBind bool) error
57 | }
58 |
59 | type MigrationContext struct {
60 | PVCControllers []interface{}
61 | SourcePVC v1.PersistentVolumeClaim
62 | }
63 |
64 | func StrategyInstances(b BaseStrategy) []Strategy {
65 | s := []Strategy{
66 | NewCopyTwiceNameStrategy(b),
67 | NewExportStrategy(b),
68 | NewImportStrategy(b),
69 | }
70 | return s
71 | }
72 |
--------------------------------------------------------------------------------
/pkg/mover/wait.go:
--------------------------------------------------------------------------------
1 | package mover
2 |
3 | import (
4 | "context"
5 | "errors"
6 | "fmt"
7 | "time"
8 |
9 | v1 "k8s.io/api/core/v1"
10 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
11 | "k8s.io/apimachinery/pkg/util/wait"
12 | )
13 |
14 | func (m *MoverJob) getPods(ctx context.Context) []v1.Pod {
15 | selector := fmt.Sprintf("job-name=%s", m.Name)
16 | pods, err := m.kClient.CoreV1().Pods(m.Namespace).List(ctx, metav1.ListOptions{LabelSelector: selector})
17 | if err != nil {
18 | m.log.WithError(err).Warning("Failed to get pods")
19 | return make([]v1.Pod, 0)
20 | }
21 | return pods.Items
22 | }
23 |
24 | func (m *MoverJob) WaitForRunning(timeout time.Duration) *v1.Pod {
25 | // First we wait for all pods to be running
26 | var runningPod v1.Pod
27 | err := wait.PollUntilContextTimeout(m.ctx, 2*time.Second, timeout, true, func(ctx context.Context) (bool, error) {
28 | pods := m.getPods(ctx)
29 | if len(pods) != 1 {
30 | return false, nil
31 | }
32 | pod := pods[0]
33 | if pod.Status.Phase == v1.PodRunning || pod.Status.Phase == v1.PodSucceeded {
34 | runningPod = pod
35 | return true, nil
36 | }
37 | m.log.WithField("phase", pod.Status.Phase).Debug("Pod not in correct state yet")
38 | return false, nil
39 | })
40 | if err != nil {
41 | m.log.WithError(err).Warning("failed to wait for pod to be running")
42 | return nil
43 | }
44 | return &runningPod
45 | }
46 |
47 | func (m *MoverJob) Wait(startTimeout time.Duration, moveTimeout time.Duration) error {
48 | pod := m.WaitForRunning(startTimeout)
49 | if pod == nil {
50 | return errors.New("pod not in correct state")
51 | }
52 | runningPod := *pod
53 | go m.followLogs(runningPod)
54 |
55 | err := wait.PollUntilContextTimeout(m.ctx, 2*time.Second, moveTimeout, true, func(ctx context.Context) (bool, error) {
56 | job, err := m.kClient.BatchV1().Jobs(m.Namespace).Get(ctx, m.kJob.Name, metav1.GetOptions{})
57 | if err != nil {
58 | return false, err
59 | }
60 | if job.Status.Succeeded != int32(len(job.Spec.Template.Spec.Containers)) {
61 | return false, nil
62 | }
63 | return true, nil
64 | })
65 |
66 | if err == nil {
67 | // Job was run successfully, so we delete it to cleanup
68 | m.log.Debug("Cleaning up successful job")
69 | return m.Cleanup()
70 | }
71 | return err
72 | }
73 |
--------------------------------------------------------------------------------
/pkg/migrator/validate.go:
--------------------------------------------------------------------------------
1 | package migrator
2 |
3 | import (
4 | v1 "k8s.io/api/core/v1"
5 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6 |
7 | "beryju.org/korb/v2/pkg/strategies"
8 | )
9 |
10 | func (m *Migrator) Validate() (*v1.PersistentVolumeClaim, []strategies.Strategy) {
11 | pvc := m.validateSourcePVC()
12 | controllers, err := m.getPVCControllers(pvc)
13 | if err != nil {
14 | m.log.WithError(err).Panic("Failed to get controllers")
15 | }
16 | baseStrategy := strategies.NewBaseStrategy(&strategies.BaseStrategyOpts{
17 | Config: m.kConfig,
18 | Client: m.kClient,
19 | TolerateAllNodes: m.TolerateAllNodes,
20 | Timeout: m.Timeout,
21 | CopyTimeout: m.CopyTimeout,
22 | Ctx: m.ctx,
23 | })
24 | allStrategies := strategies.StrategyInstances(baseStrategy)
25 | compatibleStrategies := make([]strategies.Strategy, 0)
26 | ctx := strategies.MigrationContext{
27 | PVCControllers: controllers,
28 | SourcePVC: *pvc,
29 | }
30 | for _, strategy := range allStrategies {
31 | err := strategy.CompatibleWithContext(ctx)
32 | if err == nil {
33 | compatibleStrategies = append(compatibleStrategies, strategy)
34 | } else {
35 | m.log.WithError(err).Info("Strategy not compatible")
36 | }
37 | }
38 | return pvc, compatibleStrategies
39 | }
40 |
41 | func (m *Migrator) validateSourcePVC() *v1.PersistentVolumeClaim {
42 | pvc, err := m.kClient.CoreV1().PersistentVolumeClaims(m.SourceNamespace).Get(m.ctx, m.SourcePVCName, metav1.GetOptions{})
43 | if err != nil {
44 | m.log.WithError(err).Panic("Failed to get Source PVC")
45 | }
46 | m.log.WithField("uid", pvc.UID).WithField("name", pvc.Name).Debug("Got Source PVC")
47 | destPVCTemplate := m.GetDestinationPVCTemplate(pvc)
48 | sourceSize := pvc.Spec.Resources.Requests.Storage()
49 | destSize := destPVCTemplate.Spec.Resources.Requests.Storage()
50 | if sourceSize.Cmp(*destSize) == 1 {
51 | l := m.log.WithField("src-size", sourceSize.String()).WithField("destSize", destSize.String())
52 | if m.Force {
53 | l.Warning("Destination PVC is smaller than source, ignoring because force.")
54 | } else {
55 | l.Panic("Destination PVC is smaller than source.")
56 | }
57 | }
58 | if m.DestPVCName == "" {
59 | m.log.Debug("No new Name given, using old name")
60 | m.DestPVCName = pvc.Name
61 | }
62 | return pvc
63 | }
64 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | name: "CodeQL"
7 |
8 | on:
9 | push:
10 | branches: [main]
11 | pull_request:
12 | # The branches below must be a subset of the branches above
13 | branches: [main]
14 | schedule:
15 | - cron: '0 20 * * 2'
16 |
17 | jobs:
18 | analyze:
19 | name: Analyze
20 | runs-on: ubuntu-latest
21 |
22 | strategy:
23 | fail-fast: false
24 | matrix:
25 | # Override automatic language detection by changing the below list
26 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
27 | language: ['go']
28 | # Learn more...
29 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
30 |
31 | steps:
32 | - name: Checkout repository
33 | uses: actions/checkout@v6
34 |
35 | # Initializes the CodeQL tools for scanning.
36 | - name: Initialize CodeQL
37 | uses: github/codeql-action/init@v4
38 | with:
39 | languages: ${{ matrix.language }}
40 | # If you wish to specify custom queries, you can do so here or in a config file.
41 | # By default, queries listed here will override any specified in a config file.
42 | # Prefix the list here with "+" to use these queries and those in the config file.
43 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
44 |
45 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
46 | # If this step fails, then you should remove it and run the build manually (see below)
47 | - name: Autobuild
48 | uses: github/codeql-action/autobuild@v4
49 |
50 | # ℹ️ Command-line programs to run using the OS shell.
51 | # 📚 https://git.io/JvXDl
52 |
53 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
54 | # and modify them (or add more) to build your code if your project
55 | # uses a compiled language
56 |
57 | #- run: |
58 | # make bootstrap
59 | # make release
60 |
61 | - name: Perform CodeQL Analysis
62 | uses: github/codeql-action/analyze@v4
63 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module beryju.org/korb/v2
2 |
3 | go 1.25.0
4 |
5 | require (
6 | github.com/goware/prefixer v0.0.0-20160118172347-395022866408
7 | github.com/schollz/progressbar/v3 v3.18.0
8 | github.com/sirupsen/logrus v1.9.3
9 | github.com/spf13/cobra v1.10.2
10 | k8s.io/api v0.35.0
11 | k8s.io/apimachinery v0.35.0
12 | k8s.io/client-go v0.35.0
13 | )
14 |
15 | require (
16 | github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
17 | github.com/emicklei/go-restful/v3 v3.12.2 // indirect
18 | github.com/fxamacker/cbor/v2 v2.9.0 // indirect
19 | github.com/go-logr/logr v1.4.3 // indirect
20 | github.com/go-openapi/jsonpointer v0.21.0 // indirect
21 | github.com/go-openapi/jsonreference v0.21.0 // indirect
22 | github.com/go-openapi/swag v0.23.0 // indirect
23 | github.com/google/gnostic-models v0.7.0 // indirect
24 | github.com/google/uuid v1.6.0 // indirect
25 | github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
26 | github.com/inconshreveable/mousetrap v1.1.0 // indirect
27 | github.com/josharian/intern v1.0.0 // indirect
28 | github.com/json-iterator/go v1.1.12 // indirect
29 | github.com/mailru/easyjson v0.7.7 // indirect
30 | github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
31 | github.com/moby/spdystream v0.5.0 // indirect
32 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
33 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
34 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
35 | github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
36 | github.com/rivo/uniseg v0.4.7 // indirect
37 | github.com/spf13/pflag v1.0.9 // indirect
38 | github.com/x448/float16 v0.8.4 // indirect
39 | go.yaml.in/yaml/v2 v2.4.3 // indirect
40 | go.yaml.in/yaml/v3 v3.0.4 // indirect
41 | golang.org/x/net v0.47.0 // indirect
42 | golang.org/x/oauth2 v0.30.0 // indirect
43 | golang.org/x/sys v0.38.0 // indirect
44 | golang.org/x/term v0.37.0 // indirect
45 | golang.org/x/text v0.31.0 // indirect
46 | golang.org/x/time v0.9.0 // indirect
47 | google.golang.org/protobuf v1.36.8 // indirect
48 | gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
49 | gopkg.in/inf.v0 v0.9.1 // indirect
50 | gopkg.in/yaml.v3 v3.0.1 // indirect
51 | k8s.io/klog/v2 v2.130.1 // indirect
52 | k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
53 | k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
54 | sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
55 | sigs.k8s.io/randfill v1.0.0 // indirect
56 | sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
57 | sigs.k8s.io/yaml v1.6.0 // indirect
58 | )
59 |
--------------------------------------------------------------------------------
/pkg/strategies/import.go:
--------------------------------------------------------------------------------
1 | // flag: import
2 | // Behavior: Imports a tar archive into pvc
3 |
4 | package strategies
5 |
6 | import (
7 | "errors"
8 | "fmt"
9 | "os"
10 |
11 | v1 "k8s.io/api/core/v1"
12 | "k8s.io/client-go/rest"
13 |
14 | "beryju.org/korb/v2/pkg/mover"
15 | )
16 |
17 | type ImportStrategy struct {
18 | BaseStrategy
19 |
20 | TempDestPVC *v1.PersistentVolumeClaim
21 |
22 | tempMover *mover.MoverJob
23 | }
24 |
25 | func NewImportStrategy(b BaseStrategy) *ImportStrategy {
26 | s := &ImportStrategy{
27 | BaseStrategy: b,
28 | }
29 | s.log = s.log.WithField("strategy", s.Identifier())
30 | return s
31 | }
32 |
33 | func (c *ImportStrategy) Identifier() string {
34 | return "import"
35 | }
36 |
37 | func (c *ImportStrategy) CompatibleWithContext(ctx MigrationContext) error {
38 | path := fmt.Sprintf("%s.tar", ctx.SourcePVC.Name)
39 | _, err := os.Stat(path)
40 | if errors.Is(err, os.ErrNotExist) {
41 | return fmt.Errorf("expected import file '%s' does not exist", path)
42 | }
43 | return nil
44 | }
45 |
46 | func (c *ImportStrategy) Description() string {
47 | return "Import data into a PVC from a tar archive."
48 | }
49 |
50 | func (c *ImportStrategy) Do(sourcePVC *v1.PersistentVolumeClaim, destTemplate *v1.PersistentVolumeClaim, WaitForTempDestPVCBind bool) error {
51 | c.log.Warning("This strategy assumes you've stopped all pods accessing this data.")
52 |
53 | c.log.Debug("starting mover job")
54 | c.tempMover = mover.NewMoverJob(c.ctx, c.kClient, mover.MoverTypeSleep, c.tolerateAllNodes)
55 | c.tempMover.Namespace = destTemplate.ObjectMeta.Namespace
56 | c.tempMover.SourceVolume = sourcePVC
57 | c.tempMover.Name = fmt.Sprintf("korb-job-%s", sourcePVC.UID)
58 |
59 | pod := c.tempMover.Start().WaitForRunning(c.timeout)
60 | if pod == nil {
61 | c.log.Warning("Failed to move data")
62 | return c.Cleanup()
63 | }
64 | c.log.Debug("mover pod running, starting copy")
65 |
66 | err := c.CopyInto(*pod, c.kConfig, fmt.Sprintf("%s.tar", sourcePVC.Name))
67 | if err != nil {
68 | c.log.WithError(err).Warning("failed to copy file")
69 | return c.Cleanup()
70 | }
71 | c.log.Info("Finished copying into pvc")
72 | return c.Cleanup()
73 | }
74 |
75 | func (c *ImportStrategy) CopyInto(pod v1.Pod, config *rest.Config, localPath string) error {
76 | file, err := os.Open(localPath)
77 | if err != nil {
78 | return err
79 | }
80 | defer file.Close()
81 | cmd := []string{
82 | "bash",
83 | "-c",
84 | fmt.Sprintf("cd \"%s\" && tar xvzf -", mover.SourceMount),
85 | }
86 | err = c.tempMover.Exec(pod, config, cmd, file, os.Stdout)
87 | if err != nil {
88 | return err
89 | }
90 | return nil
91 | }
92 |
93 | func (c *ImportStrategy) Cleanup() error {
94 | c.log.Info("Cleaning up...")
95 | if c.tempMover != nil {
96 | return c.tempMover.Cleanup()
97 | }
98 | return nil
99 | }
100 |
--------------------------------------------------------------------------------
/pkg/strategies/export.go:
--------------------------------------------------------------------------------
1 | // flag: export
2 | // Behavior: Exports a tar archive of the pvc to your $pwd
3 |
4 | package strategies
5 |
6 | import (
7 | "fmt"
8 | "io"
9 | "os"
10 |
11 | "github.com/schollz/progressbar/v3"
12 | v1 "k8s.io/api/core/v1"
13 | "k8s.io/client-go/rest"
14 |
15 | "beryju.org/korb/v2/pkg/mover"
16 | )
17 |
18 | type ExportStrategy struct {
19 | BaseStrategy
20 |
21 | TempDestPVC *v1.PersistentVolumeClaim
22 |
23 | tempMover *mover.MoverJob
24 | }
25 |
26 | func NewExportStrategy(b BaseStrategy) *ExportStrategy {
27 | s := &ExportStrategy{
28 | BaseStrategy: b,
29 | }
30 | s.log = s.log.WithField("strategy", s.Identifier())
31 | return s
32 | }
33 |
34 | func (c *ExportStrategy) Identifier() string {
35 | return "export"
36 | }
37 |
38 | func (c *ExportStrategy) CompatibleWithContext(ctx MigrationContext) error {
39 | return nil
40 | }
41 |
42 | func (c *ExportStrategy) Description() string {
43 | return "Export PVC content into a tar archive."
44 | }
45 |
46 | func (c *ExportStrategy) Do(sourcePVC *v1.PersistentVolumeClaim, destTemplate *v1.PersistentVolumeClaim, WaitForTempDestPVCBind bool) error {
47 | c.log.Warning("This strategy assumes you've stopped all pods accessing this data.")
48 |
49 | c.log.Debug("starting mover job")
50 | c.tempMover = mover.NewMoverJob(c.ctx, c.kClient, mover.MoverTypeSleep, c.tolerateAllNodes)
51 | c.tempMover.Namespace = destTemplate.ObjectMeta.Namespace
52 | c.tempMover.SourceVolume = sourcePVC
53 | c.tempMover.Name = fmt.Sprintf("korb-job-%s", sourcePVC.UID)
54 |
55 | pod := c.tempMover.Start().WaitForRunning(c.timeout)
56 | if pod == nil {
57 | c.log.Warning("Failed to move data")
58 | return c.Cleanup()
59 | }
60 | c.log.Debug("mover pod running, starting copy")
61 |
62 | output, err := c.CopyOut(*pod, c.kConfig, sourcePVC.Name)
63 | if err != nil {
64 | c.log.WithError(err).Warning("failed to copy file")
65 | return c.Cleanup()
66 | }
67 | c.log.Info("Finished copying")
68 | c.log.Infof("Export at '%s'", output)
69 | return c.Cleanup()
70 | }
71 |
72 | func (c *ExportStrategy) CopyOut(pod v1.Pod, config *rest.Config, name string) (string, error) {
73 | file, err := os.CreateTemp(".", "korb-mover-")
74 | if err != nil {
75 | return "", err
76 | }
77 | defer file.Close()
78 | bar := progressbar.DefaultBytes(
79 | -1,
80 | "downloading",
81 | )
82 | cmd := []string{
83 | "bash",
84 | "-c",
85 | fmt.Sprintf("cd \"%s\" && tar cvzf - . ; sleep 5", mover.SourceMount),
86 | }
87 | err = c.tempMover.Exec(pod, config, cmd, nil, io.MultiWriter(file, bar))
88 | if err != nil {
89 | return "", err
90 | }
91 | finalPath := fmt.Sprintf("%s.tar", name)
92 | if err = os.Rename(file.Name(), finalPath); err != nil {
93 | return "", err
94 | }
95 | return finalPath, nil
96 | }
97 |
98 | func (c *ExportStrategy) Cleanup() error {
99 | c.log.Info("Cleaning up...")
100 | if c.tempMover != nil {
101 | return c.tempMover.Cleanup()
102 | }
103 | return nil
104 | }
105 |
--------------------------------------------------------------------------------
/pkg/migrator/migrator.go:
--------------------------------------------------------------------------------
1 | package migrator
2 |
3 | import (
4 | "context"
5 | "time"
6 |
7 | log "github.com/sirupsen/logrus"
8 |
9 | "beryju.org/korb/v2/pkg/strategies"
10 |
11 | "k8s.io/client-go/kubernetes"
12 | "k8s.io/client-go/rest"
13 | "k8s.io/client-go/tools/clientcmd"
14 | )
15 |
16 | type Migrator struct {
17 | SourceNamespace string
18 | SourcePVCName string
19 |
20 | DestNamespace string
21 | DestPVCStorageClass string
22 | DestPVCSize string
23 | DestPVCName string
24 | DestPVCAccessModes []string
25 |
26 | Force bool
27 | WaitForTempDestPVCBind bool
28 | TolerateAllNodes bool
29 | Timeout *time.Duration
30 | CopyTimeout *time.Duration
31 |
32 | kConfig *rest.Config
33 | kClient *kubernetes.Clientset
34 |
35 | log *log.Entry
36 | strategy string
37 | ctx context.Context
38 | }
39 |
40 | func New(ctx context.Context, kubeconfigPath string, strategy string, tolerateAllNode bool) *Migrator {
41 | m := &Migrator{
42 | log: log.WithField("component", "migrator"),
43 | ctx: ctx,
44 | TolerateAllNodes: tolerateAllNode,
45 | strategy: strategy,
46 | }
47 | if kubeconfigPath != "" {
48 | m.log.WithField("kubeconfig", kubeconfigPath).Debug("Created client from kubeconfig")
49 | cc := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
50 | &clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeconfigPath},
51 | &clientcmd.ConfigOverrides{})
52 |
53 | // use the current context in kubeconfig
54 | config, err := cc.ClientConfig()
55 | if err != nil {
56 | m.log.WithError(err).Panic("Failed to get client config")
57 | }
58 | m.kConfig = config
59 | ns, _, err := cc.Namespace()
60 | if err != nil {
61 | m.log.WithError(err).Panic("Failed to get current namespace")
62 | } else {
63 | m.log.WithField("namespace", ns).Debug("Got current namespace")
64 | m.SourceNamespace = ns
65 | m.DestNamespace = ns
66 | }
67 | } else {
68 | m.log.Panic("Kubeconfig cannot be empty")
69 | }
70 |
71 | // create the clientset
72 | clientset, err := kubernetes.NewForConfig(m.kConfig)
73 | if err != nil {
74 | panic(err.Error())
75 | }
76 | m.kClient = clientset
77 | return m
78 | }
79 |
80 | func (m *Migrator) Run() {
81 | sourcePVC, compatibleStrategies := m.Validate()
82 | m.log.Debug("Compatible Strategies:")
83 | for _, compatibleStrategy := range compatibleStrategies {
84 | m.log.WithField("identifier", compatibleStrategy.Identifier()).Debug(compatibleStrategy.Description())
85 | }
86 | destTemplate := m.GetDestinationPVCTemplate(sourcePVC)
87 | destTemplate.Name = m.DestPVCName
88 |
89 | var selected strategies.Strategy
90 |
91 | if len(compatibleStrategies) == 1 {
92 | m.log.Debug("Only one compatible strategy, running")
93 | selected = compatibleStrategies[0]
94 | } else {
95 | for _, strat := range compatibleStrategies {
96 | if strat.Identifier() == m.strategy {
97 | m.log.WithField("identifier", strat.Identifier()).Debug("User selected strategy")
98 | selected = strat
99 | break
100 | }
101 | }
102 | }
103 | if selected == nil {
104 | m.log.Error("No (compatible) strategy selected.")
105 | return
106 | }
107 | err := selected.Do(sourcePVC, destTemplate, m.WaitForTempDestPVCBind)
108 | if err != nil {
109 | m.log.WithError(err).Warning("Failed to migrate")
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/pkg/mover/mover.go:
--------------------------------------------------------------------------------
1 | package mover
2 |
3 | import (
4 | "context"
5 | "io"
6 | "os"
7 | "errors"
8 |
9 | "github.com/goware/prefixer"
10 | log "github.com/sirupsen/logrus"
11 |
12 | "beryju.org/korb/v2/pkg/config"
13 |
14 | batchv1 "k8s.io/api/batch/v1"
15 | corev1 "k8s.io/api/core/v1"
16 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
17 | "k8s.io/client-go/kubernetes"
18 | )
19 |
20 | const (
21 | ContainerName = "mover"
22 | )
23 |
24 | type MoverType string
25 |
26 | const (
27 | MoverTypeSync MoverType = "sync"
28 | MoverTypeSleep MoverType = "sleep"
29 | )
30 |
31 | const (
32 | SourceMount = "/source"
33 | DestMount = "/dest"
34 | )
35 |
36 | type MoverJob struct {
37 | Name string
38 | Namespace string
39 | SourceVolume *corev1.PersistentVolumeClaim
40 | DestVolume *corev1.PersistentVolumeClaim
41 |
42 | kJob *batchv1.Job
43 | kClient *kubernetes.Clientset
44 |
45 | mode MoverType
46 | log *log.Entry
47 | tolerateAllNodes bool
48 | ctx context.Context
49 | }
50 |
51 | func NewMoverJob(ctx context.Context, client *kubernetes.Clientset, mode MoverType, tolerateAllNodes bool) *MoverJob {
52 | return &MoverJob{
53 | kClient: client,
54 | log: log.WithField("component", "mover-job"),
55 | tolerateAllNodes: tolerateAllNodes,
56 | mode: mode,
57 | ctx: ctx,
58 | }
59 | }
60 |
61 | func (m *MoverJob) Start() *MoverJob {
62 | volumes := []corev1.Volume{
63 | {
64 | Name: "source",
65 | VolumeSource: corev1.VolumeSource{
66 | PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
67 | ClaimName: m.SourceVolume.Name,
68 | ReadOnly: false,
69 | },
70 | },
71 | },
72 | }
73 | mounts := []corev1.VolumeMount{
74 | {
75 | Name: "source",
76 | MountPath: SourceMount,
77 | },
78 | }
79 | if m.mode == MoverTypeSync {
80 | volumes = append(volumes, corev1.Volume{
81 | Name: "dest",
82 | VolumeSource: corev1.VolumeSource{
83 | PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
84 | ClaimName: m.DestVolume.Name,
85 | ReadOnly: false,
86 | },
87 | },
88 | })
89 | mounts = append(mounts, corev1.VolumeMount{
90 | Name: "dest",
91 | MountPath: DestMount,
92 | })
93 | }
94 |
95 | job := &batchv1.Job{
96 | ObjectMeta: metav1.ObjectMeta{
97 | Name: m.Name,
98 | Namespace: m.Namespace,
99 | },
100 | Spec: batchv1.JobSpec{
101 | Template: corev1.PodTemplateSpec{
102 | ObjectMeta: metav1.ObjectMeta{
103 | Annotations: map[string]string{
104 | "sidecar.istio.io/inject": "false",
105 | "linkerd.io/inject": "disabled",
106 | },
107 | },
108 | Spec: corev1.PodSpec{
109 | Volumes: volumes,
110 | RestartPolicy: corev1.RestartPolicyOnFailure,
111 | Containers: []corev1.Container{
112 | {
113 | Name: ContainerName,
114 | Image: config.ContainerImage,
115 | ImagePullPolicy: corev1.PullAlways,
116 | Args: []string{string(m.mode)},
117 | VolumeMounts: mounts,
118 | TTY: true,
119 | Stdin: true,
120 | },
121 | },
122 | },
123 | },
124 | },
125 | }
126 |
127 | if m.tolerateAllNodes {
128 | job.Spec.Template.Spec.Tolerations = []corev1.Toleration{
129 | {
130 | Operator: corev1.TolerationOpExists,
131 | },
132 | }
133 | }
134 |
135 | j, err := m.kClient.BatchV1().Jobs(m.Namespace).Create(m.ctx, job, metav1.CreateOptions{})
136 | if err != nil {
137 | panic(err)
138 | }
139 | m.kJob = j
140 | return m
141 | }
142 |
143 | func (m *MoverJob) followLogs(pod corev1.Pod) {
144 | req := m.kClient.CoreV1().Pods(m.Namespace).GetLogs(pod.Name, &corev1.PodLogOptions{
145 | Follow: true,
146 | Container: ContainerName,
147 | })
148 | podLogs, err := req.Stream(m.ctx)
149 | if err != nil {
150 | m.log.WithError(err).Warning("error opening log stream")
151 | return
152 | }
153 | defer podLogs.Close()
154 | prefixReader := prefixer.New(podLogs, "[mover logs]: ")
155 |
156 | for {
157 | _, err := io.Copy(os.Stdout, prefixReader)
158 | if errors.Is(err, io.EOF) {
159 | m.log.Debug("log stream complete")
160 | break
161 | }
162 |
163 | if err != nil {
164 | m.log.WithError(err).Warning("failed to copy")
165 | }
166 | }
167 | }
168 |
169 | func (m *MoverJob) getDeleteOptions() metav1.DeleteOptions {
170 | policy := metav1.DeletePropagationForeground
171 | return metav1.DeleteOptions{
172 | PropagationPolicy: &policy,
173 | }
174 | }
175 |
176 | func (m *MoverJob) Cleanup() error {
177 | err := m.kClient.BatchV1().Jobs(m.Namespace).Delete(m.ctx, m.Name, m.getDeleteOptions())
178 | if err != nil {
179 | m.log.WithError(err).WithField("name", m.Name).Debug("Failed to delete job")
180 | return err
181 | }
182 | pods := m.getPods(m.ctx)
183 | for _, pod := range pods {
184 | err := m.kClient.CoreV1().Pods(m.Namespace).Delete(m.ctx, pod.Name, m.getDeleteOptions())
185 | if err != nil {
186 | m.log.WithError(err).WithField("name", pod.Name).Warning("failed to delete pod")
187 | }
188 | }
189 | return nil
190 | }
191 |
--------------------------------------------------------------------------------
/cmd/root.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "os"
7 | "os/signal"
8 | "path/filepath"
9 | "time"
10 |
11 | log "github.com/sirupsen/logrus"
12 |
13 | "beryju.org/korb/v2/pkg/config"
14 | "beryju.org/korb/v2/pkg/migrator"
15 |
16 | "github.com/spf13/cobra"
17 | "k8s.io/client-go/util/homedir"
18 | )
19 |
20 | var (
21 | kubeConfig string
22 | sourceNamespace string
23 | strategy string
24 | )
25 |
26 | var (
27 | pvcNewStorageClass string
28 | pvcNewSize string
29 | pvcNewName string
30 | pvcNewNamespace string
31 | pvcNewAccessModes []string
32 | )
33 |
34 | var (
35 | debug bool
36 | force bool
37 | skipWaitPVCBind bool
38 | tolerateAllNodes bool
39 | timeout string
40 | copyTimeout string
41 | )
42 |
43 | var Version string
44 |
45 | // rootCmd represents the base command when called without any subcommands
46 | var rootCmd = &cobra.Command{
47 | Use: "korb [pvc [pvc]]",
48 | Version: Version,
49 | Long: `Move data between Kubernetes PVCs on different Storage Classes.`,
50 | Args: cobra.MinimumNArgs(1),
51 | Run: rootCmdRun,
52 | }
53 |
54 | func rootCmdRun(cmd *cobra.Command, args []string) {
55 | if debug {
56 | log.SetLevel(log.DebugLevel)
57 | }
58 |
59 | var t *time.Duration
60 | if timeout != "" {
61 | _t, err := time.ParseDuration(timeout)
62 | if err != nil {
63 | log.WithError(err).Panic("Failed to parse custom duration")
64 | return
65 | }
66 | t = &_t
67 | }
68 |
69 | var cT *time.Duration
70 | if copyTimeout != "" {
71 | _cT, err := time.ParseDuration(copyTimeout)
72 | if err != nil {
73 | log.WithError(err).Panic("Failed to parse custom copy timeout")
74 | return
75 | }
76 | cT = &_cT
77 | }
78 |
79 | for _, pvc := range args {
80 | m := migrator.New(cmd.Context(), kubeConfig, strategy, tolerateAllNodes)
81 | m.Force = force
82 | m.WaitForTempDestPVCBind = skipWaitPVCBind
83 | m.Timeout = t
84 | m.CopyTimeout = cT
85 |
86 | // We can only support operating in a single namespace currently
87 | // Since cross-namespace PVC mounts are not a thing
88 | // we'd have to transfer the data over the network, which uh
89 | // I don't really feel like implementing it
90 | if sourceNamespace != "" {
91 | m.SourceNamespace = sourceNamespace
92 | m.DestNamespace = sourceNamespace
93 | }
94 | // if pvcNewNamespace != "" {
95 | // m.DestNamespace = pvcNewNamespace
96 | // }
97 |
98 | m.DestPVCSize = pvcNewSize
99 | m.DestPVCStorageClass = pvcNewStorageClass
100 | m.DestPVCName = pvcNewName
101 | m.DestPVCAccessModes = pvcNewAccessModes
102 |
103 | m.SourcePVCName = pvc
104 | m.Run()
105 | if len(args) > 1 {
106 | fmt.Println("=====================")
107 | }
108 | }
109 | }
110 |
111 | // Execute adds all child commands to the root command and sets flags appropriately.
112 | // This is called by main.main(). It only needs to happen once to the rootCmd.
113 | func Execute() {
114 | ctx, cncl := signal.NotifyContext(context.Background(), os.Kill, os.Interrupt)
115 | defer cncl()
116 |
117 | if err := rootCmd.ExecuteContext(ctx); err != nil {
118 | fmt.Println(err)
119 | os.Exit(1)
120 | }
121 | }
122 |
123 | func init() {
124 | log.SetLevel(log.InfoLevel)
125 |
126 | if home := homedir.HomeDir(); home != "" {
127 | rootCmd.Flags().StringVar(&kubeConfig, "kube-config", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
128 | } else {
129 | rootCmd.Flags().StringVar(&kubeConfig, "kube-config", "", "absolute path to the kubeconfig file")
130 | }
131 | rootCmd.Flags().BoolVar(&debug, "debug", false, "enable debug logging")
132 | rootCmd.Flags().StringVar(&sourceNamespace, "source-namespace", "", "Namespace where the old PVCs reside. If empty, the namespace from your kubeconfig file will be used.")
133 |
134 | rootCmd.Flags().StringVar(&pvcNewStorageClass, "new-pvc-storage-class", "", "Storage class to use for the new PVC. If empty, the storage class of the source will be used.")
135 | rootCmd.Flags().StringVar(&pvcNewName, "new-pvc-name", "", "Name for the new PVC. If empty, same name will be reused.")
136 | rootCmd.Flags().StringVar(&pvcNewSize, "new-pvc-size", "", "Size for the new PVC. If empty, the size of the source will be used. Accepts formats like used in Kubernetes Manifests (Gi, Ti, ...)")
137 | rootCmd.Flags().StringVar(&pvcNewNamespace, "new-pvc-namespace", "", "Namespace for the new PVCs to be created in. If empty, the namespace from your kubeconfig file will be used.")
138 | rootCmd.Flags().StringSliceVar(&pvcNewAccessModes, "new-pvc-access-mode", []string{}, "Access mode(s) for the new PVC. If empty, the access mode of the source will be used. Accepts formats like used in Kubernetes Manifests (ReadWriteOnce, ReadWriteMany, ...)")
139 |
140 | rootCmd.Flags().BoolVar(&force, "force", false, "Ignore warning which would normally halt the tool during validation.")
141 | rootCmd.Flags().BoolVar(&skipWaitPVCBind, "skip-pvc-bind-wait", false, "Skip waiting for PVC to be bound.")
142 | rootCmd.Flags().BoolVar(&tolerateAllNodes, "tolerate-any-node", false, "Allow job to tolerating any node node taints.")
143 |
144 | rootCmd.Flags().StringVar(&config.ContainerImage, "container-image", config.ContainerImage, "Image to use for moving jobs")
145 | rootCmd.Flags().StringVar(&strategy, "strategy", "", "Strategy to use, by default will try to auto-select")
146 | rootCmd.Flags().StringVar(&timeout, "timeout", "", "Overwrite auto-generated timeout (by default 60s for Pod to start, copy timeout is based on PVC size)")
147 | rootCmd.Flags().StringVar(©Timeout, "copyTimeout", "", "Overwrite auto-generated copy timeout (by default 60s/GB of volume data)")
148 |
149 | }
150 |
--------------------------------------------------------------------------------
/pkg/strategies/copyTwiceName.go:
--------------------------------------------------------------------------------
1 | // flag: copy-twice-name
2 | // Behavior: Copy the PVC to the new Storage class and with new size and a new name, delete the old PVC, and copy it back to the old name.
3 |
4 | package strategies
5 |
6 | import (
7 | "context"
8 | "fmt"
9 | "time"
10 |
11 | v1 "k8s.io/api/core/v1"
12 | "k8s.io/apimachinery/pkg/api/errors"
13 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
14 | "k8s.io/apimachinery/pkg/util/wait"
15 |
16 | "beryju.org/korb/v2/pkg/mover"
17 | )
18 |
19 | type CopyTwiceNameStrategy struct {
20 | BaseStrategy
21 |
22 | DestPVC *v1.PersistentVolumeClaim
23 | TempDestPVC *v1.PersistentVolumeClaim
24 |
25 | tempMover *mover.MoverJob
26 | finalMover *mover.MoverJob
27 |
28 | MoveTimeout time.Duration
29 |
30 | WaitForTempDestPVCBind bool
31 |
32 | pvcsToDelete []*v1.PersistentVolumeClaim
33 | }
34 |
35 | func NewCopyTwiceNameStrategy(b BaseStrategy) *CopyTwiceNameStrategy {
36 | s := &CopyTwiceNameStrategy{
37 | BaseStrategy: b,
38 | pvcsToDelete: make([]*v1.PersistentVolumeClaim, 0),
39 | }
40 | s.log = s.log.WithField("strategy", s.Identifier())
41 | return s
42 | }
43 |
44 | func (c *CopyTwiceNameStrategy) Identifier() string {
45 | return "copy-twice-name"
46 | }
47 |
48 | func (c *CopyTwiceNameStrategy) CompatibleWithContext(ctx MigrationContext) error {
49 | return nil
50 | }
51 |
52 | func (c *CopyTwiceNameStrategy) Description() string {
53 | return "Copy the PVC to the new Storage class and with new size and a new name, delete the old PVC, and copy it back to the old name."
54 | }
55 |
56 | func (c *CopyTwiceNameStrategy) getDeleteOptions() metav1.DeleteOptions {
57 | policy := metav1.DeletePropagationForeground
58 | return metav1.DeleteOptions{
59 | PropagationPolicy: &policy,
60 | }
61 | }
62 |
63 | func (c *CopyTwiceNameStrategy) Do(sourcePVC *v1.PersistentVolumeClaim, destTemplate *v1.PersistentVolumeClaim, WaitForTempDestPVCBind bool) error {
64 | c.setTimeout(destTemplate)
65 | c.log.Warning("This strategy assumes you've stopped all pods accessing this data.")
66 | suffix := time.Now().Unix()
67 | tempDest := destTemplate.DeepCopy()
68 | tempDest.Name = fmt.Sprintf("%s-copy-%d", tempDest.Name, suffix)
69 |
70 | c.log.WithField("stage", 1).Debug("creating temporary PVC")
71 | tempDestInst, err := c.kClient.CoreV1().PersistentVolumeClaims(destTemplate.ObjectMeta.Namespace).Create(c.ctx, tempDest, metav1.CreateOptions{})
72 | c.TempDestPVC = tempDestInst
73 | if err != nil {
74 | return err
75 | }
76 |
77 | if c.WaitForTempDestPVCBind {
78 | err = c.waitForBound(tempDest)
79 | if err != nil {
80 | c.log.WithError(err).Warning("Waiting for PVC to be bound failed")
81 | return c.Cleanup()
82 | }
83 | } else {
84 | c.log.WithField("stage", 2).Debug("skipping waiting for PVC to be bound")
85 | }
86 |
87 | c.log.WithField("stage", 2).Debug("starting mover job")
88 | c.tempMover = mover.NewMoverJob(c.ctx, c.kClient, mover.MoverTypeSync, c.tolerateAllNodes)
89 | c.tempMover.Namespace = destTemplate.Namespace
90 | c.tempMover.SourceVolume = sourcePVC
91 | c.tempMover.DestVolume = c.TempDestPVC
92 | c.tempMover.Name = fmt.Sprintf("korb-job-%s", sourcePVC.UID)
93 | err = c.tempMover.Start().Wait(c.timeout, c.MoveTimeout)
94 | if err != nil {
95 | c.log.WithError(err).Warning("Failed to move data")
96 | c.pvcsToDelete = []*v1.PersistentVolumeClaim{c.TempDestPVC}
97 | return c.Cleanup()
98 | }
99 |
100 | c.log.WithField("stage", 3).Debug("deleting original PVC")
101 | err = c.kClient.CoreV1().PersistentVolumeClaims(sourcePVC.ObjectMeta.Namespace).Delete(c.ctx, sourcePVC.Name, c.getDeleteOptions())
102 | if err != nil {
103 | c.log.WithError(err).Warning("Failed to delete source pvc")
104 | return c.Cleanup()
105 | }
106 | err = c.waitForPVCDeletion(sourcePVC)
107 | if err != nil {
108 | c.log.WithError(err).Warning("failed to delete source pvc")
109 | return c.Cleanup()
110 | }
111 |
112 | c.log.WithField("stage", 4).Debug("creating final destination PVC")
113 | destInst, err := c.kClient.CoreV1().PersistentVolumeClaims(destTemplate.ObjectMeta.Namespace).Create(c.ctx, destTemplate, metav1.CreateOptions{})
114 | if err != nil {
115 | c.log.WithError(err).Warning("Failed to create final pvc")
116 | return c.Cleanup()
117 | }
118 | c.DestPVC = destInst
119 |
120 | c.log.WithField("stage", 5).Debug("starting mover job to final PVC")
121 | c.finalMover = mover.NewMoverJob(c.ctx, c.kClient, mover.MoverTypeSync, c.tolerateAllNodes)
122 | c.finalMover.Namespace = destTemplate.Namespace
123 | c.finalMover.SourceVolume = c.TempDestPVC
124 | c.finalMover.DestVolume = c.DestPVC
125 | c.finalMover.Name = fmt.Sprintf("korb-job-%s", tempDestInst.UID)
126 | err = c.finalMover.Start().Wait(c.timeout, c.MoveTimeout)
127 | if err != nil {
128 | c.log.WithError(err).Warning("Failed to move data")
129 | c.pvcsToDelete = []*v1.PersistentVolumeClaim{c.DestPVC}
130 | return c.Cleanup()
131 | }
132 |
133 | c.log.WithField("stage", 6).Debug("deleting temporary PVC")
134 | err = c.kClient.CoreV1().PersistentVolumeClaims(destTemplate.ObjectMeta.Namespace).Delete(c.ctx, c.TempDestPVC.Name, c.getDeleteOptions())
135 | if err != nil {
136 | c.log.WithError(err).Warning("failed to delete temporary destination pvc")
137 | return c.Cleanup()
138 | }
139 | err = c.waitForPVCDeletion(c.TempDestPVC)
140 | if err != nil {
141 | c.log.WithError(err).Warning("failed to delete temporary destination pvc")
142 | return c.Cleanup()
143 | }
144 |
145 | c.log.Info("And we're done")
146 |
147 | return c.Cleanup()
148 | }
149 |
150 | func (c *CopyTwiceNameStrategy) Cleanup() error {
151 | c.log.Info("Cleaning up...")
152 | for _, pvc := range c.pvcsToDelete {
153 | err := c.kClient.CoreV1().PersistentVolumeClaims(pvc.ObjectMeta.Namespace).Delete(c.ctx, pvc.Name, metav1.DeleteOptions{})
154 | if err != nil {
155 | c.log.WithError(err).Warning("Error during temporary PVC cleanup, continuing")
156 | }
157 | }
158 | return nil
159 | }
160 |
161 | func (c *CopyTwiceNameStrategy) setTimeout(pvc *v1.PersistentVolumeClaim) {
162 | if c.copyTimeout != nil {
163 | c.MoveTimeout = *c.copyTimeout
164 | } else {
165 | sizeInByes, _ := pvc.Spec.Resources.Requests.Storage().AsInt64()
166 | sizeInMB := float64(sizeInByes) / 1024 / 1024
167 | c.MoveTimeout = time.Duration(sizeInMB*(60.0/1024)) * time.Second
168 | }
169 | c.log.WithField("timeout", c.MoveTimeout).Debug("Set timeout from PVC size")
170 | }
171 |
172 | func (c *CopyTwiceNameStrategy) waitForPVCDeletion(pvc *v1.PersistentVolumeClaim) error {
173 | return wait.PollUntilContextTimeout(c.ctx, 2*time.Second, c.timeout, true, func(ctx context.Context) (bool, error) {
174 | _, err := c.kClient.CoreV1().PersistentVolumeClaims(pvc.ObjectMeta.Namespace).Get(ctx, pvc.Name, metav1.GetOptions{})
175 | if errors.IsNotFound(err) {
176 | return true, nil
177 | }
178 | c.log.WithField("pvc-name", pvc.ObjectMeta.Name).Debug("Waiting for PVC Deletion, retrying")
179 | return false, nil
180 | })
181 | }
182 |
183 | func (c *CopyTwiceNameStrategy) waitForBound(p *v1.PersistentVolumeClaim) error {
184 | return wait.PollUntilContextTimeout(c.ctx, 2*time.Second, c.timeout, true, func(ctx context.Context) (bool, error) {
185 | pvc, err := c.kClient.CoreV1().PersistentVolumeClaims(p.ObjectMeta.Namespace).Get(ctx, p.Name, metav1.GetOptions{})
186 | if err != nil {
187 | return false, err
188 | }
189 | if pvc.Status.Phase != v1.ClaimBound {
190 | c.log.WithField("pvc-name", pvc.ObjectMeta.Name).Warning("PVC not bound yet, retrying")
191 | return false, nil
192 | }
193 | return true, nil
194 | })
195 | }
196 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Korb
2 |
3 | Move Data from PVCs between StorageClasses, or rename them.
4 |
5 | ### Installation
6 |
7 | #### Using Homebrew
8 |
9 | ```
10 | brew tap beryju/tap
11 | brew install korb
12 | ```
13 |
14 | #### Manually
15 |
16 | Download the binary of the latest release from https://github.com/BeryJu/korb/releases
17 |
18 | ### Usage
19 |
20 | ```
21 | Move data between Kubernetes PVCs on different Storage Classes.
22 |
23 | Usage:
24 | korb [pvc [pvc]] [flags]
25 |
26 | Flags:
27 | --container-image string Image to use for moving jobs (default "ghcr.io/beryju/korb-mover:v2")
28 | --force Ignore warning which would normally halt the tool during validation.
29 | -h, --help help for korb
30 | --kube-config string (optional) absolute path to the kubeconfig file (default "/Users/jens/.kube/config")
31 | --new-pvc-access-mode strings Access mode(s) for the new PVC. If empty, the access mode of the source will be used. Accepts formats like used in Kubernetes Manifests (ReadWriteOnce, ReadWriteMany, ...)
32 | --new-pvc-name string Name for the new PVC. If empty, same name will be reused.
33 | --new-pvc-namespace string Namespace for the new PVCs to be created in. If empty, the namespace from your kubeconfig file will be used.
34 | --new-pvc-size string Size for the new PVC. If empty, the size of the source will be used. Accepts formats like used in Kubernetes Manifests (Gi, Ti, ...)
35 | --new-pvc-storage-class string Storage class to use for the new PVC. If empty, the storage class of the source will be used.
36 | --skip-pvc-bind-wait Skip waiting for PVC to be bound.
37 | --source-namespace string Namespace where the old PVCs reside. If empty, the namespace from your kubeconfig file will be used.
38 | --strategy string Strategy to use, by default will try to auto-select
39 | --timeout string Overwrite auto-generated timeout (by default 60s for Pod to start, copy timeout is based on PVC size)
40 | --tolerate-any-node Allow job to tolerating any node node taints.
41 | ```
42 |
43 | #### Strategies
44 |
45 | To see existing [strategies](https://github.com/BeryJu/korb/tree/main/pkg/strategies) and what they do, please check out the comments in source code of the strategy.
46 |
47 | ### Example (Moving from PVC to PVC)
48 |
49 | ```
50 | ~ ./korb --new-pvc-storage-class ontap-ssd redis-data-redis-master-0
51 | DEBU[0000] Created client from kubeconfig component=migrator kubeconfig=/home/jens/.kube/config
52 | DEBU[0000] Got current namespace component=migrator namespace=prod-beryju-org
53 | DEBU[0000] Got Source PVC component=migrator name=redis-data-redis-master-0 uid=e4b5476f-b965-4e81-bfee-d7cbbf4f6317
54 | DEBU[0000] No new Name given, using old name component=migrator
55 | DEBU[0000] Compatible Strategies: component=migrator
56 | DEBU[0000] Copy the PVC to the new Storage class and with new size and a new name, delete the old PVC, and copy it back to the old name. component=migrator
57 | DEBU[0000] Only one compatible strategy, running component=migrator
58 | DEBU[0000] Set timeout from PVC size component=strategy strategy=copy-twice-name timeout=8m0s
59 | WARN[0000] This strategy assumes you've stopped all pods accessing this data. component=strategy strategy=copy-twice-name
60 | DEBU[0000] creating temporary PVC component=strategy stage=1 strategy=copy-twice-name
61 | DEBU[0002] starting mover job component=strategy stage=2 strategy=copy-twice-name
62 | DEBU[0004] Pod not in correct state yet component=mover-job phase=Pending
63 | DEBU[0006] Pod not in correct state yet component=mover-job phase=Pending
64 | [...]
65 | [mover logs]: sending incremental file list
66 | [mover logs]: ./
67 | [mover logs]: appendonly.aof
68 | 0 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=1/3)
69 | [mover logs]: dump.rdb
70 | 175 100% 0.00kB/s 0:00:00 (xfr#2, to-chk=0/3)
71 | DEBU[0022] Cleaning up successful job component=mover-job
72 | DEBU[0022] deleting original PVC component=strategy stage=3 strategy=copy-twice-name
73 | DEBU[0024] creating final destination PVC component=strategy stage=4 strategy=copy-twice-name
74 | DEBU[0024] starting mover job to final PVC component=strategy stage=5 strategy=copy-twice-name
75 | DEBU[0026] Pod not in correct state yet component=mover-job phase=Pending
76 | DEBU[0028] Pod not in correct state yet component=mover-job phase=Pending
77 | [...]
78 | [mover logs]: sending incremental file list
79 | [mover logs]: ./
80 | [mover logs]: appendonly.aof
81 | 0 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=1/3)
82 | [mover logs]: dump.rdb
83 | 175 100% 0.00kB/s 0:00:00 (xfr#2, to-chk=0/3)
84 | DEBU[0048] Cleaning up successful job component=mover-job
85 | DEBU[0048] deleting temporary PVC component=strategy stage=6 strategy=copy-twice-name
86 | INFO[0050] And we're done component=strategy strategy=copy-twice-name
87 | INFO[0050] Cleaning up... component=strategy strategy=copy-twice-name
88 | ```
89 |
90 | ### Example (Exporting from PVC to tar)
91 |
92 | ```
93 | ~ ./korb overseerr-config --strategy export
94 | DEBU[0000] Created client from kubeconfig component=migrator kubeconfig=/Users/jens/.kube/config
95 | DEBU[0000] Got current namespace component=migrator namespace=overseerr
96 | DEBU[0000] Got Source PVC component=migrator name=overseerr-config uid=8e94240d-3c36-4fb1-baf0-5da1f6c44210
97 | DEBU[0000] No new Name given, using old name component=migrator
98 | INFO[0000] Strategy not compatible component=migrator error="Expected import file 'overseerr-config.tar' does not exist"
99 | DEBU[0000] Compatible Strategies: component=migrator
100 | DEBU[0000] Copy the PVC to the new Storage class and with new size and a new name, delete the old PVC, and copy it back to the old name. component=migrator identifier=copy-twice-name
101 | DEBU[0000] Export PVC content into a tar archive. component=migrator identifier=export
102 | DEBU[0000] User selected strategy component=migrator identifier=export
103 | WARN[0000] This strategy assumes you've stopped all pods accessing this data. component=strategy strategy=export
104 | DEBU[0000] starting mover job component=strategy strategy=export
105 | DEBU[0000] Pod not in correct state yet component=mover-job phase=Pending
106 | [...]
107 | DEBU[0036] mover pod running, starting copy component=strategy strategy=export
108 | tar: Removing leading `/' from member names
109 | /source/
110 | /source/db/
111 | /source/db/db.sqlite3
112 | ⠧ downloading (110 kB, 43.824 kB/s) /source/db/db.sqlite3-shm
113 | /source/db/db.sqlite3-wal
114 | ⠴ downloading (4.0 MB, 1.521 MB/s) /source/logs/
115 | /source/logs/overseerr.log
116 | /source/logs/.20136e5b8544ec13f7fc29ce3d35150d597108bb-audit.json
117 | /source/logs/.d2109f103a9d757bc28894d508ee5579a3284e75-audit.json
118 | /source/logs/.machinelogs.json
119 | /source/logs/overseerr-2022-07-01.log.gz
120 | /source/logs/overseerr-2022-07-05.log
121 | ⠦ downloading (4.2 MB, 1.521 MB/s) /source/logs/.machinelogs-2022-07-04.json.gz
122 | /source/logs/overseerr-2022-05-24.log.gz
123 | /source/logs/overseerr-2022-07-03.log.gz
124 | /source/logs/overseerr-2022-06-29.log.gz
125 | /source/logs/overseerr-2022-07-02.log.gz
126 | /source/logs/overseerr-2022-05-25.log.gz
127 | /source/logs/overseerr-2022-06-30.log.gz
128 | /source/logs/overseerr-2022-07-04.log.gz
129 | /source/logs/.machinelogs-2022-07-05.json
130 | ⠦ downloading (4.4 MB, 1.521 MB/s) /source/settings.json
131 | INFO[0039] Finished copying component=strategy strategy=export
132 | INFO[0039] Export at 'overseerr-config.tar' component=strategy strategy=export
133 | INFO[0039] Cleaning up... component=strategy strategy=export
134 | ```
135 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
2 | github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
3 | github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
4 | github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
5 | github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM=
6 | github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY=
7 | github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
8 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
10 | github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
11 | github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12 | github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU=
13 | github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
14 | github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
15 | github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
16 | github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
17 | github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
18 | github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
19 | github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
20 | github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
21 | github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
22 | github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
23 | github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
24 | github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
25 | github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
26 | github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo=
27 | github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ=
28 | github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
29 | github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
30 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
31 | github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8=
32 | github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
33 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
34 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
35 | github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo=
36 | github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA=
37 | github.com/goware/prefixer v0.0.0-20160118172347-395022866408 h1:Y9iQJfEqnN3/Nce9cOegemcy/9Ai5k3huT6E80F3zaw=
38 | github.com/goware/prefixer v0.0.0-20160118172347-395022866408/go.mod h1:PE1ycukgRPJ7bJ9a1fdfQ9j8i/cEcRAoLZzbxYpNB/s=
39 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
40 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
41 | github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
42 | github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
43 | github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
44 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
45 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
46 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
47 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
48 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
49 | github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
50 | github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
51 | github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
52 | github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
53 | github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
54 | github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
55 | github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU=
56 | github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI=
57 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
58 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
59 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
60 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
61 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8=
62 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
63 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
64 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
65 | github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
66 | github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
67 | github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns=
68 | github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
69 | github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
70 | github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
71 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
72 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
73 | github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
74 | github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
75 | github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
76 | github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
77 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
78 | github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQmCN62HpA=
79 | github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
80 | github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
81 | github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
82 | github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
83 | github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
84 | github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
85 | github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
86 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
87 | github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
88 | github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
89 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
90 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
91 | github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
92 | github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
93 | github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
94 | github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
95 | go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
96 | go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
97 | go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
98 | go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
99 | golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
100 | golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
101 | golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
102 | golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
103 | golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
104 | golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
105 | golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
106 | golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
107 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
108 | golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
109 | golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
110 | golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
111 | golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
112 | golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
113 | golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
114 | golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
115 | golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
116 | golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
117 | golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
118 | google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
119 | google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
120 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
121 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
122 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
123 | gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnfEbYzo=
124 | gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
125 | gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
126 | gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
127 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
128 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
129 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
130 | k8s.io/api v0.35.0 h1:iBAU5LTyBI9vw3L5glmat1njFK34srdLmktWwLTprlY=
131 | k8s.io/api v0.35.0/go.mod h1:AQ0SNTzm4ZAczM03QH42c7l3bih1TbAXYo0DkF8ktnA=
132 | k8s.io/apimachinery v0.35.0 h1:Z2L3IHvPVv/MJ7xRxHEtk6GoJElaAqDCCU0S6ncYok8=
133 | k8s.io/apimachinery v0.35.0/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns=
134 | k8s.io/client-go v0.35.0 h1:IAW0ifFbfQQwQmga0UdoH0yvdqrbwMdq9vIFEhRpxBE=
135 | k8s.io/client-go v0.35.0/go.mod h1:q2E5AAyqcbeLGPdoRB+Nxe3KYTfPce1Dnu1myQdqz9o=
136 | k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
137 | k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
138 | k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE=
139 | k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ=
140 | k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck=
141 | k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
142 | sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
143 | sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
144 | sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
145 | sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
146 | sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco=
147 | sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE=
148 | sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
149 | sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
150 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------