Skip to content

Commit 54eba40

Browse files
rafi-ruetcse17RokibulHasan7
authored andcommitted
Remove all the fields that renders on condition of prom_label_proxy and thanos_operator
Signed-off-by: rafi-ruetcse17 <rafialam6610@gmail.com>
1 parent 9c4fbef commit 54eba40

2 files changed

Lines changed: 1 addition & 239 deletions

File tree

charts/uik8sappscodecom-featureset-opscenter-observability-editor/ui/create-ui.yaml

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -32,105 +32,6 @@ step:
3232
- temp/properties/monitoringClusterName
3333
validation:
3434
type: required
35-
- type: block-layout
36-
if:
37-
name: checkIsThanosOrPromLabelProxyEnabled
38-
type: function
39-
label: Object Storage Configuration
40-
elements:
41-
- type: select
42-
label: Backend Provider
43-
schema: temp/properties/objStorage/provider
44-
init:
45-
type: static
46-
value: s3
47-
options:
48-
- text: s3
49-
value: s3
50-
validation:
51-
type: required
52-
watcher:
53-
func: onEnabledFeaturesChange
54-
paths:
55-
- temp/properties/objStorage/provider
56-
- type: input
57-
label: Bucket
58-
loader: fetchInitialObjStorageBucket
59-
schema: temp/properties/objStorage/bucket
60-
validation:
61-
type: required
62-
watcher:
63-
func: onEnabledFeaturesChange
64-
paths:
65-
- temp/properties/objStorage/bucket
66-
- type: input
67-
label: Endpoint
68-
loader: fetchInitialObjStorageEndpoint
69-
schema: temp/properties/objStorage/endpoint
70-
validation:
71-
type: required
72-
watcher:
73-
func: onEnabledFeaturesChange
74-
paths:
75-
- temp/properties/objStorage/endpoint
76-
- type: input
77-
label: Access Key
78-
loader: fetchInitialObjStorageAccessKey
79-
schema: temp/properties/objStorage/accessKey
80-
validation:
81-
type: required
82-
watcher:
83-
func: onEnabledFeaturesChange
84-
paths:
85-
- temp/properties/objStorage/accessKey
86-
- type: input
87-
label: Secret Key
88-
loader: fetchInitialObjStorageSecretKey
89-
schema: temp/properties/objStorage/secretKey
90-
validation:
91-
type: required
92-
watcher:
93-
func: onEnabledFeaturesChange
94-
paths:
95-
- temp/properties/objStorage/secretKey
96-
- type: input
97-
label: Region
98-
loader: fetchInitialObjStorageRegion
99-
schema: temp/properties/objStorage/region
100-
validation:
101-
type: required
102-
watcher:
103-
func: onEnabledFeaturesChange
104-
paths:
105-
- temp/properties/objStorage/region
106-
- type: label-element
107-
if:
108-
name: checkIsPromLabelProxyEnabled
109-
type: function
110-
label: TLS Config (Client CA Certificate)
111-
customClass: mt-16 font-semibold
112-
- type: input
113-
if:
114-
name: checkIsPromLabelProxyEnabled
115-
type: function
116-
label: Secret Name
117-
loader: fetchInitialObjStorageTlsSecretName
118-
schema: temp/properties/objStorage/tlsSecretName
119-
watcher:
120-
func: onEnabledFeaturesChange
121-
paths:
122-
- temp/properties/objStorage/tlsSecretName
123-
- type: input
124-
if:
125-
name: checkIsPromLabelProxyEnabled
126-
type: function
127-
label: Key
128-
loader: fetchInitialObjStorageTlsKey
129-
schema: temp/properties/objStorage/tlsKey
130-
watcher:
131-
func: onEnabledFeaturesChange
132-
paths:
133-
- temp/properties/objStorage/tlsKey
13435
id: opscenter-monitoring
13536
loader: setReleaseNameAndNamespaceAndInitializeValues
13637
type: single-step-form

charts/uik8sappscodecom-featureset-opscenter-observability-editor/ui/functions.js

