diff --git a/models/log_search_configuration.go b/models/log_search_configuration.go index f630d7c94..f13e20794 100644 --- a/models/log_search_configuration.go +++ b/models/log_search_configuration.go @@ -40,6 +40,9 @@ type LogSearchConfiguration struct { // postgres image PostgresImage string `json:"postgres_image,omitempty"` + // postgres init image + PostgresInitImage string `json:"postgres_init_image,omitempty"` + // storage class StorageClass string `json:"storageClass,omitempty"` diff --git a/models/prometheus_configuration.go b/models/prometheus_configuration.go index 53f780642..76cdfd5a9 100644 --- a/models/prometheus_configuration.go +++ b/models/prometheus_configuration.go @@ -38,9 +38,15 @@ type PrometheusConfiguration struct { // image Image string `json:"image,omitempty"` + // init image + InitImage string `json:"init_image,omitempty"` + // security context SecurityContext *SecurityContext `json:"securityContext,omitempty"` + // sidecar image + SidecarImage string `json:"sidecar_image,omitempty"` + // storage class StorageClass string `json:"storageClass,omitempty"` diff --git a/operatorapi/embedded_spec.go b/operatorapi/embedded_spec.go index 63c790f95..e5a604ba6 100644 --- a/operatorapi/embedded_spec.go +++ b/operatorapi/embedded_spec.go @@ -2058,6 +2058,9 @@ func init() { "postgres_image": { "type": "string" }, + "postgres_init_image": { + "type": "string" + }, "storageClass": { "type": "string", "default": "" @@ -2611,10 +2614,16 @@ func init() { "image": { "type": "string" }, + "init_image": { + "type": "string" + }, "securityContext": { "type": "object", "$ref": "#/definitions/securityContext" }, + "sidecar_image": { + "type": "string" + }, "storageClass": { "type": "string", "default": "" @@ -5755,6 +5764,9 @@ func init() { "postgres_image": { "type": "string" }, + "postgres_init_image": { + "type": "string" + }, "storageClass": { "type": "string", "default": "" @@ -6173,10 +6185,16 @@ func init() { "image": { "type": "string" }, + "init_image": { + "type": "string" + }, "securityContext": { "type": "object", "$ref": "#/definitions/securityContext" }, + "sidecar_image": { + "type": "string" + }, "storageClass": { "type": "string", "default": "" diff --git a/operatorapi/operator_tenants.go b/operatorapi/operator_tenants.go index c7fd48d5a..38c41e9bb 100644 --- a/operatorapi/operator_tenants.go +++ b/operatorapi/operator_tenants.go @@ -1228,6 +1228,7 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre logSearchStorageClass := "" // Default is "" logSearchImage := "" logSearchPgImage := "" + logSearchPgInitImage := "" if tenantReq.LogSearchConfiguration != nil { if tenantReq.LogSearchConfiguration.StorageSize != nil { @@ -1245,6 +1246,9 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre if tenantReq.LogSearchConfiguration.PostgresImage != "" { logSearchPgImage = tenantReq.LogSearchConfiguration.PostgresImage } + if tenantReq.LogSearchConfiguration.PostgresInitImage != "" { + logSearchPgInitImage = tenantReq.LogSearchConfiguration.PostgresInitImage + } } logSearchDiskSpace := resource.NewQuantity(diskSpaceFromAPI, resource.DecimalExponent) @@ -1276,16 +1280,22 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre }, }, } + // set log search images if any if logSearchImage != "" { minInst.Spec.Log.Image = logSearchImage } if logSearchPgImage != "" { minInst.Spec.Log.Db.Image = logSearchPgImage } + if logSearchPgInitImage != "" { + minInst.Spec.Log.Db.InitImage = logSearchPgInitImage + } - prometheusDiskSpace := 5 // Default is 5 by API - prometheusStorageClass := "" // Default is "" - prometheusImage := "" // Default is "" + prometheusDiskSpace := 5 // Default is 5 by API + prometheusStorageClass := "" // Default is "" + prometheusImage := "" // Default is "" + prometheusSidecardImage := "" // Default is "" + prometheusInitImage := "" // Default is "" if tenantReq.PrometheusConfiguration != nil { if tenantReq.PrometheusConfiguration.StorageSize != nil { @@ -1303,6 +1313,12 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre if tenantReq.PrometheusConfiguration.Image != "" { prometheusImage = tenantReq.PrometheusConfiguration.Image } + if tenantReq.PrometheusConfiguration.SidecarImage != "" { + prometheusSidecardImage = tenantReq.PrometheusConfiguration.SidecarImage + } + if tenantReq.PrometheusConfiguration.InitImage != "" { + prometheusInitImage = tenantReq.PrometheusConfiguration.InitImage + } } minInst.Spec.Prometheus = &miniov2.PrometheusConfig{ @@ -1312,6 +1328,12 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre if prometheusImage != "" { minInst.Spec.Prometheus.Image = prometheusImage } + if prometheusSidecardImage != "" { + minInst.Spec.Prometheus.SideCarImage = prometheusSidecardImage + } + if prometheusInitImage != "" { + minInst.Spec.Prometheus.InitImage = prometheusInitImage + } // if security context for prometheus is present, configure it. if tenantReq.PrometheusConfiguration != nil && tenantReq.PrometheusConfiguration.SecurityContext != nil { sc := tenantReq.PrometheusConfiguration.SecurityContext diff --git a/portal-ui/src/common/types.ts b/portal-ui/src/common/types.ts index e4b954bda..1d0fd108d 100644 --- a/portal-ui/src/common/types.ts +++ b/portal-ui/src/common/types.ts @@ -369,12 +369,15 @@ export interface LogSearchConfiguration { storageSize?: number; image: string; postgres_image: string; + postgres_init_image: string; } export interface PrometheusConfiguration { storageClass?: string; storageSize?: number; image: string; + sidecar_image: string; + init_image: string; } export interface AffinityConfiguration { diff --git a/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx b/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx index 8af509d38..833b3e277 100644 --- a/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx +++ b/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx @@ -175,7 +175,11 @@ const AddTenant = ({ const logSearchImage = fields.configure.logSearchImage; const kesImage = fields.configure.kesImage; const logSearchPostgresImage = fields.configure.logSearchPostgresImage; + const logSearchPostgresInitImage = + fields.configure.logSearchPostgresInitImage; const prometheusImage = fields.configure.prometheusImage; + const prometheusSidecarImage = fields.configure.prometheusSidecarImage; + const prometheusInitImage = fields.configure.prometheusInitImage; const prometheusSelectedStorageClass = fields.configure.prometheusSelectedStorageClass; const prometheusVolumeSize = fields.configure.prometheusVolumeSize; @@ -264,6 +268,7 @@ const AddTenant = ({ storageSize: parseInt(logSearchVolumeSize), image: logSearchImage, postgres_image: logSearchPostgresImage, + postgres_init_image: logSearchPostgresInitImage, }, }; } else { @@ -272,6 +277,7 @@ const AddTenant = ({ logSearchConfiguration: { image: logSearchImage, postgres_image: logSearchPostgresImage, + postgres_init_image: logSearchPostgresInitImage, }, }; } @@ -283,6 +289,8 @@ const AddTenant = ({ storageClass: prometheusSelectedStorageClass, storageSize: parseInt(prometheusVolumeSize), image: prometheusImage, + sidecar_image: prometheusSidecarImage, + init_image: prometheusInitImage, }, }; } else { @@ -290,6 +298,8 @@ const AddTenant = ({ ...dataSend, prometheusConfiguration: { image: prometheusImage, + sidecar_image: prometheusSidecarImage, + init_image: prometheusInitImage, }, }; } diff --git a/portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Configure.tsx b/portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Configure.tsx index 618f7f35f..54f2bbb60 100644 --- a/portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Configure.tsx +++ b/portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Configure.tsx @@ -56,8 +56,11 @@ interface IConfigureProps { logSearchImage: string; kesImage: string; logSearchPostgresImage: string; + logSearchPostgresInitImage: string; prometheusSelectedStorageClass: string; prometheusImage: string; + prometheusSidecarImage: string; + prometheusInitImage: string; selectedStorageClass: string; } @@ -88,11 +91,14 @@ const Configure = ({ logSearchImage, kesImage, logSearchPostgresImage, + logSearchPostgresInitImage, prometheusVolumeSize, prometheusSizeFactor, logSearchSelectedStorageClass, prometheusSelectedStorageClass, prometheusImage, + prometheusSidecarImage, + prometheusInitImage, updateAddField, isPageValid, selectedStorageClass, @@ -185,6 +191,14 @@ const Configure = ({ customPatternMessage: "Format must be of form: 'library/postgres:VERSION'", }, + { + fieldKey: "logSearchPostgresInitImage", + required: false, + value: logSearchPostgresInitImage, + pattern: /^((.*?)\/(.*?):(.+))$/, + customPatternMessage: + "Format must be of form: 'library/busybox:VERSION'", + }, { fieldKey: "prometheusImage", required: false, @@ -193,6 +207,22 @@ const Configure = ({ customPatternMessage: "Format must be of form: 'minio/prometheus:VERSION'", }, + { + fieldKey: "prometheusSidecarImage", + required: false, + value: prometheusSidecarImage, + pattern: /^((.*?)\/(.*?):(.+))$/, + customPatternMessage: + "Format must be of form: 'project/container:VERSION'", + }, + { + fieldKey: "prometheusInitImage", + required: false, + value: prometheusInitImage, + pattern: /^((.*?)\/(.*?):(.+))$/, + customPatternMessage: + "Format must be of form: 'library/busybox:VERSION'", + }, ]; if (customDockerhub) { customAccountValidation = [ @@ -227,7 +257,10 @@ const Configure = ({ logSearchImage, kesImage, logSearchPostgresImage, + logSearchPostgresInitImage, prometheusImage, + prometheusSidecarImage, + prometheusInitImage, customDockerhub, imageRegistry, imageRegistryUsername, @@ -352,6 +385,20 @@ const Configure = ({ placeholder="E.g. library/postgres:13" /> + + ) => { + updateField("logSearchPostgresInitImage", e.target.value); + cleanValidation("logSearchPostgresInitImage"); + }} + label="Log Search Postgres's Init Image" + value={logSearchPostgresInitImage} + error={validationErrors["logSearchPostgresInitImage"] || ""} + placeholder="E.g. library/busybox:1.33.1" + /> + + + ) => { + updateField("prometheusSidecarImage", e.target.value); + cleanValidation("prometheusSidecarImage"); + }} + label="Prometheus Sidecar Image" + value={prometheusSidecarImage} + error={validationErrors["prometheusSidecarImage"] || ""} + placeholder="E.g. quay.io/prometheus/prometheus:latest" + /> + + + ) => { + updateField("prometheusInitImage", e.target.value); + cleanValidation("prometheusInitImage"); + }} + label="Prometheus Init Image" + value={prometheusInitImage} + error={validationErrors["prometheusInitImage"] || ""} + placeholder="E.g. quay.io/prometheus/prometheus:latest" + /> + )} {customImage && ( @@ -620,9 +695,15 @@ const mapState = (state: AppState) => ({ kesImage: state.tenants.createTenant.fields.configure.kesImage, logSearchPostgresImage: state.tenants.createTenant.fields.configure.logSearchPostgresImage, + logSearchPostgresInitImage: + state.tenants.createTenant.fields.configure.logSearchPostgresInitImage, prometheusSelectedStorageClass: state.tenants.createTenant.fields.configure.prometheusSelectedStorageClass, prometheusImage: state.tenants.createTenant.fields.configure.prometheusImage, + prometheusSidecarImage: + state.tenants.createTenant.fields.configure.prometheusSidecarImage, + prometheusInitImage: + state.tenants.createTenant.fields.configure.prometheusInitImage, selectedStorageClass: state.tenants.createTenant.fields.nameTenant.selectedStorageClass, }); diff --git a/portal-ui/src/screens/Console/Tenants/reducer.ts b/portal-ui/src/screens/Console/Tenants/reducer.ts index 50abd343f..25001d62c 100644 --- a/portal-ui/src/screens/Console/Tenants/reducer.ts +++ b/portal-ui/src/screens/Console/Tenants/reducer.ts @@ -76,11 +76,14 @@ const initialState: ITenantState = { logSearchImage: "", kesImage: "", logSearchPostgresImage: "", + logSearchPostgresInitImage: "", prometheusVolumeSize: "5", prometheusSizeFactor: "Gi", logSearchSelectedStorageClass: "", prometheusSelectedStorageClass: "", prometheusImage: "", + prometheusSidecarImage: "", + prometheusInitImage: "", }, identityProvider: { idpSelection: "Built-in", @@ -544,10 +547,13 @@ export function tenantsReducer( logSearchImage: "", kesImage: "", logSearchPostgresImage: "", + logSearchPostgresInitImage: "", prometheusVolumeSize: "5", prometheusSizeFactor: "Gi", prometheusSelectedStorageClass: "", prometheusImage: "", + prometheusSidecarImage: "", + prometheusInitImage: "", }, identityProvider: { idpSelection: "Built-in", diff --git a/portal-ui/src/screens/Console/Tenants/types.ts b/portal-ui/src/screens/Console/Tenants/types.ts index fb388c488..cd34d4320 100644 --- a/portal-ui/src/screens/Console/Tenants/types.ts +++ b/portal-ui/src/screens/Console/Tenants/types.ts @@ -138,10 +138,13 @@ export interface IConfigureFields { logSearchImage: string; kesImage: string; logSearchPostgresImage: string; + logSearchPostgresInitImage: string; prometheusVolumeSize: string; prometheusSizeFactor: string; prometheusSelectedStorageClass: string; prometheusImage: string; + prometheusSidecarImage: string; + prometheusInitImage: string; } export interface IIdentityProviderFields { diff --git a/swagger-operator.yml b/swagger-operator.yml index 96f51acc8..abe128d02 100644 --- a/swagger-operator.yml +++ b/swagger-operator.yml @@ -1306,6 +1306,8 @@ definitions: type: string postgres_image: type: string + postgres_init_image: + type: string prometheusConfiguration: type: object properties: @@ -1317,6 +1319,10 @@ definitions: default: 5 image: type: string + sidecar_image: + type: string + init_image: + type: string securityContext: type: object $ref: '#/definitions/securityContext'