Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
generated stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sosodev committed Jan 3, 2024
1 parent 3af910d commit 10435ee
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 60 deletions.
1 change: 1 addition & 0 deletions docs/docs/100-reference/01-command-line/acorn_volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ acorn volume

* [acorn](acorn.md) -
* [acorn volume rm](acorn_volume_rm.md) - Delete a volume
* [acorn volume snapshot](acorn_volume_snapshot.md) - Manage snapshots

43 changes: 43 additions & 0 deletions docs/docs/100-reference/01-command-line/acorn_volume_snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: "acorn volume snapshot"
---
## acorn volume snapshot

Manage snapshots

```
acorn volume snapshot [flags] [SNAPSHOT_NAME...]
```

### Examples

```
acorn snapshot
```

### Options

```
-h, --help help for snapshot
-o, --output string Output format (json, yaml, {{gotemplate}})
-q, --quiet Output only names
```

### Options inherited from parent commands

```
--config-file string Path of the acorn config file to use
--debug Enable debug logging
--debug-level int Debug log level (valid 0-9) (default 7)
--kubeconfig string Explicitly use kubeconfig file, overriding the default context
-j, --project string Project to work in
```

### SEE ALSO

* [acorn volume](acorn_volume.md) - Manage volumes
* [acorn volume snapshot create](acorn_volume_snapshot_create.md) - Create a snapshot
* [acorn volume snapshot restore](acorn_volume_snapshot_restore.md) - Restore a snapshot to a new volume
* [acorn volume snapshot rm](acorn_volume_snapshot_rm.md) - Delete a snapshot

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "acorn volume snapshot create"
---
## acorn volume snapshot create

Create a snapshot

```
acorn volume snapshot create [flags] BOUND_VOLUME_NAME
```

### Options

```
-h, --help help for create
-n, --name string Give your snapshot a custom name
```

### Options inherited from parent commands

```
--config-file string Path of the acorn config file to use
--debug Enable debug logging
--debug-level int Debug log level (valid 0-9) (default 7)
--kubeconfig string Explicitly use kubeconfig file, overriding the default context
-o, --output string Output format (json, yaml, {{gotemplate}})
-j, --project string Project to work in
-q, --quiet Output only names
```

### SEE ALSO

* [acorn volume snapshot](acorn_volume_snapshot.md) - Manage snapshots

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "acorn volume snapshot restore"
---
## acorn volume snapshot restore

Restore a snapshot to a new volume

```
acorn volume snapshot restore [flags] SNAPSHOT_NAME VOLUME_NAME
```

### Options

```
-h, --help help for restore
```

### Options inherited from parent commands

```
--config-file string Path of the acorn config file to use
--debug Enable debug logging
--debug-level int Debug log level (valid 0-9) (default 7)
--kubeconfig string Explicitly use kubeconfig file, overriding the default context
-o, --output string Output format (json, yaml, {{gotemplate}})
-j, --project string Project to work in
-q, --quiet Output only names
```

### SEE ALSO

* [acorn volume snapshot](acorn_volume_snapshot.md) - Manage snapshots

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "acorn volume snapshot rm"
---
## acorn volume snapshot rm

Delete a snapshot

```
acorn volume snapshot rm [flags] SNAPSHOT_NAME
```

### Options

```
-h, --help help for rm
```

### Options inherited from parent commands

```
--config-file string Path of the acorn config file to use
--debug Enable debug logging
--debug-level int Debug log level (valid 0-9) (default 7)
--kubeconfig string Explicitly use kubeconfig file, overriding the default context
-o, --output string Output format (json, yaml, {{gotemplate}})
-j, --project string Project to work in
-q, --quiet Output only names
```

### SEE ALSO

* [acorn volume snapshot](acorn_volume_snapshot.md) - Manage snapshots

35 changes: 3 additions & 32 deletions pkg/apis/snapshot.storage.k8s.io/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 0 additions & 28 deletions pkg/client/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import (
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
klabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/utils/pointer"
kclient "sigs.k8s.io/controller-runtime/pkg/client"
)

var (
Expand Down Expand Up @@ -183,29 +181,3 @@ func (c *DefaultClient) SnapshotRestore(ctx context.Context, snapshotName string

return cl.Create(ctx, newPVC)
}

func (c *DefaultClient) getPVC(ctx context.Context, namespace, pvc string) (*corev1.PersistentVolumeClaim, error) {
cl, err := c.GetClient()
if err != nil {
return nil, err
}

pvcs := &corev1.PersistentVolumeClaimList{}
err = cl.List(ctx, pvcs, &kclient.ListOptions{
Namespace: namespace,
LabelSelector: klabels.SelectorFromSet(map[string]string{
labels.AcornManaged: "true",
}),
})
if err != nil {
return nil, err
}

for _, nPvc := range pvcs.Items {
if nPvc.Name == pvc {
return &nPvc, nil
}
}

return nil, errors.New("pvc not found")
}

0 comments on commit 10435ee

Please sign in to comment.