Skip to content

Commit 6cf657a

Browse files
authored
Add support for additional images (#1003)
Signed-off-by: Daniel Valdivia <[email protected]>
1 parent 1ba2627 commit 6cf657a

File tree

10 files changed

+161
-3
lines changed

10 files changed

+161
-3
lines changed

models/log_search_configuration.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/prometheus_configuration.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operatorapi/embedded_spec.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operatorapi/operator_tenants.go

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,7 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre
12281228
logSearchStorageClass := "" // Default is ""
12291229
logSearchImage := ""
12301230
logSearchPgImage := ""
1231+
logSearchPgInitImage := ""
12311232

12321233
if tenantReq.LogSearchConfiguration != nil {
12331234
if tenantReq.LogSearchConfiguration.StorageSize != nil {
@@ -1245,6 +1246,9 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre
12451246
if tenantReq.LogSearchConfiguration.PostgresImage != "" {
12461247
logSearchPgImage = tenantReq.LogSearchConfiguration.PostgresImage
12471248
}
1249+
if tenantReq.LogSearchConfiguration.PostgresInitImage != "" {
1250+
logSearchPgInitImage = tenantReq.LogSearchConfiguration.PostgresInitImage
1251+
}
12481252
}
12491253

12501254
logSearchDiskSpace := resource.NewQuantity(diskSpaceFromAPI, resource.DecimalExponent)
@@ -1276,16 +1280,22 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre
12761280
},
12771281
},
12781282
}
1283+
// set log search images if any
12791284
if logSearchImage != "" {
12801285
minInst.Spec.Log.Image = logSearchImage
12811286
}
12821287
if logSearchPgImage != "" {
12831288
minInst.Spec.Log.Db.Image = logSearchPgImage
12841289
}
1290+
if logSearchPgInitImage != "" {
1291+
minInst.Spec.Log.Db.InitImage = logSearchPgInitImage
1292+
}
12851293

1286-
prometheusDiskSpace := 5 // Default is 5 by API
1287-
prometheusStorageClass := "" // Default is ""
1288-
prometheusImage := "" // Default is ""
1294+
prometheusDiskSpace := 5 // Default is 5 by API
1295+
prometheusStorageClass := "" // Default is ""
1296+
prometheusImage := "" // Default is ""
1297+
prometheusSidecardImage := "" // Default is ""
1298+
prometheusInitImage := "" // Default is ""
12891299

