Skip to content

Commit 7cd395d

Browse files
authored
Merge pull request #41 from scality/improvement/WKBCH-9
Add cloudserver v9 support
2 parents 28e3984 + e391af2 commit 7cd395d

File tree

7 files changed

+327
-2
lines changed

7 files changed

+327
-2
lines changed

cmd/configure.go

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,35 @@ func generateDefaultsEnv(cfg EnvironmentConfig, envDir string) error {
9494
}
9595

9696
func generateCloudserverConfig(cfg EnvironmentConfig, path string) error {
97-
return renderTemplateToFile(getTemplates(), "templates/cloudserver/config.json", cfg, filepath.Join(path, "cloudserver", "config.json"))
97+
version := detectCloudserverVersion(cfg.Cloudserver.Image)
98+
99+
configTemplate := fmt.Sprintf("templates/cloudserver/config-%s.json", version)
100+
101+
if f, err := getTemplates().Open(configTemplate); err != nil {
102+
return fmt.Errorf("no configuration template found for cloudserver version %s (image: %s): %w",
103+
version, cfg.Cloudserver.Image, err)
104+
} else {
105+
if closeErr := f.Close(); closeErr != nil {
106+
return fmt.Errorf("failed to close template file: %w", closeErr)
107+
}
108+
}
109+
110+
err := renderTemplateToFile(
111+
getTemplates(),
112+
configTemplate,
113+
cfg,
114+
filepath.Join(path, "cloudserver", "config.json"),
115+
)
116+
if err != nil {
117+
return err
118+
}
119+
120+
return renderTemplateToFile(
121+
getTemplates(),
122+
"templates/cloudserver/locationConfig.json",
123+
cfg,
124+
filepath.Join(path, "cloudserver", "locationConfig.json"),
125+
)
98126
}
99127

