Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions charts/kubedbcom-milvus-editor-options/templates/binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.spec.admin.expose.enable.default }}
apiVersion: catalog.appscode.com/v1alpha1
kind: MilvusBinding
metadata:
name: {{ include "kubedbcom-milvus-editor-options.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "kubedbcom-milvus-editor-options.labels" . | nindent 4 }}
spec:
sourceRef:
name: {{ include "kubedbcom-milvus-editor-options.fullname" . }}
namespace: {{ .Release.Namespace }}
uiExposure:
disableUI: {{ .Values.spec.admin.expose.uiExposure.disableUI }}
disableCostEfficiency: {{ .Values.spec.admin.expose.uiExposure.disableCostEfficiency }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/kubedbcom-milvus-editor-options/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,12 @@ step:
name: isToggleOn|tls
type: function
type: block-layout
- if:
name: isToggleOn|expose
type: function
label: Expose via Gateway?
schema: schema/properties/spec/properties/admin/properties/expose/properties/enable/properties/default
type: switch
if:
name: showAdditionalSettings
type: function
Expand Down
14 changes: 14 additions & 0 deletions charts/kubedbcom-milvus-editor/ui/edit-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1024,4 +1024,18 @@ step:
id: monitoring
loader: initMonitoring
type: single-step-form
- elements:
- fullwidth: true
init:
type: func
value: isBindingAlreadyOn
label: Expose Database
schema: temp/properties/binding
type: switch
watcher:
func: addOrRemoveBinding
paths:
- temp/properties/binding
id: binding
type: single-step-form
type: multi-step-form
53 changes: 45 additions & 8 deletions charts/kubedbcom-milvus-editor/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ export const useFunc = (model) => {
async function getIssuerRefsName() {
const owner = storeGet('/route/params/user')
const cluster = storeGet('/route/params/cluster')
const kind = getValue(
model,
'/resources/kubedbComMilvus/spec/tls/issuerRef/kind',
)
const kind = getValue(model, '/resources/kubedbComMilvus/spec/tls/issuerRef/kind')
const namespace = getValue(model, '/metadata/release/namespace')

if (kind === 'Issuer') {
Expand Down Expand Up @@ -672,10 +669,8 @@ export const useFunc = (model) => {
function showOpsRequestOptions() {
if (isKubedb()) return true
return (
!!getValue(
model,
'/resources/autoscalingKubedbComMilvusAutoscaler/spec/databaseRef/name',
) && !!getValue(discriminator, '/autoscalingType')
!!getValue(model, '/resources/autoscalingKubedbComMilvusAutoscaler/spec/databaseRef/name') &&
!!getValue(discriminator, '/autoscalingType')
)
}

Expand Down Expand Up @@ -771,6 +766,45 @@ export const useFunc = (model) => {
}
}

function isBindingAlreadyOn() {
const value = getValue(model, '/resources')
const keys = Object.keys(value)
const isExposeBinding = !!keys.find((str) => str === 'catalogAppscodeComMilvusBinding')
return isExposeBinding
}

function addOrRemoveBinding() {
const value = getValue(discriminator, `/binding`)
const dbName = getValue(model, '/metadata/release/name')
const dbNamespace = getValue(model, '/metadata/release/namespace')
const labels = getValue(model, '/resources/kubedbComMilvus/metadata/labels')
const bindingValues = {
apiVersion: 'catalog.appscode.com/v1alpha1',
kind: 'MilvusBinding',
metadata: {
labels,
name: dbName,
namespace: dbNamespace,
},
spec: {
sourceRef: {
name: dbName,
namespace: dbNamespace,
},
},
}

if (value) {
commit('wizard/model$update', {
path: '/resources/catalogAppscodeComMilvusBinding',
value: bindingValues,
force: true,
})
} else {
commit('wizard/model$delete', '/resources/catalogAppscodeComMilvusBinding')
}
}

return {
returnFalse,
returnTrue,
Expand Down Expand Up @@ -837,5 +871,8 @@ export const useFunc = (model) => {
setApplyToIfReady,
handleUnit,
setValueFromDbDetails,

addOrRemoveBinding,
isBindingAlreadyOn,
}
}
16 changes: 16 additions & 0 deletions charts/kubedbcom-qdrant-editor-options/templates/binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.spec.admin.expose.enable.default }}
apiVersion: catalog.appscode.com/v1alpha1
kind: QdrantBinding
metadata:
name: {{ include "kubedbcom-qdrant-editor.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "kubedbcom-qdrant-editor.labels" . | nindent 4 }}
spec:
sourceRef:
name: {{ include "kubedbcom-qdrant-editor.fullname" . }}
namespace: {{ .Release.Namespace }}
uiExposure:
disableUI: {{ .Values.spec.admin.expose.uiExposure.disableUI }}
disableCostEfficiency: {{ .Values.spec.admin.expose.uiExposure.disableCostEfficiency }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/kubedbcom-qdrant-editor-options/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ step:
name: isToggleOn|tls
type: function
type: block-layout
- if:
name: isToggleOn|expose
type: function
label: Expose via Gateway?
schema: schema/properties/spec/properties/admin/properties/expose/properties/enable/properties/default
type: switch
if:
name: showAdditionalSettings
type: function
Expand Down
16 changes: 16 additions & 0 deletions charts/kubedbcom-weaviate-editor-options/templates/binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.spec.admin.expose.enable.default }}
apiVersion: catalog.appscode.com/v1alpha1
kind: WeaviateBinding
metadata:
name: {{ include "kubedbcom-weaviate-editor-options.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "kubedbcom-weaviate-editor-options.labels" . | nindent 4 }}
spec:
sourceRef:
name: {{ include "kubedbcom-weaviate-editor-options.fullname" . }}
namespace: {{ .Release.Namespace }}
uiExposure:
disableUI: {{ .Values.spec.admin.expose.uiExposure.disableUI }}
disableCostEfficiency: {{ .Values.spec.admin.expose.uiExposure.disableCostEfficiency }}
{{- end }}
9 changes: 6 additions & 3 deletions charts/kubedbcom-weaviate-editor-options/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,12 @@ step:
validation:
type: required
type: block-layout
if:
name: returnFalse
type: function
- if:
name: isToggleOn|expose
type: function
label: Expose via Gateway?
schema: schema/properties/spec/properties/admin/properties/expose/properties/enable/properties/default
type: switch
label: Additional Options
showLabels: true
type: block-layout
Expand Down
14 changes: 14 additions & 0 deletions charts/kubedbcom-weaviate-editor/ui/edit-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,18 @@ step:
type: block-layout
id: storage-autoscaler
type: single-step-form
- elements:
- fullwidth: true
init:
type: func
value: isBindingAlreadyOn
label: Expose Database
schema: temp/properties/binding
type: switch
watcher:
func: addOrRemoveBinding
paths:
- temp/properties/binding
id: binding
type: single-step-form
type: multi-step-form
41 changes: 41 additions & 0 deletions charts/kubedbcom-weaviate-editor/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,45 @@ export const useFunc = (model) => {
return showStoragememory
}

function isBindingAlreadyOn() {
const value = getValue(model, '/resources')
const keys = Object.keys(value)
const isExposeBinding = !!keys.find((str) => str === 'catalogAppscodeComWeaviateBinding')
return isExposeBinding
}

function addOrRemoveBinding() {
const value = getValue(discriminator, `/binding`)
const dbName = getValue(model, '/metadata/release/name')
const dbNamespace = getValue(model, '/metadata/release/namespace')
const labels = getValue(model, '/resources/kubedbComWeaviate/metadata/labels')
const bindingValues = {
apiVersion: 'catalog.appscode.com/v1alpha1',
kind: 'WeaviateBinding',
metadata: {
labels,
name: dbName,
namespace: dbNamespace,
},
spec: {
sourceRef: {
name: dbName,
namespace: dbNamespace,
},
},
}

if (value) {
commit('wizard/model$update', {
path: '/resources/catalogAppscodeComWeaviateBinding',
value: bindingValues,
force: true,
})
} else {
commit('wizard/model$delete', '/resources/catalogAppscodeComWeaviateBinding')
}
}

return {
isKubedb,
isConsole,
Expand Down Expand Up @@ -584,5 +623,7 @@ export const useFunc = (model) => {
returnFalse,
setValueFromDbDetails,
showStorageMemoryOption,
isBindingAlreadyOn,
addOrRemoveBinding,
}
}
Loading