Skip to content

Commit

Permalink
Prepare for release v0.1.0-rc.1 (#6)
Browse files Browse the repository at this point in the history
ProductLine: KubeStash
Release: v2023.11.28-rc.1
Release-tracker: kubestash/CHANGELOG#3
Signed-off-by: 1gtm <[email protected]>
  • Loading branch information
1gtm authored Nov 28, 2023
1 parent d7f30d0 commit e9c82ca
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73
kmodules.xyz/client-go v0.25.39
kmodules.xyz/offshoot-api v0.25.5-0.20231004063620-dff8fb030d57
kubestash.dev/apimachinery v0.2.0-rc.0.0.20231114115833-0b99d5ce666e
kubestash.dev/apimachinery v0.2.0-rc.1
sigs.k8s.io/controller-runtime v0.13.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1068,8 +1068,8 @@ kmodules.xyz/offshoot-api v0.25.5-0.20231004063620-dff8fb030d57 h1:4ld/ujZum5JX6
kmodules.xyz/offshoot-api v0.25.5-0.20231004063620-dff8fb030d57/go.mod h1:PUk4EuJFhhyQykCflHj7EgXcljGIqs9vi0IN0RpxtY4=
kmodules.xyz/prober v0.25.0 h1:R5uRLHJEvEtEoogj+vaTAob0Btph6+PX5IlS6hPh8PA=
kmodules.xyz/prober v0.25.0/go.mod h1:z4RTnjaajNQa/vPltsiOnO3xI716I/ziD2ac2Exm+1M=
kubestash.dev/apimachinery v0.2.0-rc.0.0.20231114115833-0b99d5ce666e h1:Ya9b9/Z9E9kuB2zUyR4XWierZ9je5WdGuO2D4hN6D1Y=
kubestash.dev/apimachinery v0.2.0-rc.0.0.20231114115833-0b99d5ce666e/go.mod h1:vlT+qYeOTh5GjzdKw9qhJlXxS+PvvVZivm+l7y+OUIs=
kubestash.dev/apimachinery v0.2.0-rc.1 h1:K4Gmtw6cSQngFQMcBjnwOuqgKaRGXk9z9zR4bVLanpU=
kubestash.dev/apimachinery v0.2.0-rc.1/go.mod h1:vlT+qYeOTh5GjzdKw9qhJlXxS+PvvVZivm+l7y+OUIs=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
Expand Down
32 changes: 28 additions & 4 deletions vendor/kubestash.dev/apimachinery/apis/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ const (
KubeStashSessionName = "kubestash.com/session-name"
)

// Keys for snapshots labels
const (
KubeStashRepositoryName = "kubestash.com/repo-name"

KubeStashAppRefKind = "kubestash.com/app-ref-kind"
KubeStashAppRefNamespace = "kubestash.com/app-ref-namespace"
KubeStashAppRefName = "kubestash.com/app-ref-name"
)

// Keys for structure logging
const (
KeyTargetKind = "target_kind"
Expand Down Expand Up @@ -106,16 +115,26 @@ const (

// Addon related
const (
EnvDBVersion = "DB_VERSION"
EnvComponentName = "COMPONENT_NAME"

ComponentPod = "pod"
ComponentDeployment = "deployment"
ComponentPVC = "pvc"
ComponentPod = "pod"
ComponentDeployment = "deployment"
ComponentPVC = "pvc"
ComponentDump = "dump"
ComponentManifests = "manifests"
ComponentVolumeSnapshots = "volumesnapshots"

DirRepository = "repository"
)

// Interim Volume Related Constant
const (
KeyDBVersion = "DB_VERSION"

KeyInterimVolume = "INTERIM_VOLUME"
InterimVolumeName = "kubestash-interim-volume"
)

// PersistentVolumeClaim related
const (
KeyPodOrdinal = "POD_ORDINAL"
Expand Down Expand Up @@ -144,3 +163,8 @@ const (
KeyAppName = PopulatorKey + "/app-name"
KubeStashPopulatorContainer = "kubestash-populator"
)

// Snapshot version related constants
const (
SnapshotVersionV1 = "v1"
)
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,33 @@ func (s *Snapshot) GetIntegrity() *bool {
return &result
}

func (s *Snapshot) GetTotalBackupSizeInBytes() (uint64, error) {
if s.Status.Components == nil {
return 0, fmt.Errorf("no component found for snapshot %s/%s", s.Namespace, s.Name)
}

var totalSizeInByte uint64
for componentName, component := range s.Status.Components {
for _, stats := range component.ResticStats {
if stats.Size == "" {
return 0, fmt.Errorf("resticStats size of component %s is empty for the snapshot %s/%s", componentName, s.Namespace, s.Name)
}

sizeWithUnit := strings.Split(component.Size, " ")
if len(sizeWithUnit) < 2 {
return 0, fmt.Errorf("resticStats size of component %s is invalid for the snapshot %s/%s", componentName, s.Namespace, s.Name)
}

sizeInByte, err := convertSizeToByte(sizeWithUnit)
if err != nil {
return 0, err
}
totalSizeInByte += sizeInByte
}
}
return totalSizeInByte, nil
}

func (s *Snapshot) GetSize() string {
if s.Status.Components == nil {
return ""
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ kmodules.xyz/offshoot-api/api/v1
# kmodules.xyz/prober v0.25.0
## explicit; go 1.18
kmodules.xyz/prober/api/v1
# kubestash.dev/apimachinery v0.2.0-rc.0.0.20231114115833-0b99d5ce666e
# kubestash.dev/apimachinery v0.2.0-rc.1
## explicit; go 1.20
kubestash.dev/apimachinery/apis
kubestash.dev/apimachinery/apis/config/v1alpha1
Expand Down

0 comments on commit e9c82ca

Please sign in to comment.