Skip to content

Commit 8765688

Browse files
committed
feat: S3C-10275 utapi support
1 parent 5c1b4a6 commit 8765688

File tree

8 files changed

+80
-0
lines changed

8 files changed

+80
-0
lines changed

cmd/config.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type Config struct {
2020
Kafka KafkaConfig `yaml:"kafka"`
2121
Zookeeper ZookeeperConfig `yaml:"zookeeper"`
2222
Redis RedisConfig `yaml:"redis"`
23+
Utapi UtapiConfig `yaml:"utapi"`
2324
}
2425

2526
type GlobalConfig struct {
@@ -30,6 +31,7 @@ type GlobalConfig struct {
3031
type FeatureConfig struct {
3132
Scuba ScubaFeatureConfig `yaml:"scuba"`
3233
BucketNotifications BucketNotificationsFeatureConfig `yaml:"bucket_notifications"`
34+
Utapi UtapiFeatureConfig `yaml:"utapi"`
3335
}
3436

3537
type ScubaFeatureConfig struct {
@@ -46,6 +48,10 @@ type BucketNotificationsFeatureConfig struct {
4648
} `yaml:"destinationAuth"`
4749
}
4850

51+
type UtapiFeatureConfig struct {
52+
Enabled bool `yaml:"enabled"`
53+
}
54+
4955
type CloudserverConfig struct {
5056
Image string `yaml:"image"`
5157
EnableNullVersionCompatMode bool `yaml:"enableNullVersionCompatMode"`
@@ -62,6 +68,11 @@ type VaultConfig struct {
6268
LogLevel string `yaml:"log_level"`
6369
}
6470

71+
type UtapiConfig struct {
72+
Image string `yaml:"image"`
73+
LogLevel string `yaml:"log_level"`
74+
}
75+
6576
type VFormat string
6677

6778
func (vf VFormat) String() string {
@@ -160,6 +171,9 @@ func DefaultConfig() Config {
160171
Type: "none",
161172
},
162173
},
174+
Utapi: UtapiFeatureConfig{
175+
Enabled: false,
176+
},
163177
},
164178
Cloudserver: CloudserverConfig{},
165179
S3Metadata: MetadataConfig{
@@ -185,6 +199,7 @@ func DefaultConfig() Config {
185199
RaftSessions: 1,
186200
// LogLevel: "info",
187201
},
202+
Utapi: UtapiConfig{},
188203
}
189204
}
190205

cmd/configure.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func configureEnv(cfg Config, envDir string) error {
4848
generateS3MetadataConfig,
4949
generateScubaMetadataConfig,
5050
generateKafkaConfig,
51+
generateUtapiConfig,
5152
}
5253

5354
configDir := filepath.Join(envDir, "config")
@@ -132,3 +133,7 @@ func generateKafkaConfig(cfg Config, path string) error {
132133

133134
return renderTemplates(cfg, "templates/kafka", filepath.Join(path, "kafka"), templates)
134135
}
136+
137+
func generateUtapiConfig(cfg Config, path string) error {
138+
return renderTemplateToFile(getTemplates(), "templates/utapi/config.json", cfg, filepath.Join(path, "utapi", "config.json"))
139+
}

cmd/util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ func getComposeProfiles(cfg Config) []string {
7171
profiles = append(profiles, "feature-notifications")
7272
}
7373

74+
if cfg.Features.Utapi.Enabled {
75+
profiles = append(profiles, "feature-utapi")
76+
}
77+
7478
return profiles
7579
}
7680

templates/cloudserver/config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,20 @@
9797
{{ else }}
9898
"bucketNotificationDestinations": [],
9999
{{ end }}
100+
{{ if .Features.Utapi.Enabled }}
101+
"localCache": {
102+
"host": "localhost",
103+
"port": 6379
104+
},
105+
"utapi": {
106+
"host": "localhost",
107+
"port": 8100,
108+
"workers": 1,
109+
"redis": {
110+
"host": "localhost",
111+
"port": 6379
112+
}
113+
},
114+
{{ end }}
100115
"testingMode": true
101116
}

templates/global/config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ features:
1313
username: admin
1414
password: admin123
1515

16+
utapi:
17+
enabled: true
18+
1619
cloudserver:
1720
image: ghcr.io/scality/cloudserver:7.70.62
1821

@@ -39,3 +42,6 @@ zookeeper:
3942

4043
redis:
4144
image: redis:7
45+
46+
utapi:
47+
image: ghcr.io/scality/utapi:7.70.7

templates/global/defaults.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CLOUDSERVER_IMAGE="{{ .Cloudserver.Image }}"
77
VAULT_IMAGE="{{ .Vault.Image }}"
88
SCUBA_IMAGE="{{ .Scuba.Image }}"
99
BACKBEAT_IMAGE="{{ .Backbeat.Image }}"
10+
UTAPI_IMAGE="{{ .Utapi.Image }}"
1011

1112
METADATA_S3_DB_VERSION="{{ .S3Metadata.VFormat }}"
1213
CLOUDSERVER_ENABLE_NULL_VERSION_COMPAT_MODE="{{ .Cloudserver.EnableNullVersionCompatMode }}"

templates/global/docker-compose.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ services:
142142
profiles:
143143
- feature-crr
144144
- feature-notifications
145+
- feature-utapi
145146

146147
zookeeper:
147148
build:
@@ -219,3 +220,15 @@ services:
219220
- feature-notifications
220221
volumes:
221222
- ./config/kafka/config.properties:/opt/kafka/config/config.properties:ro
223+
224+
utapi:
225+
profiles:
226+
- feature-utapi
227+
image: ${UTAPI_IMAGE}
228+
container_name: workbench-utapi
229+
network_mode: host
230+
command: ["bash", "-c", "yarn start"]
231+
volumes:
232+
- ./config/utapi/config.json:/conf/config.json:ro
233+
environment:
234+
UTAPI_CONFIG_FILE: /conf/config.json

templates/utapi/config.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"port": 8100,
3+
"workers": 10,
4+
"healthChecks": {
5+
"allowFrom": ["127.0.0.1/8", "::1"]
6+
},
7+
"log": {
8+
"logLevel": "info",
9+
"dumpLevel": "error"
10+
},
11+
"redis": {
12+
"host": "127.0.0.1",
13+
"port": 6379
14+
},
15+
"vaultd": {
16+
"host": "127.0.0.1",
17+
"port": 8500
18+
},
19+
"expireMetrics": false,
20+
"expireMetricsTTL": 0
21+
}

0 commit comments

Comments
 (0)