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

[K8SPSMDB-1000 add endpoint for Azure #1488

Merged
merged 7 commits into from
Mar 25, 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
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down
6 changes: 6 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down Expand Up @@ -207,6 +209,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down Expand Up @@ -868,6 +872,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down
1 change: 1 addition & 0 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ spec:
# azure:
# container: CONTAINER-NAME
# prefix: PREFIX-NAME
# https://accountName.blob.core.windows.net
# credentialsSecret: SECRET-NAME
pitr:
enabled: false
Expand Down
6 changes: 6 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down Expand Up @@ -207,6 +209,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
nmarukovich marked this conversation as resolved.
Show resolved Hide resolved
type: string
prefix:
type: string
required:
Expand Down Expand Up @@ -868,6 +872,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down
6 changes: 6 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down Expand Up @@ -207,6 +209,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down Expand Up @@ -868,6 +872,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/demand-backup/conf/some-name-rs0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spec:
azure:
container: operator-testing
prefix: psmdb-demand-backup
endpointUrl: https://engk8soperators.blob.core.windows.net
credentialsSecret: azure-secret

tasks:
Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/demand-backup/run
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then

desc 'check backup and restore -- azure-blob'
backup_dest_azure=$(get_backup_dest "$backup_name_azure")
curl -s "https://engk8soperators.blob.core.windows.net/${backup_dest_azure}/rs0/myApp.test.gz" | gunzip >/dev/null
curl -s "${backup_dest_azure}/rs0/myApp.test.gz" | gunzip >/dev/null
run_recovery_check "$backup_name_azure" "$cluster"
fi

Expand Down Expand Up @@ -142,7 +142,7 @@ fi
if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
check_backup_deletion "https://s3.amazonaws.com/${backup_dest_aws}" "aws-s3"
check_backup_deletion "https://storage.googleapis.com/${backup_dest_gcp}" "gcp-cs"
check_backup_deletion "https://engk8soperators.blob.core.windows.net/${backup_dest_azure}" "azure-blob"
check_backup_deletion "${backup_dest_azure}" "azure-blob"
fi

desc 'checking backup deletion without cr'
Expand Down Expand Up @@ -177,7 +177,7 @@ fi
if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
check_backup_deletion "https://s3.amazonaws.com/${backup_dest_aws}" "aws-s3"
check_backup_deletion "https://storage.googleapis.com/${backup_dest_gcp}" "gcp-cs"
check_backup_deletion "https://engk8soperators.blob.core.windows.net/${backup_dest_azure}" "azure-blob"
check_backup_deletion "${backup_dest_azure}" "azure-blob"
fi

desc 'check for passwords leak'
Expand Down
6 changes: 6 additions & 0 deletions e2e-tests/version-service/conf/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down Expand Up @@ -207,6 +209,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down Expand Up @@ -868,6 +872,8 @@ spec:
type: string
credentialsSecret:
type: string
endpointUrl:
type: string
prefix:
type: string
required:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ require (
replace (
github.com/Azure/go-autorest => github.com/Azure/go-autorest v14.2.0+incompatible // Required by OLM
github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt/v4 v4.2.0
)
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/alessio/shellescape v1.2.2/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
Expand Down Expand Up @@ -257,6 +258,7 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
Expand Down Expand Up @@ -548,6 +550,7 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4=
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
Expand Down Expand Up @@ -586,6 +589,7 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -633,10 +637,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/psmdb/v1/psmdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ type BackupStorageAzureSpec struct {
Container string `json:"container,omitempty"`
Prefix string `json:"prefix,omitempty"`
CredentialsSecret string `json:"credentialsSecret"`
EndpointURL string `json:"endpointUrl,omitempty"`
}

type BackupStorageType string
Expand Down
6 changes: 5 additions & 1 deletion pkg/controller/perconaservermongodbbackup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ func (b *Backup) Start(ctx context.Context, k8sclient client.Client, cluster *ap
status.Destination = stg.Azure.Container + "/" + stg.Azure.Prefix
}
if !strings.HasPrefix(stg.Azure.Container, "azure://") {
status.Destination = "azure://" + status.Destination
if stg.Azure.EndpointURL != "" {
status.Destination = stg.Azure.EndpointURL + "/" + status.Destination
} else {
status.Destination = "azure://" + status.Destination
}
}
}
status.Destination += "/" + status.PBMname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ func (r *ReconcilePerconaServerMongoDBBackup) getPBMStorage(ctx context.Context,
return nil, errors.Wrap(err, "getting azure credentials secret name")
}
azureConf := azure.Conf{
Account: string(azureSecret.Data[backup.AzureStorageAccountNameSecretKey]),
Container: cr.Status.Azure.Container,
Prefix: cr.Status.Azure.Prefix,
Account: string(azureSecret.Data[backup.AzureStorageAccountNameSecretKey]),
Container: cr.Status.Azure.Container,
EndpointURL: cr.Status.Azure.EndpointURL,
Prefix: cr.Status.Azure.Prefix,
Credentials: azure.Credentials{
Key: string(azureSecret.Data[backup.AzureStorageAccountKeySecretKey]),
},
Expand Down
7 changes: 4 additions & 3 deletions pkg/psmdb/backup/pbm.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,10 @@ func GetPBMConfig(ctx context.Context, k8sclient client.Client, cluster *api.Per
conf.Storage = config.StorageConf{
Type: storage.Azure,
Azure: azure.Conf{
Account: string(azureSecret.Data[AzureStorageAccountNameSecretKey]),
Container: stg.Azure.Container,
Prefix: stg.Azure.Prefix,
Account: string(azureSecret.Data[AzureStorageAccountNameSecretKey]),
Container: stg.Azure.Container,
EndpointURL: stg.Azure.EndpointURL,
Prefix: stg.Azure.Prefix,
Credentials: azure.Credentials{
Key: string(azureSecret.Data[AzureStorageAccountKeySecretKey]),
},
Expand Down
Loading