12901300
if tenantReq.PrometheusConfiguration != nil {
12911301
if tenantReq.PrometheusConfiguration.StorageSize != nil {
@@ -1303,6 +1313,12 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre
13031313
if tenantReq.PrometheusConfiguration.Image != "" {
13041314
prometheusImage = tenantReq.PrometheusConfiguration.Image
13051315
}
1316+
if tenantReq.PrometheusConfiguration.SidecarImage != "" {
1317+
prometheusSidecardImage = tenantReq.PrometheusConfiguration.SidecarImage
1318+
}
1319+
if tenantReq.PrometheusConfiguration.InitImage != "" {
1320+
prometheusInitImage = tenantReq.PrometheusConfiguration.InitImage
1321+
}
13061322
}
13071323

13081324
minInst.Spec.Prometheus = &miniov2.PrometheusConfig{
@@ -1312,6 +1328,12 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre
13121328
if prometheusImage != "" {
13131329
minInst.Spec.Prometheus.Image = prometheusImage
13141330
}
1331+
if prometheusSidecardImage != "" {
1332+
minInst.Spec.Prometheus.SideCarImage = prometheusSidecardImage
1333+
}
1334+
if prometheusInitImage != "" {
1335+
minInst.Spec.Prometheus.InitImage = prometheusInitImage
1336+
}
13151337
// if security context for prometheus is present, configure it.
13161338
if tenantReq.PrometheusConfiguration != nil && tenantReq.PrometheusConfiguration.SecurityContext != nil {
13171339
sc := tenantReq.PrometheusConfiguration.SecurityContext

portal-ui/src/common/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,15 @@ export interface LogSearchConfiguration {
369369
storageSize?: number;
370370
image: string;
371371
postgres_image: string;
372+
postgres_init_image: string;
372373
}
373374

374375
export interface PrometheusConfiguration {
375376
storageClass?: string;
376377
storageSize?: number;
377378
image: string;
379+
sidecar_image: string;
380+
init_image: string;
378381
}
379382

380383
export interface AffinityConfiguration {

portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ const AddTenant = ({
175175
const logSearchImage = fields.configure.logSearchImage;
176176
const kesImage = fields.configure.kesImage;
177177
const logSearchPostgresImage = fields.configure.logSearchPostgresImage;
178+
const logSearchPostgresInitImage =
179+
fields.configure.logSearchPostgresInitImage;
178180
const prometheusImage = fields.configure.prometheusImage;
181+
const prometheusSidecarImage = fields.configure.prometheusSidecarImage;
182+
const prometheusInitImage = fields.configure.prometheusInitImage;
179183
const prometheusSelectedStorageClass =
180184
fields.configure.prometheusSelectedStorageClass;
181185
const prometheusVolumeSize = fields.configure.prometheusVolumeSize;
@@ -264,6 +268,7 @@ const AddTenant = ({
264268
storageSize: parseInt(logSearchVolumeSize),
265269
image: logSearchImage,
266270
postgres_image: logSearchPostgresImage,
271+
postgres_init_image: logSearchPostgresInitImage,
267272
},
268273
};
269274
} else {
@@ -272,6 +277,7 @@ const AddTenant = ({
272277
logSearchConfiguration: {
273278
image: logSearchImage,
274279
postgres_image: logSearchPostgresImage,
280+
postgres_init_image: logSearchPostgresInitImage,
275281
},
276282
};
277283
}
@@ -283,13 +289,17 @@ const AddTenant = ({
283289
storageClass: prometheusSelectedStorageClass,
284290
storageSize: parseInt(prometheusVolumeSize),
285291
image: prometheusImage,
292+
sidecar_image: prometheusSidecarImage,
293+
init_image: prometheusInitImage,
286294
},
287295
};
288296
} else {
289297
dataSend = {
290298
...dataSend,
291299
prometheusConfiguration: {
292300
image: prometheusImage,
301+
sidecar_image: prometheusSidecarImage,
302+
init_image: prometheusInitImage,
293303
},
294304
};
295305
}

portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Configure.tsx

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ interface IConfigureProps {
5656
logSearchImage: string;
5757
kesImage: string;
5858
logSearchPostgresImage: string;
59+
logSearchPostgresInitImage: string;
5960
prometheusSelectedStorageClass: string;
6061
prometheusImage: string;
62+
prometheusSidecarImage: string;
63+
prometheusInitImage: string;
6164
selectedStorageClass: string;
6265
}
6366

@@ -88,11 +91,14 @@ const Configure = ({
8891
logSearchImage,
8992
kesImage,
9093
logSearchPostgresImage,
94+
logSearchPostgresInitImage,
9195
prometheusVolumeSize,
9296
prometheusSizeFactor,
9397
logSearchSelectedStorageClass,
9498
prometheusSelectedStorageClass,
9599
prometheusImage,
100+
prometheusSidecarImage,
101+
prometheusInitImage,
96102
updateAddField,
97103
isPageValid,
98104
selectedStorageClass,
@@ -185,6 +191,14 @@ const Configure = ({
185191
customPatternMessage:
186192
"Format must be of form: 'library/postgres:VERSION'",
187193
},
194+
{
195+
fieldKey: "logSearchPostgresInitImage",
196+
required: false,
197+
value: logSearchPostgresInitImage,
198+
pattern: /^((.*?)\/(.*?):(.+))$/,
199+
customPatternMessage:
200+
"Format must be of form: 'library/busybox:VERSION'",
201+
},
188202
{
189203
fieldKey: "prometheusImage",
190204
required: false,
@@ -193,6 +207,22 @@ const Configure = ({
193207
customPatternMessage:
194208
"Format must be of form: 'minio/prometheus:VERSION'",
195209
},
210+
{
211+
fieldKey: "prometheusSidecarImage",
212+
required: false,
213+
value: prometheusSidecarImage,
214+
pattern: /^((.*?)\/(.*?):(.+))$/,
215+
customPatternMessage:
216+
"Format must be of form: 'project/container:VERSION'",
217+
},
218+
{
219+
fieldKey: "prometheusInitImage",
220+
required: false,
221+
value: prometheusInitImage,
222+
pattern: /^((.*?)\/(.*?):(.+))$/,
223+
customPatternMessage:
224+
"Format must be of form: 'library/busybox:VERSION'",
225+
},
196226
];
197227
if (customDockerhub) {
198228
customAccountValidation = [
@@ -227,7 +257,10 @@ const Configure = ({
227257
logSearchImage,
228258
kesImage,
229259
logSearchPostgresImage,
260+
logSearchPostgresInitImage,
230261
prometheusImage,
262+
prometheusSidecarImage,
263+
prometheusInitImage,
231264
customDockerhub,
232265
imageRegistry,
233266
imageRegistryUsername,
@@ -352,6 +385,20 @@ const Configure = ({
352385
placeholder="E.g. library/postgres:13"
353386
/>
354387
</Grid>
388+
<Grid item xs={12}>
389+
<InputBoxWrapper
390+
id="logSearchPostgresInitImage"
391+
name="logSearchPostgresInitImage"
392+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
393+
updateField("logSearchPostgresInitImage", e.target.value);
394+
cleanValidation("logSearchPostgresInitImage");
395+
}}
396+
label="Log Search Postgres's Init Image"
397+
value={logSearchPostgresInitImage}
398+
error={validationErrors["logSearchPostgresInitImage"] || ""}
399+
placeholder="E.g. library/busybox:1.33.1"
400+
/>
401+
</Grid>
355402
<Grid item xs={12}>
356403
<InputBoxWrapper
357404
id="prometheusImage"
@@ -366,6 +413,34 @@ const Configure = ({
366413
placeholder="E.g. quay.io/prometheus/prometheus:latest"
367414
/>
368415
</Grid>
416+
<Grid item xs={12}>
417+
<InputBoxWrapper
418+
id="prometheusSidecarImage"
419+
name="prometheusSidecarImage"
420+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
421+
updateField("prometheusSidecarImage", e.target.value);
422+
cleanValidation("prometheusSidecarImage");
423+
}}
424+
label="Prometheus Sidecar Image"
425+
value={prometheusSidecarImage}
426+
error={validationErrors["prometheusSidecarImage"] || ""}
427+
placeholder="E.g. quay.io/prometheus/prometheus:latest"
428+
/>
429+
</Grid>
430+
<Grid item xs={12}>
431+
<InputBoxWrapper
432+
id="prometheusInitImage"
433+
name="prometheusInitImage"
434+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
435+
updateField("prometheusInitImage", e.target.value);
436+
cleanValidation("prometheusInitImage");
437+
}}
438+
label="Prometheus Init Image"
439+
value={prometheusInitImage}
440+
error={validationErrors["prometheusInitImage"] || ""}
441+
placeholder="E.g. quay.io/prometheus/prometheus:latest"
442+
/>
443+
</Grid>
369444
</Fragment>
370445
)}
371446
{customImage && (
@@ -620,9 +695,15 @@ const mapState = (state: AppState) => ({
620695
kesImage: state.tenants.createTenant.fields.configure.kesImage,
621696
logSearchPostgresImage:
622697
state.tenants.createTenant.fields.configure.logSearchPostgresImage,
698+
logSearchPostgresInitImage:
699+
state.tenants.createTenant.fields.configure.logSearchPostgresInitImage,
623700
prometheusSelectedStorageClass:
624701
state.tenants.createTenant.fields.configure.prometheusSelectedStorageClass,
625702
prometheusImage: state.tenants.createTenant.fields.configure.prometheusImage,
703+
prometheusSidecarImage:
704+
state.tenants.createTenant.fields.configure.prometheusSidecarImage,
705+
prometheusInitImage:
706+
state.tenants.createTenant.fields.configure.prometheusInitImage,
626707
selectedStorageClass:
627708
state.tenants.createTenant.fields.nameTenant.selectedStorageClass,
628709
});

portal-ui/src/screens/Console/Tenants/reducer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,14 @@ const initialState: ITenantState = {
7676
logSearchImage: "",
7777
kesImage: "",
7878
logSearchPostgresImage: "",
79+
logSearchPostgresInitImage: "",
7980
prometheusVolumeSize: "5",
8081
prometheusSizeFactor: "Gi",
8182
logSearchSelectedStorageClass: "",
8283
prometheusSelectedStorageClass: "",
8384
prometheusImage: "",
85+
prometheusSidecarImage: "",
86+
prometheusInitImage: "",
8487
},
8588
identityProvider: {
8689
idpSelection: "Built-in",
@@ -544,10 +547,13 @@ export function tenantsReducer(
544547
logSearchImage: "",
545548
kesImage: "",
546549
logSearchPostgresImage: "",
550+
logSearchPostgresInitImage: "",
547551
prometheusVolumeSize: "5",
548552
prometheusSizeFactor: "Gi",
549553
prometheusSelectedStorageClass: "",
550554
prometheusImage: "",
555+
prometheusSidecarImage: "",
556+
prometheusInitImage: "",
551557
},
552558
identityProvider: {
553559
idpSelection: "Built-in",

0 commit comments

Comments
 (0)