100128
func generateBackbeatConfig(cfg EnvironmentConfig, path string) error {

cmd/util.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"io/fs"
88
"os"
99
"path/filepath"
10+
"strconv"
11+
"strings"
1012
"text/template"
1113

1214
"github.com/hashicorp/go-multierror"
@@ -130,3 +132,38 @@ func copyFile(src, dest string) (err error) {
130132
_, err = io.Copy(destination, source)
131133
return
132134
}
135+
136+
// detectCloudserverVersion extracts the major version from a cloudserver image tag.
137+
// Returns "v7" for version 7.x images, "v9" for version 9+ images
138+
// Defaults to "v9" for non-numeric tags (latest, dev, etc.) or when version cannot be determined.
139+
func detectCloudserverVersion(image string) string {
140+
parts := strings.Split(image, ":")
141+
if len(parts) < 2 || parts[1] == "" {
142+
return "v9"
143+
}
144+
145+
tag := parts[1]
146+
147+
if len(tag) > 0 && tag[0] >= '0' && tag[0] <= '9' {
148+
// Find where the first non-digit character appears
149+
endIdx := 0
150+
for endIdx < len(tag) && tag[endIdx] >= '0' && tag[endIdx] <= '9' {
151+
endIdx++
152+
}
153+
154+
if endIdx > 0 {
155+
majorVersionStr := tag[0:endIdx]
156+
if majorVersion, err := strconv.Atoi(majorVersionStr); err == nil {
157+
if majorVersion == 7 {
158+
return "v7"
159+
}
160+
if majorVersion >= 9 {
161+
return "v9"
162+
}
163+
}
164+
}
165+
}
166+
167+
// Default to v9 for non-numeric tags (latest, dev, etc.)
168+
return "v9"
169+
}
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"port": 8000,
3+
"listenOn": [],
4+
"metricsPort": 8002,
5+
"metricsListenOn": [],
6+
"replicationGroupId": "RG001",
7+
"restEndpoints": {
8+
"localhost": "us-east-1",
9+
"127.0.0.1": "us-east-1",
10+
"cloudserver-front": "us-east-1",
11+
"s3.docker.test": "us-east-1",
12+
"127.0.0.2": "us-east-1",
13+
"s3.amazonaws.com": "us-east-1",
14+
"zenko-cloudserver-replicator": "us-east-1",
15+
"lb": "us-east-1"
16+
},
17+
"websiteEndpoints": [
18+
"s3-website-us-east-1.amazonaws.com",
19+
"s3-website.us-east-2.amazonaws.com",
20+
"s3-website-us-west-1.amazonaws.com",
21+
"s3-website-us-west-2.amazonaws.com",
22+
"s3-website.ap-south-1.amazonaws.com",
23+
"s3-website.ap-northeast-2.amazonaws.com",
24+
"s3-website-ap-southeast-1.amazonaws.com",
25+
"s3-website-ap-southeast-2.amazonaws.com",
26+
"s3-website-ap-northeast-1.amazonaws.com",
27+
"s3-website.eu-central-1.amazonaws.com",
28+
"s3-website-eu-west-1.amazonaws.com",
29+
"s3-website-sa-east-1.amazonaws.com",
30+
"s3-website.localhost",
31+
"s3-website.scality.test",
32+
"zenkoazuretest.blob.core.windows.net"
33+
],
34+
"replicationEndpoints": [
35+
{
36+
"site": "zenko",
37+
"servers": ["127.0.0.1:8000"],
38+
"default": true
39+
},
40+
{
41+
"site": "us-east-2",
42+
"type": "aws_s3"
43+
}
44+
],
45+
"backbeat": {
46+
"host": "localhost",
47+
"port": 8900
48+
},
49+
"workflowEngineOperator": {
50+
"host": "localhost",
51+
"port": 3001
52+
},
53+
"cdmi": {
54+
"host": "localhost",
55+
"port": 81,
56+
"path": "/dewpoint",
57+
"readonly": true
58+
},
59+
"bucketd": {
60+
"bootstrap": ["localhost:9000"]
61+
},
62+
"vaultd": {
63+
"host": "localhost",
64+
"port": 8500
65+
},
66+
"clusters": 1,
67+
"log": {
68+
"logLevel": "info",
69+
"dumpLevel": "error"
70+
},
71+
"healthChecks": {
72+
"allowFrom": ["127.0.0.1/8", "::1"]
73+
},
74+
"metadataClient": {
75+
"host": "127.0.0.1",
76+
"port": 9990
77+
},
78+
"dataClient": {
79+
"host": "127.0.0.1",
80+
"port": 9991
81+
},
82+
"pfsClient": {
83+
"host": "127.0.0.1",
84+
"port": 9992
85+
},
86+
"metadataDaemon": {
87+
"bindAddress": "127.0.0.1",
88+
"port": 9990
89+
},
90+
"dataDaemon": {
91+
"bindAddress": "127.0.0.1",
92+
"port": 9991
93+
},
94+
"pfsDaemon": {
95+
"bindAddress": "127.0.0.1",
96+
"port": 9992
97+
},
98+
"recordLog": {
99+
"enabled": true,
100+
"recordLogName": "s3-recordlog"
101+
},
102+
"mongodb": {
103+
"replicaSetHosts": "localhost:27018,localhost:27019,localhost:27020",
104+
"writeConcern": "majority",
105+
"replicaSet": "rs0",
106+
"readPreference": "primary",
107+
"database": "metadata"
108+
},
109+
"externalBackends": {
110+
"aws_s3": {
111+
"httpAgent": {
112+
"keepAlive": false,
113+
"keepAliveMsecs": 1000,
114+
"maxFreeSockets": 256,
115+
"maxSockets": null
116+
}
117+
},
118+
"gcp": {
119+
"httpAgent": {
120+
"keepAlive": true,
121+
"keepAliveMsecs": 1000,
122+
"maxFreeSockets": 256,
123+
"maxSockets": null
124+
}
125+
}
126+
},
127+
"requests": {
128+
"viaProxy": false,
129+
"trustedProxyCIDRs": [],
130+
"extractClientIPFromHeader": ""
131+
},
132+
"bucketNotificationDestinations": [
133+
{
134+
"resource": "target1",
135+
"type": "dummy",
136+
"host": "localhost:6000"
137+
}
138+
],
139+
"defaultEncryptionKeyPerAccount": true,
140+
"kmsHideScalityArn": false,
141+
"kmsAWS": {
142+
"providerName": "aws",
143+
"region": "us-east-1",
144+
"endpoint": "http://127.0.0.1:8080",
145+
"ak": "tbd",
146+
"sk": "tbd"
147+
},
148+
"kmip": {
149+
"providerName": "thales"
150+
},
151+
"apiBodySizeLimits": {
152+
"multiObjectDelete": 2097152,
153+
"bucketPutPolicy": 20480
154+
},
155+
"integrityChecks": {
156+
"objectPutRetention": true
157+
},
158+
"testingMode": true
159+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"us-east-1": {
3+
"type": "file",
4+
"objectId": "us-east-1",
5+
"legacyAwsBehavior": true,
6+
"details": {}
7+
},
8+
"us-east-2": {
9+
"type": "file",
10+
"objectId": "us-east-2",
11+
"legacyAwsBehavior": false,
12+
"details": {}
13+
},
14+
"us-west-1": {
15+
"type": "file",
16+
"objectId": "us-west-1",
17+
"legacyAwsBehavior": false,
18+
"details": {}
19+
},
20+
"us-west-2": {
21+
"type": "file",
22+
"objectId": "us-west-2",
23+
"legacyAwsBehavior": false,
24+
"details": {}
25+
},
26+
"ca-central-1": {
27+
"type": "file",
28+
"objectId": "ca-central-1",
29+
"legacyAwsBehavior": false,
30+
"details": {}
31+
},
32+
"cn-north-1": {
33+
"type": "file",
34+
"objectId": "cn-north-1",
35+
"legacyAwsBehavior": false,
36+
"details": {}
37+
},
38+
"ap-south-1": {
39+
"type": "file",
40+
"objectId": "ap-south-1",
41+
"legacyAwsBehavior": false,
42+
"details": {}
43+
},
44+
"ap-northeast-1": {
45+
"type": "file",
46+
"objectId": "ap-northeast-1",
47+
"legacyAwsBehavior": false,
48+
"details": {}
49+
},
50+
"ap-northeast-2": {
51+
"type": "file",
52+
"objectId": "ap-northeast-2",
53+
"legacyAwsBehavior": false,
54+
"details": {}
55+
},
56+
"ap-southeast-1": {
57+
"type": "file",
58+
"objectId": "ap-southeast-1",
59+
"legacyAwsBehavior": false,
60+
"details": {}
61+
},
62+
"ap-southeast-2": {
63+
"type": "file",
64+
"objectId": "ap-southeast-2",
65+
"legacyAwsBehavior": false,
66+
"details": {}
67+
},
68+
"eu-central-1": {
69+
"type": "file",
70+
"objectId": "eu-central-1",
71+
"legacyAwsBehavior": false,
72+
"details": {}
73+
},
74+
"eu-west-1": {
75+
"type": "file",
76+
"objectId": "eu-west-1",
77+
"legacyAwsBehavior": false,
78+
"details": {}
79+
},
80+
"eu-west-2": {
81+
"type": "file",
82+
"objectId": "eu-west-2",
83+
"legacyAwsBehavior": false,
84+
"details": {}
85+
},
86+
"EU": {
87+
"type": "file",
88+
"objectId": "EU",
89+
"legacyAwsBehavior": false,
90+
"details": {}
91+
},
92+
"sa-east-1": {
93+
"type": "file",
94+
"objectId": "sa-east-1",
95+
"legacyAwsBehavior": false,
96+
"details": {}
97+
}
98+
}

templates/global/docker-compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ services:
4545
command: node dataserver.js
4646
volumes:
4747
- ./config/cloudserver/config.json:/conf/config.json:ro
48+
- ./config/cloudserver/locationConfig.json:/conf/locationConfig.json:ro
4849
profiles:
4950
- base
5051

@@ -61,8 +62,10 @@ services:
6162
S3_CONFIG_FILE: /conf/config.json
6263
MPU_TESTING: 'yes'
6364
ENABLE_NULL_VERSION_COMPAT_MODE: ${CLOUDSERVER_ENABLE_NULL_VERSION_COMPAT_MODE}
65+
REMOTE_MANAGEMENT_DISABLE: true
6466
volumes:
6567
- ./config/cloudserver/config.json:/conf/config.json:ro
68+
- ./config/cloudserver/locationConfig.json:/conf/locationConfig.json:ro
6669
profiles:
6770
- base
6871

templates/global/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ features:
2020
enabled: false
2121

2222
cloudserver:
23-
image: ghcr.io/scality/cloudserver:7.70.77
23+
image: ghcr.io/scality/cloudserver:9.0.32
2424

2525
vault:
2626
image: ghcr.io/scality/vault:7.81.0

0 commit comments

Comments
 (0)