Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
velero-plugin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
velero-plugin
Commits
2650f1a7
Unverified
Commit
2650f1a7
authored
Jan 09, 2020
by
Shuwei Hao
Committed by
GitHub
Jan 09, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #26 from haoshuwei/hotfix_get_oss_endpoint
get correct oss endpoint
parents
d193f2b9
07153c9b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
7 deletions
+6
-7
README.md
+1
-2
install/01-velero.yaml
+2
-1
install/credentials-velero
+0
-1
velero-plugin-for-alibabacloud/common.go
+3
-3
No files found.
README.md
View file @
2650f1a7
...
@@ -92,10 +92,9 @@ For more information, see [the AlibabaCloud documentation on RAM users guides][1
...
@@ -92,10 +92,9 @@ For more information, see [the AlibabaCloud documentation on RAM users guides][1
```
```
ALIBABA_CLOUD_ACCESS_KEY_ID=<ALIBABA_CLOUD_ACCESS_KEY_ID>
ALIBABA_CLOUD_ACCESS_KEY_ID=<ALIBABA_CLOUD_ACCESS_KEY_ID>
ALIBABA_CLOUD_ACCESS_KEY_SECRET=<ALIBABA_CLOUD_ACCESS_KEY_SECRET>
ALIBABA_CLOUD_ACCESS_KEY_SECRET=<ALIBABA_CLOUD_ACCESS_KEY_SECRET>
ALIBABA_CLOUD_OSS_ENDPOINT=<ALIBABA_CLOUD_OSS_ENDPOINT>
```
```
where the access key id and secret are the values get from the step 3
and the oss endpoint is the value oss-$REGION.aliyuncs.com.
where the access key id and secret are the values get from the step 3
.
## Install velero and velero-plugin for alibabacloud
## Install velero and velero-plugin for alibabacloud
...
...
install/01-velero.yaml
View file @
2650f1a7
...
@@ -30,7 +30,8 @@ metadata:
...
@@ -30,7 +30,8 @@ metadata:
name
:
default
name
:
default
namespace
:
velero
namespace
:
velero
spec
:
spec
:
config
:
{}
config
:
region
:
<REGION>
objectStorage
:
objectStorage
:
bucket
:
<BUCKET>
bucket
:
<BUCKET>
prefix
:
"
"
prefix
:
"
"
...
...
install/credentials-velero
View file @
2650f1a7
ALIBABA_CLOUD_ACCESS_KEY_ID=<ALIBABA_CLOUD_ACCESS_KEY_ID>
ALIBABA_CLOUD_ACCESS_KEY_ID=<ALIBABA_CLOUD_ACCESS_KEY_ID>
ALIBABA_CLOUD_ACCESS_KEY_SECRET=<ALIBABA_CLOUD_ACCESS_KEY_SECRET>
ALIBABA_CLOUD_ACCESS_KEY_SECRET=<ALIBABA_CLOUD_ACCESS_KEY_SECRET>
ALIBABA_CLOUD_OSS_ENDPOINT=<ALIBABA_CLOUD_OSS_ENDPOINT>
velero-plugin-for-alibabacloud/common.go
View file @
2650f1a7
...
@@ -11,7 +11,7 @@ import (
...
@@ -11,7 +11,7 @@ import (
const
(
const
(
metadataURL
=
"http://100.100.100.200/latest/meta-data/"
metadataURL
=
"http://100.100.100.200/latest/meta-data/"
metadataRegionKey
=
"region"
metadataRegionKey
=
"region
-id
"
metadataZoneKey
=
"zone-id"
metadataZoneKey
=
"zone-id"
regionConfigKey
=
"region"
regionConfigKey
=
"region"
minReqVolSizeBytes
=
21474836480
minReqVolSizeBytes
=
21474836480
...
@@ -52,7 +52,7 @@ func getMetaData(resource string) (string, error) {
...
@@ -52,7 +52,7 @@ func getMetaData(resource string) (string, error) {
// getOssEndpoint return oss endpoint in format "oss-%s.aliyuncs.com"
// getOssEndpoint return oss endpoint in format "oss-%s.aliyuncs.com"
func
getOssEndpoint
(
config
map
[
string
]
string
)
string
{
func
getOssEndpoint
(
config
map
[
string
]
string
)
string
{
if
value
:=
config
[
regionConfigKey
];
value
==
""
{
if
value
:=
config
[
regionConfigKey
];
value
==
""
{
if
value
,
err
:=
getMetaData
(
metadataRegionKey
);
err
!=
nil
{
if
value
,
err
:=
getMetaData
(
metadataRegionKey
);
err
!=
nil
||
value
==
""
{
// set default region
// set default region
return
"oss-cn-hangzhou.aliyuncs.com"
return
"oss-cn-hangzhou.aliyuncs.com"
}
else
{
}
else
{
...
@@ -66,7 +66,7 @@ func getOssEndpoint(config map[string]string) string {
...
@@ -66,7 +66,7 @@ func getOssEndpoint(config map[string]string) string {
// getEcsRegionID return ecs region id
// getEcsRegionID return ecs region id
func
getEcsRegionID
(
config
map
[
string
]
string
)
string
{
func
getEcsRegionID
(
config
map
[
string
]
string
)
string
{
if
value
:=
config
[
regionConfigKey
];
value
==
""
{
if
value
:=
config
[
regionConfigKey
];
value
==
""
{
if
value
,
err
:=
getMetaData
(
metadataRegionKey
);
err
!=
nil
{
if
value
,
err
:=
getMetaData
(
metadataRegionKey
);
err
!=
nil
||
value
==
""
{
// set default region
// set default region
return
"cn-hangzhou"
return
"cn-hangzhou"
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment