Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB-6677: Push 1.2.12 kdmp changes to the master and vendor stork master #373

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/hashicorp/go-version v1.6.0
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0
github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc7
github.com/libopenstorage/stork v1.4.1-0.20240506185157-275e4369d062
github.com/libopenstorage/stork v1.4.1-0.20240513102605-2340238c7664
github.com/portworx/pxc v0.33.0
github.com/portworx/sched-ops v1.20.4-rc1.0.20240424153814-f3083bdb4578
github.com/sirupsen/logrus v1.9.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3362,8 +3362,8 @@ github.com/libopenstorage/stork v1.4.1-0.20230502135851-9cacb19e1df5/go.mod h1:R
github.com/libopenstorage/stork v1.4.1-0.20230519043154-cbc10dffaf19/go.mod h1:Xm4DHoViynFXMQKBXGj3IkA77LY2RBFkNtv6vbo3wNw=
github.com/libopenstorage/stork v1.4.1-0.20230601053837-5dd68f026569/go.mod h1:+mKPMCPNhS/XOF2RPcNFijkr67CCCWp0o8OXVG6xxAk=
github.com/libopenstorage/stork v1.4.1-0.20230610103146-72cf75320066/go.mod h1:Yst+fnOYjWk6SA5pXZBKm19wtiinjxQ/vgYTXI3k80Q=
github.com/libopenstorage/stork v1.4.1-0.20240506185157-275e4369d062 h1:wTiDcrROzCHYsyYfromjatlOwT4UWZSeKqjOcg/SlKY=
github.com/libopenstorage/stork v1.4.1-0.20240506185157-275e4369d062/go.mod h1:kp5qtpq+BgjL5WqiOpDvbPH1WGReO5AaqXDbb+XpvzM=
github.com/libopenstorage/stork v1.4.1-0.20240513102605-2340238c7664 h1:bABYni9x1xTkaIzIvfeYj1MpubMp+kjV5K0qP9k1Xb4=
github.com/libopenstorage/stork v1.4.1-0.20240513102605-2340238c7664/go.mod h1:kp5qtpq+BgjL5WqiOpDvbPH1WGReO5AaqXDbb+XpvzM=
github.com/libopenstorage/systemutils v0.0.0-20160208220149-44ac83be3ce1/go.mod h1:xwNGC7xiz/BQ/wbMkvHujL8Gjgseg+x41xMek7sKRRQ=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/dataexport/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,7 @@ func createAzureSecret(secretName string, backupLocation *storkapi.BackupLocatio
credentialData["path"] = []byte(backupLocation.Location.Path)
credentialData["storageaccountname"] = []byte(backupLocation.Location.AzureConfig.StorageAccountName)
credentialData["storageaccountkey"] = []byte(backupLocation.Location.AzureConfig.StorageAccountKey)
credentialData["environment"] = []byte(backupLocation.Location.AzureConfig.Environment)
err := utils.CreateJobSecret(secretName, namespace, credentialData, labels)

return err
Expand Down
13 changes: 13 additions & 0 deletions pkg/executor/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
projectIDKeypath = "/etc/cred-secret/projectid"
storageAccountNamePath = "/etc/cred-secret/storageaccountname"
storageAccountKeyPath = "/etc/cred-secret/storageaccountkey"
environmentPath = "/etc/cred-secret/environment"
// ServerAddr & SubPath needed for NFS based backuplocation
serverAddr = "/etc/cred-secret/serverAddr"
subPath = "/etc/cred-secret/subPath"
Expand Down Expand Up @@ -98,6 +99,7 @@ type S3Config struct {
type AzureConfig struct {
StorageAccountName string
StorageAccountKey string
Environment string
}

// GoogleConfig specifies the config required to connect to Google Cloud Storage
Expand Down Expand Up @@ -242,6 +244,9 @@ func parseAzure(repoName string, backupLocation storkapi.BackupLocationItem) (*R
Name: repoName,
Path: "azure:" + repoName + "/",
AuthEnv: envs,
AzureConfig: &AzureConfig{
Environment: string(backupLocation.AzureConfig.Environment),
},
}, nil
}

Expand Down Expand Up @@ -454,9 +459,17 @@ func parseAzureCreds() (*Repository, error) {
return nil, fmt.Errorf(errMsg)
}

environment, err := os.ReadFile(environmentPath)
if err != nil {
errMsg := fmt.Sprintf("failed reading data from file %s: %s", environmentPath, err)
logrus.Errorf("%v", errMsg)
return nil, fmt.Errorf(errMsg)
}

repository.Type = storkapi.BackupLocationAzure
repository.AzureConfig.StorageAccountName = string(storageAccountName)
repository.AzureConfig.StorageAccountKey = string(storageAccountKey)
repository.AzureConfig.Environment = string(environment)

return repository, nil
}
Expand Down
31 changes: 22 additions & 9 deletions pkg/executor/kopia/kopiabackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ import (
)

const (
progressCheckInterval = 5 * time.Second
genericBackupDir = "generic-backup"
kopiaRepositoryFile = "kopia.repository"
annualSnapshots = "2147483647"
monthlySnapshots = "2147483647"
weeklySnapshots = "2147483647"
dailySnapshots = "2147483647"
hourlySnapshots = "2147483647"
latestSnapshots = "2147483647"
progressCheckInterval = 5 * time.Second
genericBackupDir = "generic-backup"
kopiaRepositoryFile = "kopia.repository"
annualSnapshots = "2147483647"
monthlySnapshots = "2147483647"
weeklySnapshots = "2147483647"
dailySnapshots = "2147483647"
hourlySnapshots = "2147483647"
latestSnapshots = "2147483647"
azureChinaStorageDomain = "blob.core.chinacloudapi.cn"
azurePublicStorageDomain = "blob.core.windows.net"
)

var (
Expand Down Expand Up @@ -211,12 +213,22 @@ func populateGCEAccessDetails(initCmd *kopia.Command, repository *executor.Repos
}

func populateAzureccessDetails(initCmd *kopia.Command, repository *executor.Repository) *kopia.Command {
//Construct Azure storage Domain
var storageDomain string
switch repository.AzureConfig.Environment {
case "AzureChinaCloud":
storageDomain = azureChinaStorageDomain
case "AzurePublicCloud":
storageDomain = azurePublicStorageDomain
}
initCmd.AddArg("--container")
initCmd.AddArg(repository.Path)
initCmd.AddArg("--storage-account")
initCmd.AddArg(repository.AzureConfig.StorageAccountName)
initCmd.AddArg("--storage-key")
initCmd.AddArg(repository.AzureConfig.StorageAccountKey)
initCmd.AddArg("--storage-domain")
initCmd.AddArg(storageDomain)

return initCmd
}
Expand Down Expand Up @@ -600,6 +612,7 @@ func buildStorkBackupLocation(repository *executor.Repository) (*storkv1.BackupL
backupLocation.Location.AzureConfig = &storkv1.AzureConfig{
StorageAccountName: repository.AzureConfig.StorageAccountName,
StorageAccountKey: repository.AzureConfig.StorageAccountKey,
Environment: storkv1.AzureEnvironment(repository.AzureConfig.Environment),
}
}

Expand Down

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

Loading
Loading