Skip to content

Commit

Permalink
Merge branch 'master' into kopiaRepositoryServerWorkflowDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
kale-amruta authored May 26, 2023
2 parents f8704f8 + f88b9fa commit 6e6adda
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ replace (
// Direct and indirect dependencies are grouped together
require (
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.28
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/adal v0.9.23
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12
github.com/Azure/go-autorest/autorest/to v0.4.0
Expand Down Expand Up @@ -41,7 +41,7 @@ require (
github.com/openshift/api v0.0.0-20230406152840-ce21e3fe5da2
github.com/openshift/client-go v0.0.0-20230324103026-3f1513df25e0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.15.0
github.com/prometheus/client_golang v1.15.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.7.0
github.com/vmware/govmomi v0.30.4
Expand Down
9 changes: 5 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSW
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest v0.9.6/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630=
github.com/Azure/go-autorest/autorest v0.11.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc=
github.com/Azure/go-autorest/autorest v0.11.28 h1:ndAExarwr5Y+GaHE6VCaY1kyS/HwwGGyuimVhWsHOEM=
github.com/Azure/go-autorest/autorest v0.11.28/go.mod h1:MrkzG3Y3AH668QyF9KRk5neJnGgmhQ6krbhR8Q5eMvA=
github.com/Azure/go-autorest/autorest v0.11.29 h1:I4+HL/JDvErx2LjyzaVxllw2lRDB5/BT2Bm4g20iqYw=
github.com/Azure/go-autorest/autorest v0.11.29/go.mod h1:ZtEzC4Jy2JDrZLxvWs8LrBWEBycl1hbT1eknI8MtfAs=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/adal v0.8.2/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q=
github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ=
github.com/Azure/go-autorest/autorest/adal v0.9.22/go.mod h1:XuAbAEUv2Tta//+voMI038TrJBqjKam0me7qR+L8Cmk=
github.com/Azure/go-autorest/autorest/adal v0.9.23 h1:Yepx8CvFxwNKpH6ja7RZ+sKX+DWYNldbLiALMC3BTz8=
github.com/Azure/go-autorest/autorest/adal v0.9.23/go.mod h1:5pcMqFkdPhviJdlEy3kC/v1ZLnQl0MH6XA5YCcMhy4c=
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 h1:wkAZRgT/pn8HhFyzfe9UnqOjJYqlembgCTi72Bm/xKk=
Expand Down Expand Up @@ -440,8 +441,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM=
github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
Expand Down
8 changes: 8 additions & 0 deletions pkg/apis/cr/v1alpha1/repositoryserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ type Repository struct {
Hostname string `json:"hostname"`
// PasswordSecretRef has the password required to connect to kopia repository
PasswordSecretRef corev1.SecretReference `json:"passwordSecretRef"`
CacheSizeSettings CacheSizeSettings `json:"cacheSizeSettings,omitempty"`
}

// CacheSettings are the metadata/content cache size details
// that can be used while establishing connection to the kopia repository
type CacheSizeSettings struct {
Metadata string `json:"metadata"`
Content string `json:"content"`
}

// Server details required for starting the repository proxy server and initializing the repository client users
Expand Down
24 changes: 23 additions & 1 deletion pkg/controllers/repositoryserver/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package repositoryserver

import (
"strconv"

"github.com/kanisterio/kanister/pkg/kopia/command"
"github.com/kanisterio/kanister/pkg/kopia/repository"
)
Expand All @@ -27,7 +29,10 @@ const (
)

func (h *RepoServerHandler) connectToKopiaRepository() error {
contentCacheMB, metadataCacheMB := command.GetGeneralCacheSizeSettings()
contentCacheMB, metadataCacheMB, err := h.getRepositoryCacheSettings()
if err != nil {
return err
}
args := command.RepositoryCommandArgs{
CommandArgs: &command.CommandArgs{
RepoPassword: string(h.RepositoryServerSecrets.repositoryPassword.Data[repoPasswordKey]),
Expand All @@ -52,3 +57,20 @@ func (h *RepoServerHandler) connectToKopiaRepository() error {
args,
)
}

func (h *RepoServerHandler) getRepositoryCacheSettings() (contentCacheMB, metadataCacheMB int, err error) {
contentCacheMB, metadataCacheMB = command.GetGeneralCacheSizeSettings()
if h.RepositoryServer.Spec.Repository.CacheSizeSettings.Content != "" {
contentCacheMB, err = strconv.Atoi(h.RepositoryServer.Spec.Repository.CacheSizeSettings.Content)
if err != nil {
return
}
}
if h.RepositoryServer.Spec.Repository.CacheSizeSettings.Metadata != "" {
metadataCacheMB, err = strconv.Atoi(h.RepositoryServer.Spec.Repository.CacheSizeSettings.Metadata)
if err != nil {
return
}
}
return
}
12 changes: 12 additions & 0 deletions pkg/customresource/repositoryserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ spec:
description: Repository has the details required by the repository
server to connect to kopia repository
properties:
cacheSizeSettings:
description: CacheSettings are the metadata/content cache size
details that can be used for establishing connection to the kopia repository
properties:
content:
type: string
metadata:
type: string
required:
- content
- metadata
type: object
hostname:
description: If specified, these values will be used by the controller
to override default hostname when connecting to the repository
Expand Down

0 comments on commit 6e6adda

Please sign in to comment.