Lines changed: 1 addition & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ export const useFunc = (model) => {
99
setDiscriminatorValue('/enabledFeatures', [])
1010
setDiscriminatorValue('/isResourceLoaded', false)
1111
const appsCodeOtelStack = 'appscode-otel-stack'
12-
const thanosOperator = 'thanos-operator'
13-
const promLabelProxy = 'prom-label-proxy'
14-
15-
const thanosOperatorResPath = 'helmToolkitFluxcdIoHelmRelease_thanos_operator'
16-
const promLabelProxyResPath = 'helmToolkitFluxcdIoHelmRelease_prom_label_proxy'
1712
let resources = {}
18-
let telemetryHostPromise = null
1913

2014
// get specific feature details
2115
function getFeatureSetDetails() {
@@ -256,7 +250,6 @@ export const useFunc = (model) => {
256250
const enabledFeatures = getValue(discriminator, '/enabledFeatures') || []
257251
const monitoringClusterName = getValue(discriminator, '/monitoringClusterName')
258252
let monitoringClusterConfig = getValue(discriminator, '/monitoringClusterConfig')
259-
const objStorage = getValue(discriminator, '/objStorage')
260253

261254
const allFeatures = storeGet('/cluster/features/result') || []
262255

@@ -295,65 +288,6 @@ export const useFunc = (model) => {
295288
}
296289
}
297290

298-
if (featureName === thanosOperator && objStorage) {
299-
const endpoint = (objStorage.endpoint || '').replace(/^https?:\/\//, '')
300-
mergedResourceValues = deepMergeValues(initialResourceValues, {
301-
objStorage: {
302-
provider: objStorage.provider || 's3',
303-
bucket: objStorage.bucket || '',
304-
endpoint: endpoint,
305-
accessKey: objStorage.accessKey || '',
306-
secretKey: objStorage.secretKey || '',
307-
region: objStorage.region || '',
308-
},
309-
})
310-
}
311-
312-
if (featureName === promLabelProxy && objStorage) {
313-
const owner = storeGet('/route/params/user')
314-
const cluster = storeGet('/route/params/cluster')
315-
if (!telemetryHostPromise) {
316-
telemetryHostPromise = (async () => {
317-
try {
318-
const { data } = await axios.get(`/telemetry/${owner}/${cluster}/stack/host`)
319-
return data || ''
320-
} catch (e) {
321-
window.console.error('Failed to fetch telemetry host', e)
322-
return ''
323-
}
324-
})()
325-
}
326-
const telemetryHost = await telemetryHostPromise
327-
328-
const tlsSecretName = (objStorage.tlsSecretName || '').trim()
329-
const tlsKey = (objStorage.tlsKey || '').trim()
330-
331-
mergedResourceValues = deepMergeValues(initialResourceValues, {
332-
clickhouse: {
333-
s3: {
334-
provider: objStorage.provider || 's3',
335-
bucket: objStorage.bucket || '',
336-
endpoint: objStorage.endpoint || '',
337-
accessKey: objStorage.accessKey || '',
338-
secretKey: objStorage.secretKey || '',
339-
region: objStorage.region || '',
340-
},
341-
tls:
342-
tlsSecretName && tlsKey
343-
? {
344-
clientCaCertificateRefs: {
345-
key: tlsKey,
346-
name: tlsSecretName,
347-
},
348-
}
349-
: undefined,
350-
},
351-
infra: {
352-
host: telemetryHost,
353-
},
354-
})
355-
}
356-
357291
commit('wizard/model$update', {
358292
path: `/resources/${resourceValuePath}`,
359293
value: {
@@ -526,69 +460,6 @@ export const useFunc = (model) => {
526460
await onEnabledFeaturesChange()
527461
}
528462

529-
function checkIsThanosOrPromLabelProxyEnabled() {
530-
const enabledFeatures = getValue(discriminator, '/enabledFeatures') || []
531-
return enabledFeatures.includes(thanosOperator) || enabledFeatures.includes(promLabelProxy)
532-
}
533-
534-
function checkIsPromLabelProxyEnabled() {
535-
const enabledFeatures = getValue(discriminator, '/enabledFeatures') || []
536-
return enabledFeatures.includes(promLabelProxy)
537-
}
538-
539-
function fetchInitialObjStorageProvider() {
540-
const thanosValues = resources[thanosOperatorResPath]?.spec?.values?.objStorage || {}
541-
const promValues = resources[promLabelProxyResPath]?.spec?.values?.clickhouse?.s3 || {}
542-
543-
return promValues.provider || thanosValues.provider || 's3'
544-
}
545-
546-
function fetchInitialObjStorageBucket() {
547-
const thanosValues = resources[thanosOperatorResPath]?.spec?.values?.objStorage || {}
548-
const promValues = resources[promLabelProxyResPath]?.spec?.values?.clickhouse?.s3 || {}
549-
550-
return promValues.bucket || thanosValues.bucket || ''
551-
}
552-
553-
function fetchInitialObjStorageEndpoint() {
554-
const thanosValues = resources[thanosOperatorResPath]?.spec?.values?.objStorage || {}
555-
const promValues = resources[promLabelProxyResPath]?.spec?.values?.clickhouse?.s3 || {}
556-
557-
return promValues.endpoint || thanosValues.endpoint || ''
558-
}
559-
560-
function fetchInitialObjStorageRegion() {
561-
const thanosValues = resources[thanosOperatorResPath]?.spec?.values?.objStorage || {}
562-
const promValues = resources[promLabelProxyResPath]?.spec?.values?.clickhouse?.s3 || {}
563-
564-
return promValues.region || thanosValues.region || ''
565-
}
566-
567-
function fetchInitialObjStorageAccessKey() {
568-
const thanosValues = resources[thanosOperatorResPath]?.spec?.values?.objStorage || {}
569-
const promValues = resources[promLabelProxyResPath]?.spec?.values?.clickhouse?.s3 || {}
570-
571-
return promValues.accessKey || thanosValues.accessKey || ''
572-
}
573-
574-
function fetchInitialObjStorageSecretKey() {
575-
const thanosValues = resources[thanosOperatorResPath]?.spec?.values?.objStorage || {}
576-
const promValues = resources[promLabelProxyResPath]?.spec?.values?.clickhouse?.s3 || {}
577-
578-
return promValues.secretKey || thanosValues.secretKey || ''
579-
}
580-
581-
function fetchInitialObjStorageTlsSecretName() {
582-
const promValues = resources[promLabelProxyResPath]?.spec?.values?.clickhouse?.tls || {}
583-
const refs = promValues.clientCaCertificateRefs || {}
584-
return refs.name || ''
585-
}
586-
587-
function fetchInitialObjStorageTlsKey() {
588-
const promValues = resources[promLabelProxyResPath]?.spec?.values?.clickhouse?.tls || {}
589-
const refs = promValues.clientCaCertificateRefs || {}
590-
return refs.key || ''
591-
}
592463

593464
return {
594465
hideThisElement,
@@ -605,16 +476,6 @@ export const useFunc = (model) => {
605476
fetchFeatureSetOptions,
606477
checkIsOtelStackEnabled,
607478
fetchMonitoringClusterOptions,
608-
onMonitoringClusterChange,
609-
checkIsThanosOrPromLabelProxyEnabled,
610-
checkIsPromLabelProxyEnabled,
611-
fetchInitialObjStorageProvider,
612-
fetchInitialObjStorageBucket,
613-
fetchInitialObjStorageEndpoint,
614-
fetchInitialObjStorageRegion,
615-
fetchInitialObjStorageAccessKey,
616-
fetchInitialObjStorageSecretKey,
617-
fetchInitialObjStorageTlsSecretName,
618-
fetchInitialObjStorageTlsKey,
479+
onMonitoringClusterChange
619480
}
620481
}

0 commit comments

Comments
 (0)