diff --git a/charts/kubevaultcom-vaultserver-editor-options/templates/kubestash/backupconfiguration.yaml b/charts/kubevaultcom-vaultserver-editor-options/templates/kubestash/backupconfiguration.yaml new file mode 100644 index 0000000000..9fbd0f5573 --- /dev/null +++ b/charts/kubevaultcom-vaultserver-editor-options/templates/kubestash/backupconfiguration.yaml @@ -0,0 +1,72 @@ +{{- if eq .Values.spec.backup.tool "KubeStash" -}} + +apiVersion: core.kubestash.com/v1alpha1 +kind: BackupConfiguration +metadata: + name: {{ include "kubevaultcom-vaultserver-editor-options.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "kubevaultcom-vaultserver-editor-options.labels" . | nindent 4 }} +spec: + target: + apiGroup: kubevault.com + kind: VaultServer + name: {{ include "kubevaultcom-vaultserver-editor-options.fullname" . }} + namespace: {{ .Release.Namespace }} + backends: + - name: default-backend + storageRef: + name: {{ .Values.spec.backup.kubestash.storageRef.name }} + namespace: {{ .Values.spec.backup.kubestash.storageRef.namespace }} + retentionPolicy: + name: {{ .Values.spec.backup.kubestash.retentionPolicy.name }} + namespace: {{ .Values.spec.backup.kubestash.retentionPolicy.namespace }} + sessions: + - name: full-backup + sessionHistoryLimit: 3 + scheduler: + schedule: {{ .Values.spec.backup.kubestash.schedule | quote }} + jobTemplate: + template: + spec: + containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsNonRoot: true + runAsUser: 65534 + runAsGroup: 65534 + seccompProfile: + type: RuntimeDefault + nodeSelector: + kubernetes.io/os: linux + backoffLimit: 2 + successfulJobsHistoryLimit: 2 + failedJobsHistoryLimit: 4 + repositories: + - name: {{ include "kubevaultcom-vaultserver-editor-options.fullname" . }} + backend: default-backend + directory: {{ .Release.Namespace }}/{{ include "kubevaultcom-vaultserver-editor-options.fullname" . }} + encryptionSecret: + name: {{ .Values.spec.backup.kubestash.encryptionSecret.name }} + namespace: {{ .Values.spec.backup.kubestash.encryptionSecret.namespace }} + addon: + name: vaultserver-addon + tasks: + - name: logical-backup + jobTemplate: + spec: + containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsNonRoot: true + runAsUser: 65534 + runAsGroup: 65534 + seccompProfile: + type: RuntimeDefault + nodeSelector: + kubernetes.io/os: linux +{{- end }} diff --git a/charts/kubevaultcom-vaultserver-editor-options/templates/stash/backupconfiguration.yaml b/charts/kubevaultcom-vaultserver-editor-options/templates/stash/backupconfiguration.yaml deleted file mode 100644 index 883f112900..0000000000 --- a/charts/kubevaultcom-vaultserver-editor-options/templates/stash/backupconfiguration.yaml +++ /dev/null @@ -1,25 +0,0 @@ -{{- if eq .Values.spec.backup.tool "Stash" -}} -apiVersion: stash.appscode.com/v1beta1 -kind: BackupConfiguration -metadata: - name: {{ include "kubevaultcom-vaultserver-editor-options.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "kubevaultcom-vaultserver-editor-options.labels" . | nindent 4 }} -spec: - schedule: {{ .Values.spec.backup.stash.schedule | quote }} - repository: - name: {{ include "kubevaultcom-vaultserver-editor-options.fullname" . }}-repo - target: - ref: - apiVersion: appcatalog.appscode.com/v1alpha1 - kind: AppBinding - name: {{ include "kubevaultcom-vaultserver-editor-options.fullname" . }} - runtimeSettings: - pod: - securityContext: - fsGroup: 65534 - retentionPolicy: - {{- .Values.spec.backup.stash.retentionPolicy | toYaml | nindent 4 }} - -{{- end }} diff --git a/charts/kubevaultcom-vaultserver-editor-options/templates/stash/repository.yaml b/charts/kubevaultcom-vaultserver-editor-options/templates/stash/repository.yaml deleted file mode 100644 index 6901c5783c..0000000000 --- a/charts/kubevaultcom-vaultserver-editor-options/templates/stash/repository.yaml +++ /dev/null @@ -1,75 +0,0 @@ -{{- if eq .Values.spec.backup.tool "Stash" -}} -apiVersion: stash.appscode.com/v1alpha1 -kind: Repository -metadata: - name: {{ include "kubevaultcom-vaultserver-editor-options.fullname" . }}-repo - namespace: {{ .Release.Namespace }} - labels: - {{- include "kubevaultcom-vaultserver-editor-options.labels" . | nindent 4 }} -spec: - backend: - storageSecretName: {{ default (printf "%s-repo-cred" (include "kubevaultcom-vaultserver-editor-options.fullname" .)) .Values.spec.backup.stash.authSecret.name }} - - {{- if eq .Values.spec.backup.stash.backend.provider "s3" }} - {{- with .Values.spec.backup.stash.backend.s3.spec }} - s3: - endpoint: {{ .endpoint }} - bucket: {{ .bucket }} - {{- with .region }} - region: {{ . }} - {{- end }} - {{- with .prefix }} - prefix: {{ . }} - {{- end }} - {{- end }} - {{- end }} - - {{- if eq .Values.spec.backup.stash.backend.provider "azure" }} - {{- with .Values.spec.backup.stash.backend.azure.spec }} - azure: - container: {{ .container }} - {{- with .prefix }} - prefix: {{ . }} - {{- end }} - {{- with .maxConnections }} - maxConnections: {{ . }} - {{- end }} - {{- end }} - {{- end }} - - {{- if eq .Values.spec.backup.stash.backend.provider "gcs" }} - {{- with .Values.spec.backup.stash.backend.gcs.spec }} - gcs: - bucket: {{ .bucket }} - {{- with .prefix }} - prefix: {{ . }} - {{- end }} - {{- with .maxConnections }} - maxConnections: {{ . }} - {{- end }} - {{- end }} - {{- end }} - - {{- if eq .Values.spec.backup.stash.backend.provider "swift" }} - {{- with .Values.spec.backup.stash.backend.swift.spec }} - swift: - container: {{ .container }} - {{- with .prefix }} - prefix: {{ . }} - {{- end }} - {{- end }} - {{- end }} - - {{- if eq .Values.spec.backup.stash.backend.provider "b2" }} - {{- with .Values.spec.backup.stash.backend.b2.spec }} - b2: - bucket: {{ .bucket }} - {{- with .prefix }} - prefix: {{ . }} - {{- end }} - {{- with .maxConnections }} - maxConnections: {{ . }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/charts/kubevaultcom-vaultserver-editor-options/templates/stash/secret.yaml b/charts/kubevaultcom-vaultserver-editor-options/templates/stash/secret.yaml deleted file mode 100644 index bf5809bd82..0000000000 --- a/charts/kubevaultcom-vaultserver-editor-options/templates/stash/secret.yaml +++ /dev/null @@ -1,94 +0,0 @@ -{{- if eq .Values.spec.backup.tool "Stash" -}} -{{- if .Values.spec.backup.stash.authSecret.password -}} -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "kubevaultcom-vaultserver-editor-options.fullname" . }}-repo-cred - namespace: {{ .Release.Namespace }} - labels: - {{- include "kubevaultcom-vaultserver-editor-options.labels" . | nindent 4 }} -type: Opaque -stringData: - RESTIC_PASSWORD: {{ .Values.spec.backup.stash.authSecret.password | quote }} - -{{- if eq .Values.spec.backup.stash.backend.provider "s3" }} - {{- with .Values.spec.backup.stash.backend.s3.auth }} - AWS_ACCESS_KEY_ID: '{{ .AWS_ACCESS_KEY_ID }}' - AWS_SECRET_ACCESS_KEY: '{{ .AWS_SECRET_ACCESS_KEY }}' - {{- with .CA_CERT_DATA }} - {{ dict "CA_CERT_DATA" . | toYaml | nindent 2 }} - {{- end }} - {{- end }} -{{- end }} - -{{- if eq .Values.spec.backup.stash.backend.provider "azure" }} - {{- with .Values.spec.backup.stash.backend.azure.auth }} - AZURE_ACCOUNT_NAME: '{{ .AZURE_ACCOUNT_NAME }}' - AZURE_ACCOUNT_KEY: '{{ .AZURE_ACCOUNT_KEY }}' - {{- end }} -{{- end }} - -{{- if eq .Values.spec.backup.stash.backend.provider "gcs" }} - {{- with .Values.spec.backup.stash.backend.gcs.auth }} - GOOGLE_SERVICE_ACCOUNT_JSON_KEY: '{{ .GOOGLE_SERVICE_ACCOUNT_JSON_KEY }}' - {{- with .GOOGLE_PROJECT_ID }} - GOOGLE_PROJECT_ID: '{{ . }}' - {{- end }} - {{- end }} -{{- end }} - -{{- if eq .Values.spec.backup.stash.backend.provider "swift" }} - {{- with .Values.spec.backup.stash.backend.swift.auth }} - {{- with .OS_USERNAME }} - OS_USERNAME: '{{ . }}' - {{- end }} - {{- with .OS_PASSWORD}} - OS_PASSWORD: '{{ . }}' - {{- end }} - {{- with .OS_REGION_NAME }} - OS_REGION_NAME: '{{ . }}' - {{- end }} - {{- with .OS_AUTH_URL }} - OS_AUTH_URL: '{{ . }}' - {{- end }} - {{- with .OS_USER_DOMAIN_NAME }} - OS_USER_DOMAIN_NAME: '{{ . }}' - {{- end }} - {{- with .OS_PROJECT_NAME}} - OS_PROJECT_NAME: '{{ . }}' - {{- end }} - {{- with .OS_PROJECT_DOMAIN_NAME }} - OS_PROJECT_DOMAIN_NAME: '{{ . }}' - {{- end }} - {{- with .OS_TENANT_ID }} - OS_TENANT_ID: '{{ . }}' - {{- end }} - {{- with .OS_TENANT_NAME }} - OS_TENANT_NAME: '{{ . }}' - {{- end }} - {{- with .ST_AUTH }} - ST_AUTH: '{{ . }}' - {{- end }} - {{- with .ST_USER }} - ST_USER: '{{ . }}' - {{- end }} - {{- with .ST_KEY }} - ST_KEY: '{{ . }}' - {{- end }} - {{- with .OS_STORAGE_URL }} - OS_STORAGE_URL: '{{ . }}' - {{- end }} - {{- with .OS_AUTH_TOKEN }} - OS_AUTH_TOKEN: '{{ . }}' - {{- end }} - {{- end }} -{{- end }} - -{{- if eq .Values.spec.backup.stash.backend.provider "b2" }} - {{- with .Values.spec.backup.stash.backend.b2.auth }} - B2_ACCOUNT_ID: '{{ .B2_ACCOUNT_ID }}' - B2_ACCOUNT_KEY: '{{ .B2_ACCOUNT_KEY }}' - {{- end }} -{{- end }} -{{- end }} -{{- end }} diff --git a/charts/kubevaultcom-vaultserver-editor-options/ui/create-ui.yaml b/charts/kubevaultcom-vaultserver-editor-options/ui/create-ui.yaml index b182342e01..3e06cf0ab4 100644 --- a/charts/kubevaultcom-vaultserver-editor-options/ui/create-ui.yaml +++ b/charts/kubevaultcom-vaultserver-editor-options/ui/create-ui.yaml @@ -1,666 +1,452 @@ -steps: -- form: - elements: - - disabled: isVariantAvailable - label: - text: labels.vaultserver.name - schema: - $ref: schema#/properties/metadata/properties/release/properties/name - type: input - - add_new_button: - label: labels.add_new_namespace - target: _blank - url: - function: getCreateNameSpaceUrl - disabled: isVariantAvailable - fetch: getResources|core|v1|namespaces - label: - text: labels.namespace - refresh: true - schema: - $ref: schema#/properties/metadata/properties/release/properties/namespace - type: select - - fetch: getVaultServerVersions|catalog.kubevault.com|v1alpha1|vaultserverversions - label: - text: labels.vaultserver.version - schema: - $ref: schema#/properties/spec/properties/version - type: select - - isArray: true - keys: - label: - text: labels.labels.key - label: - text: labels.labels.label - schema: - $ref: schema#/properties/spec/properties/labels - type: key-value-input-form - values: - label: - text: labels.labels.value - schema: - $ref: schema#/properties/spec/properties/labels/additionalProperties +step: +- elements: + - disable: isVariantAvailable + label: Vault Server Name + schema: schema/properties/metadata/properties/release/properties/name + type: input + - disable: isVariantAvailable + label: Namespace + loader: getResources|core|v1|namespaces + refresh: true + schema: schema/properties/metadata/properties/release/properties/namespace + type: select + - label: Vault Server Version + loader: getVaultServerVersions|catalog.kubevault.com|v1alpha1|vaultserverversions + schema: schema/properties/spec/properties/version + type: select + - buttonClass: is-light is-outlined + label: Labels + schema: schema/properties/spec/properties/labels + type: object-item + - buttonClass: is-light is-outlined + label: Annotations + schema: schema/properties/spec/properties/annotations + type: object-item + - disable: + name: isLowAvailableStorageBackendSelected + watchPaths: + - schema/properties/spec/properties/backend/properties/provider/properties/type + label: Replica Number + schema: schema/properties/spec/properties/replicas + type: input + - label: Termination Policy + options: + - description: Keep only VaultServer Secrets and backed up data. + text: Delete + value: Delete + - description: Keep PVCs, VaultServer Secrets and backed up data. + text: Halt + value: Halt + - description: Delete everything including backed up data. + text: WipeOut + value: WipeOut + - description: Prevent deletion of the VaultServer CRD. + text: DoNotTerminate + value: DoNotTerminate + schema: schema/properties/spec/properties/terminationPolicy + isHorizontal: true + type: radio + - elements: + - elements: + - init: + type: func + value: setMachineToCustom + label: Machine + loader: getMachineListForOptions + schema: schema/properties/spec/properties/machine + type: select + watcher: + func: setResourceLimit + paths: + - schema/properties/spec/properties/machine + - disable: + name: disableLimit + watchPaths: + - schema/properties/spec/properties/machine + init: + type: func + value: setLimitsCpuOrMem|cpu + label: CPU + schema: schema/properties/spec/properties/resources/properties/limits/properties/cpu type: input - - isArray: true - keys: - label: - text: labels.annotations.key - label: - text: labels.annotations.label - schema: - $ref: schema#/properties/spec/properties/annotations - type: key-value-input-form - values: - label: - text: labels.annotations.value - schema: - $ref: schema#/properties/spec/properties/annotations/additionalProperties + - disable: + name: disableLimit + watchPaths: + - schema/properties/spec/properties/machine + init: + type: func + value: setLimitsCpuOrMem|memory + label: Memory + schema: schema/properties/spec/properties/resources/properties/limits/properties/memory type: input - - customClass: mt-10 - disabled: isLowAvailableStorageBackendSelected - label: - text: labels.replicaset.number - schema: - $ref: schema#/properties/spec/properties/replicas - type: input - - hasDescription: true - label: - text: labels.terminationPolicy - options: - - description: options.terminationPolicy.delete.description - text: options.terminationPolicy.delete.label - value: Delete - - description: options.terminationPolicy.halt.description - text: options.terminationPolicy.halt.label - value: Halt - - description: options.terminationPolicy.wipeOut.description - text: options.terminationPolicy.wipeOut.label - value: WipeOut - - description: options.terminationPolicy.doNotTerminate.description - text: options.terminationPolicy.doNotTerminate.label - value: DoNotTerminate - schema: - $ref: schema#/properties/spec/properties/terminationPolicy - type: radio - - label: - text: labels.machine_profile - type: label-element - - computed: setMachineToCustom - fetch: getMachineListForOptions - label: - text: Machine - onChange: setResourceLimit - schema: - $ref: schema#/properties/spec/properties/machine - type: select - - computed: setLimitsCpuOrMem|cpu - disabled: disableLimit - label: - text: labels.cpu - schema: - $ref: schema#/properties/spec/properties/resources/properties/limits/properties/cpu - type: input - - computed: setLimitsCpuOrMem|memory - disabled: disableLimit - label: - text: labels.memory - schema: - $ref: schema#/properties/spec/properties/resources/properties/limits/properties/memory - type: input + showLabels: true + type: horizontal-layout + label: Machine Profile + showLabels: true + type: block-layout + - elements: - elements: - - customClass: mt-10 - elements: - - label: - text: labels.backend.provider - onChange: onBackendTypeChange - options: - - azure - - consul - - dynamodb - - etcd - - gcs - - inmem - - mysql - - postgresql - - raft - - s3 - - swift - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/type - type: select - - elements: - - label: - text: labels.backend.accountName - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/azure/properties/accountName - type: input - if: isEqualToModelPathValue|azure|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/azure - type: single-step-form - - elements: - - label: - text: labels.backend.address - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul/properties/address - type: input - - label: - text: labels.backend.path - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul/properties/path - type: input - if: isEqualToModelPathValue|consul|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul - type: single-step-form - - elements: - - label: - text: labels.backend.address - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/etcd/properties/address - type: input - if: isEqualToModelPathValue|etcd|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/etcd - type: single-step-form - - elements: - - label: - text: labels.backend.bucket - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/gcs/properties/bucket - type: input - if: isEqualToModelPathValue|gcs|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/gcs - type: single-step-form - - elements: - - elements: - - label: - text: labels.backend.storageSize - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/persistence/properties/size - type: input - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/persistence - type: single-step-form - - elements: - - fetch: getStorageClassNames|/spec/backend/provider/raft/storageClass/name - label: - text: labels.backend.storageClass - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/storageClass/properties/name - type: select - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/storageClass - type: single-step-form - if: isEqualToModelPathValue|raft|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft - type: single-step-form - - elements: - - label: - text: labels.backend.bucket - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3/properties/bucket - type: input - - label: - text: labels.backend.region - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3/properties/region - type: input - if: isEqualToModelPathValue|s3|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3 - type: single-step-form - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider - type: single-step-form - - discriminator: - createCredentialSecret: - default: true - type: string - elements: - - label: - text: labels.backend.credentialSecret - onChange: onCreateCredentialSecretChange - options: - - text: options.secret.customSecret.label - value: true - - text: options.secret.existingSecret.label - value: false - schema: - $ref: discriminator#/properties/createCredentialSecret - type: radio - - allowUserDefinedOption: true - fetch: getSecrets - if: showCredentialExistingSecretField - label: - text: labels.secret - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/name - type: select - - elements: - - label: - text: labels.backend.accountKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/azure/properties/accountKey - type: input - if: showCredentialCreateSecretField|azure - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/azure - type: single-step-form + - label: Provider + options: + - azure + - consul + - dynamodb + - etcd + - gcs + - inmem + - mysql + - postgresql + - raft + - s3 + - swift + schema: schema/properties/spec/properties/backend/properties/provider/properties/type + type: select + watcher: + func: onBackendTypeChange + paths: + - schema/properties/spec/properties/backend/properties/provider/properties/type + - elements: + - label: Account Name + schema: schema/properties/spec/properties/backend/properties/provider/properties/azure/properties/accountName + type: input + if: + name: isEqualToModelPathValue|azure|/spec/backend/provider/type + type: function + type: block-layout + - elements: + - label: Address + schema: schema/properties/spec/properties/backend/properties/provider/properties/consul/properties/address + type: input + - label: Path + schema: schema/properties/spec/properties/backend/properties/provider/properties/consul/properties/path + type: input + if: + name: isEqualToModelPathValue|consul|/spec/backend/provider/type + type: function + type: block-layout + - elements: + - label: Address + schema: schema/properties/spec/properties/backend/properties/provider/properties/etcd/properties/address + type: input + if: + name: isEqualToModelPathValue|etcd|/spec/backend/provider/type + type: function + type: block-layout + - elements: + - label: Bucket + schema: schema/properties/spec/properties/backend/properties/provider/properties/gcs/properties/bucket + type: input + if: + name: isEqualToModelPathValue|gcs|/spec/backend/provider/type + type: function + type: block-layout + - elements: - elements: - - label: - text: labels.backend.aclToken - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/consul/properties/aclToken + - label: Storage Size + schema: schema/properties/spec/properties/backend/properties/provider/properties/raft/properties/persistence/properties/size type: input - if: showCredentialCreateSecretField|consul - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/consul - type: single-step-form + type: block-layout - elements: - - label: - text: labels.backend.accessKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/accessKey - type: input - - label: - text: labels.backend.secretKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/secretKey - type: input - - label: - text: labels.backend.sessionToken - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/sessionToken - type: input - if: showCredentialCreateSecretField|dynamodb - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb - type: single-step-form - - elements: - - label: - text: labels.backend.username - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd/properties/username - type: input - - label: - text: labels.backend.password - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd/properties/password - type: input - if: showCredentialCreateSecretField|etcd - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd - type: single-step-form - - elements: - - label: - text: labels.backend.saJson - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/gcs/properties/saJson - type: editor - if: showCredentialCreateSecretField|gcs - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/gcs - type: single-step-form - - elements: - - label: - text: labels.backend.username - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql/properties/username - type: input - - label: - text: labels.backend.password - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql/properties/password - type: input - if: showCredentialCreateSecretField|mysql - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql - type: single-step-form - - elements: - - label: - text: labels.backend.connectionURL - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/postgresql/properties/connectionURL - type: input - if: showCredentialCreateSecretField|postgresql - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/postgresql - type: single-step-form - - elements: - - label: - text: labels.backend.accessKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3/properties/accessKey - type: input - - label: - text: labels.backend.secretKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3/properties/secretKey - type: input - if: showCredentialCreateSecretField|s3 - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3 - type: single-step-form - - elements: - - label: - text: labels.backend.username - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/username - type: input - - label: - text: labels.backend.password - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/password - type: input - - label: - text: labels.backend.authToken - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/authToken - type: input - if: showCredentialCreateSecretField|swift - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift - type: single-step-form - if: showCredentialSecret - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret - type: single-step-form - - discriminator: - createTlsSecret: - default: true - type: string - elements: - - label: - text: labels.backend.tlsSecret - onChange: onCreateTlsSecretChange - options: - - text: options.secret.customSecret.label - value: true - - text: options.secret.existingSecret.label - value: false - schema: - $ref: discriminator#/properties/createTlsSecret - type: radio - - allowUserDefinedOption: true - fetch: getSecrets - if: showTlsExistingSecretField - label: - text: labels.secret - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/name - type: select - - elements: - - label: - text: labels.backend.tlsCaFile - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/mysql/properties/tlsCaFile - type: input - if: showTlsCreateSecretField|mysql - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/mysql - type: single-step-form - - elements: - - label: - text: labels.backend.caCert - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/caCrt - type: editor - - label: - text: labels.backend.clientCrt - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/clientCrt - type: editor - - label: - text: labels.backend.clientKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/clientKey - type: editor - if: showTlsCreateSecretField|consul - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul - type: single-step-form - if: showTlsSecret - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret - type: single-step-form - label: - text: labels.backend.title - schema: - $ref: schema#/properties/spec/properties/backend - show_label: true - type: single-step-form + - label: Storage Class + loader: getStorageClassNames|/spec/backend/provider/raft/storageClass/name + schema: schema/properties/spec/properties/backend/properties/provider/properties/raft/properties/storageClass/properties/name + type: select + type: block-layout + if: + name: isEqualToModelPathValue|raft|/spec/backend/provider/type + type: function + type: block-layout + - elements: + - label: Bucket + schema: schema/properties/spec/properties/backend/properties/provider/properties/s3/properties/bucket + type: input + - label: Region + schema: schema/properties/spec/properties/backend/properties/provider/properties/s3/properties/region + type: input + if: + name: isEqualToModelPathValue|s3|/spec/backend/provider/type + type: function + type: block-layout + type: block-layout - elements: - - customClass: mt-10 - elements: - - label: - text: labels.unsealer.mode - options: - - awsKmsSsm - - azureKeyVault - - googleKmsGcs - - kubernetesSecret - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/type - type: select - - elements: - - label: - text: labels.unsealer.kmsKeyID - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm/properties/kmsKeyID - type: input - - label: - text: labels.unsealer.region - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm/properties/region - type: input - if: isEqualToModelPathValue|awsKmsSsm|/spec/unsealer/mode/type - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm - type: single-step-form - - elements: - - label: - text: labels.unsealer.vaultBaseURL - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/azureKeyVault/properties/vaultBaseURL - type: input - if: isEqualToModelPathValue|azureKeyVault|/spec/unsealer/mode/type - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/azureKeyVault - type: single-step-form - - elements: - - label: - text: labels.unsealer.bucket - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/bucket - type: input - - label: - text: labels.unsealer.kmsCryptoKey - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsCryptoKey - type: input - - label: - text: labels.unsealer.kmsKeyRing - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsKeyRing - type: input - - label: - text: labels.unsealer.kmsLocation - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsLocation - type: input - - label: - text: labels.unsealer.kmsProject - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsProject - type: input - if: isEqualToModelPathValue|googleKmsGcs|/spec/unsealer/mode/type - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs - type: single-step-form - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode - type: single-step-form - - discriminator: - createCredentialSecret: - default: true - type: boolean - elements: - - label: - text: labels.backend.credentialSecret - onChange: onCreateUnsealerCredentialSecretChange - options: - - text: options.secret.customSecret.label - value: true - - text: options.secret.existingSecret.label - value: false - schema: - $ref: discriminator#/properties/createCredentialSecret - type: radio - - allowUserDefinedOption: true - fetch: getSecrets - if: showUnsealerCredentialExistingSecretField - label: - text: labels.secret - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/name - type: select - - elements: - - label: - text: labels.unsealer.accessKey - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm/properties/accessKey - type: input - - label: - text: labels.unsealer.secretKey - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm/properties/secretKey - type: input - if: showUnsealerCredentialCreateSecretField|awsKmsSsm - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm - type: single-step-form - - elements: - - label: - text: labels.unsealer.clientCert - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientCert - type: input - - label: - text: labels.unsealer.clientCertPassword - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientCertPassword - type: input - - label: - text: labels.unsealer.clientId - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientId - type: input - - label: - text: labels.unsealer.clientSecret - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientSecret - type: input - if: showUnsealerCredentialCreateSecretField|azureKeyVault - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault - type: single-step-form - - elements: - - label: - text: labels.unsealer.saJson - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/googleKmsGcs/properties/saJson - type: editor - if: showUnsealerCredentialCreateSecretField|googleKmsGcs - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/googleKmsGcs - type: single-step-form - if: isNotEqualToModelPathValue|kubernetesSecret|/spec/unsealer/mode/type - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret - type: single-step-form - label: - text: labels.unsealer.title - schema: - $ref: schema#/properties/spec/properties/unsealer - show_label: true - type: single-step-form - - alias: reusable-backup-option - chart: - name: uibytebuildersdev-component-backup-option - version: v0.30.0 - moduleResolver: fetchJsons - schema: - $ref: schema#/properties/spec/properties/backup - type: reusable-element - - label: - text: labels.configOptions - type: label-element - - cluster: - $ref: store#/route/params/cluster - hasDependencies: true - hasDescription: true - options: - - description: options.configOptions.backend.description - text: options.configOptions.backend.label - value: backend - - description: options.configOptions.allowedSecretEngines.description - text: options.configOptions.allowedSecretEngines.label - value: allowed-secret-engines - - description: options.configOptions.authMethods.description - text: options.configOptions.authMethods.label - value: auth-methods - - description: options.configOptions.dataSources.description - text: options.configOptions.dataSources.label - value: data-sources - - description: options.configOptions.unsealer.description - text: options.configOptions.unsealer.label - value: unsealer - - dependencies: - - group: stash.appscode.com - name: Stash - resource: backupconfigurations - url: https://stash.run/ - version: v1beta1 - description: options.configOptions.backup.description - text: options.configOptions.backup.label - value: backupconfiguration - - description: options.configOptions.healthChecker.description - text: options.configOptions.healthChecker.label - value: health-checker - - dependencies: - - group: cert-manager.io - name: Cert-Manager - resource: issuers - url: https://cert-manager.io/docs/ - version: v1 - description: options.configOptions.tls.description - text: options.configOptions.tls.label - value: tls - - description: options.configOptions.networking.description - text: options.configOptions.networking.label - value: networking - - dependencies: - - group: monitoring.coreos.com - name: Prometheus Operator - resource: servicemonitors - url: https://github.com/prometheus-operator - version: v1 - description: options.configOptions.monitoring.description - text: options.configOptions.monitoring.label - value: monitoring - - description: options.configOptions.customConfig.description - text: options.configOptions.customConfig.label - value: custom-config - - description: options.configOptions.podTemplate.description - text: options.configOptions.podTemplate.label - value: pod-template - owner: - $ref: store#/route/params/user - type: configure-options - type: single-step-form + - label: Credential Secret + options: + - text: Create New Secret + value: createNew + - text: Use Existing Secret + value: useExisting + schema: temp/createBackendCredentialSecret + type: radio + watcher: + func: onCreateCredentialSecretChange + paths: + - temp/createBackendCredentialSecret + - if: + name: showCredentialExistingSecretField + type: function + label: Secret + loader: getSecrets + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/name + type: select + - elements: + - label: Account Key + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/azure/properties/accountKey + type: input + if: + name: showCredentialCreateSecretField|azure + type: function + type: block-layout + - elements: + - label: ACL Token + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/consul/properties/aclToken + type: input + if: + name: showCredentialCreateSecretField|consul + type: function + type: block-layout + - elements: + - label: Access Key + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/accessKey + type: input + - label: Secret Key + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/secretKey + type: input + - label: Session Token + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/sessionToken + type: input + if: + name: showCredentialCreateSecretField|dynamodb + type: function + type: block-layout + - elements: + - label: Username + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/etcd/properties/username + type: input + - label: Password + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/etcd/properties/password + type: input + if: + name: showCredentialCreateSecretField|etcd + type: function + type: block-layout + - elements: + - label: sa.json + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/gcs/properties/saJson + type: editor + if: + name: showCredentialCreateSecretField|gcs + type: function + type: block-layout + - elements: + - label: Username + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/mysql/properties/username + type: input + - label: Password + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/mysql/properties/password + type: input + if: + name: showCredentialCreateSecretField|mysql + type: function + type: block-layout + - elements: + - label: Connection URL + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/postgresql/properties/connectionURL + type: input + if: + name: showCredentialCreateSecretField|postgresql + type: function + type: block-layout + - elements: + - label: Access Key + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/s3/properties/accessKey + type: input + - label: Secret Key + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/s3/properties/secretKey + type: input + if: + name: showCredentialCreateSecretField|s3 + type: function + type: block-layout + - elements: + - label: Username + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/username + type: input + - label: Password + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/password + type: input + - label: Auth Token + schema: schema/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/authToken + type: input + if: + name: showCredentialCreateSecretField|swift + type: function + type: block-layout + if: + name: showCredentialSecret + type: function + type: block-layout + - elements: + - label: TLS Secret + options: + - text: Create New Secret + value: createNew + - text: Use Existing Secret + value: useExisting + schema: temp/createTlsSecret + type: radio + watcher: + func: onCreateTlsSecretChange + paths: + - temp/createTlsSecret + - if: + name: showTlsExistingSecretField + type: function + label: Secret + loader: getSecrets + schema: schema/properties/spec/properties/backend/properties/tlsSecret/properties/name + type: select + - elements: + - label: TLS CA File + schema: schema/properties/spec/properties/backend/properties/tlsSecret/properties/mysql/properties/tlsCaFile + type: input + if: + name: showTlsCreateSecretField|mysql + type: function + type: block-layout + - elements: + - label: ca.crt + schema: schema/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/caCrt + type: editor + - label: client.crt + schema: schema/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/clientCrt + type: editor + - label: client.key + schema: schema/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/clientKey + type: editor + if: + name: showTlsCreateSecretField|consul + type: function + type: block-layout + if: + name: showTlsSecret + type: function + type: block-layout + label: Backend + showLabels: true + type: block-layout + - elements: + - elements: + - label: Unsealer Mode + options: + - awsKmsSsm + - azureKeyVault + - googleKmsGcs + - kubernetesSecret + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/type + type: select + - elements: + - label: KMS Key ID + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm/properties/kmsKeyID + type: input + - label: Region + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm/properties/region + type: input + if: + name: isEqualToModelPathValue|awsKmsSsm|/spec/unsealer/mode/type + type: function + type: block-layout + - elements: + - label: Vault Base URL + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/azureKeyVault/properties/vaultBaseURL + type: input + if: + name: isEqualToModelPathValue|azureKeyVault|/spec/unsealer/mode/type + type: function + type: block-layout + - elements: + - label: Bucket + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/bucket + type: input + - label: KMS Crypto Key + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsCryptoKey + type: input + - label: KMS Key Ring + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsKeyRing + type: input + - label: KMS Location + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsLocation + type: input + - label: KMS Project + schema: schema/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsProject + type: input + if: + name: isEqualToModelPathValue|googleKmsGcs|/spec/unsealer/mode/type + type: function + type: block-layout + type: block-layout + - elements: + - label: Credential Secret + options: + - text: Create New Secret + value: createNew + - text: Use Existing Secret + value: useExisting + schema: temp/createUnsealerCredentialSecret + type: radio + watcher: + func: onCreateUnsealerCredentialSecretChange + paths: + - temp/createUnsealerCredentialSecret + - if: + name: showUnsealerCredentialExistingSecretField + type: function + label: Secret + loader: getSecrets + schema: schema/properties/spec/properties/unsealer/properties/credentialSecret/properties/name + type: select + - elements: + - label: Access Key + schema: schema/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm/properties/accessKey + type: input + - label: Secret Key + schema: schema/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm/properties/secretKey + type: input + if: + name: showUnsealerCredentialCreateSecretField|awsKmsSsm + type: function + type: block-layout + - elements: + - label: Client Cert + schema: schema/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientCert + type: input + - label: Client Cert Password + schema: schema/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientCertPassword + type: input + - label: Client Id + schema: schema/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientId + type: input + - label: Client Secret + schema: schema/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientSecret + type: input + if: + name: showUnsealerCredentialCreateSecretField|azureKeyVault + type: function + type: block-layout + - elements: + - label: sa.json + schema: schema/properties/spec/properties/unsealer/properties/credentialSecret/properties/googleKmsGcs/properties/saJson + type: editor + if: + name: showUnsealerCredentialCreateSecretField|googleKmsGcs + type: function + type: block-layout + if: + name: isNotEqualToModelPathValue|kubernetesSecret|/spec/unsealer/mode/type + type: function + type: block-layout + label: Unsealer + showLabels: true + type: block-layout id: options - title: steps.0.label + type: single-step-form type: multi-step-form diff --git a/charts/kubevaultcom-vaultserver-editor-options/ui/functions.js b/charts/kubevaultcom-vaultserver-editor-options/ui/functions.js index a59069a372..02820b5256 100644 --- a/charts/kubevaultcom-vaultserver-editor-options/ui/functions.js +++ b/charts/kubevaultcom-vaultserver-editor-options/ui/functions.js @@ -1,186 +1,119 @@ +const { ref, computed, axios, watch, useOperator, store } = window.vueHelpers || {} + const machines = { 'db.t.micro': { resources: { - limits: { - cpu: '500m', - memory: '1Gi', - }, + limits: { cpu: '250m', memory: '512Mi' }, }, }, 'db.t.small': { resources: { - limits: { - cpu: '2', - memory: '2Gi', - }, + limits: { cpu: '500m', memory: '1Gi' }, }, }, 'db.t.medium': { resources: { - limits: { - cpu: '2', - memory: '4Gi', - }, + limits: { cpu: '1', memory: '2Gi' }, }, }, 'db.t.large': { resources: { - limits: { - cpu: '2', - memory: '8Gi', - }, + limits: { cpu: '2', memory: '4Gi' }, }, }, 'db.t.xlarge': { resources: { - limits: { - cpu: '4', - memory: '16Gi', - }, + limits: { cpu: '4', memory: '8Gi' }, }, }, 'db.t.2xlarge': { resources: { - limits: { - cpu: '8', - memory: '32Gi', - }, + limits: { cpu: '8', memory: '16Gi' }, }, }, 'db.m.small': { resources: { - limits: { - cpu: '1', - memory: '1825361100', - }, + limits: { cpu: '500m', memory: '1Gi' }, }, }, 'db.m.large': { resources: { - limits: { - cpu: '2', - memory: '8Gi', - }, + limits: { cpu: '2', memory: '8Gi' }, }, }, 'db.m.xlarge': { resources: { - limits: { - cpu: '4', - memory: '16Gi', - }, + limits: { cpu: '4', memory: '16Gi' }, }, }, 'db.m.2xlarge': { resources: { - limits: { - cpu: '8', - memory: '32Gi', - }, + limits: { cpu: '8', memory: '32Gi' }, }, }, 'db.m.4xlarge': { resources: { - limits: { - cpu: '16', - memory: '64Gi', - }, + limits: { cpu: '16', memory: '64Gi' }, }, }, 'db.m.8xlarge': { resources: { - limits: { - cpu: '32', - memory: '128Gi', - }, + limits: { cpu: '32', memory: '128Gi' }, }, }, 'db.m.12xlarge': { resources: { - limits: { - cpu: '48', - memory: '192Gi', - }, + limits: { cpu: '48', memory: '192Gi' }, }, }, 'db.m.16xlarge': { resources: { - limits: { - cpu: '64', - memory: '256Gi', - }, + limits: { cpu: '64', memory: '256Gi' }, }, }, 'db.m.24xlarge': { resources: { - limits: { - cpu: '96', - memory: '384Gi', - }, + limits: { cpu: '96', memory: '384Gi' }, }, }, 'db.r.large': { resources: { - limits: { - cpu: '2', - memory: '16Gi', - }, + limits: { cpu: '2', memory: '16Gi' }, }, }, 'db.r.xlarge': { resources: { - limits: { - cpu: '4', - memory: '32Gi', - }, + limits: { cpu: '4', memory: '32Gi' }, }, }, 'db.r.2xlarge': { resources: { - limits: { - cpu: '8', - memory: '64Gi', - }, + limits: { cpu: '8', memory: '64Gi' }, }, }, 'db.r.4xlarge': { resources: { - limits: { - cpu: '16', - memory: '192Gi', - }, + limits: { cpu: '16', memory: '128Gi' }, }, }, 'db.r.8xlarge': { resources: { - limits: { - cpu: '32', - memory: '256Gi', - }, + limits: { cpu: '32', memory: '256Gi' }, }, }, 'db.r.12xlarge': { resources: { - limits: { - cpu: '48', - memory: '384Gi', - }, + limits: { cpu: '48', memory: '384Gi' }, }, }, 'db.r.16xlarge': { resources: { - limits: { - cpu: '64', - memory: '512Gi', - }, + limits: { cpu: '64', memory: '512Gi' }, }, }, 'db.r.24xlarge': { resources: { - limits: { - cpu: '96', - memory: '768Gi', - }, + limits: { cpu: '96', memory: '768Gi' }, }, }, } @@ -212,435 +145,307 @@ const machineList = [ 'db.r.24xlarge', ] -function isEqualToModelPathValue({ model, getValue, watchDependency }, value, modelPath) { - const modelPathValue = getValue(model, modelPath) - watchDependency('model#' + modelPath) - return modelPathValue === value -} - -function isNotEqualToModelPathValue({ model, getValue, watchDependency }, value, modelPath) { - const modelPathValue = getValue(model, modelPath) - watchDependency('model#' + modelPath) - return modelPathValue !== value -} - -function isEqualToDiscriminatorPathValue( - { discriminator, getValue, watchDependency }, - value, - path, -) { - const pathValue = getValue(discriminator, path) - watchDependency('discriminator#' + modelPath) - return pathValue === value -} - -function showTlsExistingSecretField({ discriminator, getValue, watchDependency }) { - const pathValue = getValue(discriminator, '/createTlsSecret') - watchDependency('discriminator#/createTlsSecret') - return !pathValue -} - -function showTlsCreateSecretField( - { discriminator, model, getValue, watchDependency }, - backendType, -) { - watchDependency('model#/spec/backend/provider/type') - const selectedBackendType = getValue(model, '/spec/backend/provider/type') - return ( - !showTlsExistingSecretField({ discriminator, getValue, watchDependency }) && - selectedBackendType === backendType +export const useFunc = (model) => { + const { getValue, setDiscriminatorValue, commit, storeGet, discriminator } = useOperator( + model, + store.state, ) -} -function onCreateTlsSecretChange({ discriminator, commit, getValue }) { - const createTlsSecret = getValue(discriminator, '/createTlsSecret') + setDiscriminatorValue('createBackendCredentialSecret', 'createNew') + setDiscriminatorValue('createTlsSecret', 'createNew') + setDiscriminatorValue('createUnsealerCredentialSecret', 'createNew') - if (createTlsSecret) { - commit('wizard/model$delete', '/spec/backend/tlsSecret/name') - } else { - commit('wizard/model$update', { - path: '/spec/backend/tlsSecret', - value: { name: '' }, - force: true, - }) + function isVariantAvailable() { + const variant = storeGet('/route/query/variant') + return variant ? true : false } -} - -function showCredentialExistingSecretField({ discriminator, getValue, watchDependency }) { - const pathValue = getValue(discriminator, '/createCredentialSecret') - watchDependency('discriminator#/createCredentialSecret') - return !pathValue -} -function showCredentialCreateSecretField( - { discriminator, model, getValue, watchDependency }, - backendType, -) { - watchDependency('model#/spec/backend/provider/type') - const selectedBackendType = getValue(model, '/spec/backend/provider/type') - return ( - !showCredentialExistingSecretField({ - discriminator, - getValue, - watchDependency, - }) && selectedBackendType === backendType - ) -} - -function onCreateCredentialSecretChange({ discriminator, commit, getValue }) { - const createCredentialSecret = getValue(discriminator, '/createCredentialSecret') - - if (createCredentialSecret) { - commit('wizard/model$delete', '/spec/backend/credentialSecret/name') - } else { - commit('wizard/model$update', { - path: '/spec/backend/credentialSecret', - value: { name: '' }, - force: true, - }) + function isEqualToModelPathValue(value, modelPath) { + const modelPathValue = getValue(model, modelPath) + return modelPathValue === value } -} - -function showUnsealerCredentialExistingSecretField({ discriminator, getValue, watchDependency }) { - const pathValue = getValue(discriminator, '/createCredentialSecret') - watchDependency('discriminator#/createCredentialSecret') - return !pathValue -} - -function showUnsealerCredentialCreateSecretField( - { discriminator, model, getValue, watchDependency }, - unsealerMode, -) { - watchDependency('model#/spec/unsealer/mode/type') - const selectedUnsealerMode = getValue(model, '/spec/unsealer/mode/type') - return ( - !showCredentialExistingSecretField({ - discriminator, - getValue, - watchDependency, - }) && selectedUnsealerMode === unsealerMode - ) -} - -function onCreateUnsealerCredentialSecretChange({ discriminator, commit, getValue }) { - const createCredentialSecret = getValue(discriminator, '/createCredentialSecret') - if (createCredentialSecret) { - commit('wizard/model$delete', '/spec/backend/credentialSecret/name') - } else { - commit('wizard/model$update', { - path: '/spec/backend/credentialSecret', - value: { name: '' }, - force: true, - }) + function isNotEqualToModelPathValue(value, modelPath) { + const modelPathValue = getValue(model, modelPath) + return modelPathValue !== value } -} - -async function getResources({ axios, storeGet }, group, version, resource) { - const owner = storeGet('/route/params/user') - const cluster = storeGet('/route/params/cluster') - - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - { - params: { filter: { items: { metadata: { name: null } } } }, - }, - ) - const resources = (resp && resp.data && resp.data.items) || [] - - resources.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - item.text = name - item.value = name - return true - }) - return resources -} - -async function getStorageClassNames({ axios, storeGet, commit }, path) { - const owner = storeGet('/route/params/user') - const cluster = storeGet('/route/params/cluster') - - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/storage.k8s.io/v1/storageclasses`, - { - params: { - filter: { items: { metadata: { name: null, annotations: null } } }, - }, - }, - ) - - const resources = (resp && resp.data && resp.data.items) || [] + function showCredentialExistingSecretField() { + const pathValue = getValue(discriminator, '/createBackendCredentialSecret') + return pathValue === 'useExisting' + } - resources.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - const isDefault = - item.metadata && - item.metadata.annotations && - item.metadata.annotations['storageclass.kubernetes.io/is-default-class'] + function showCredentialCreateSecretField(backendType) { + const selectedBackendType = getValue(model, '/spec/backend/provider/type') + return !showCredentialExistingSecretField() && selectedBackendType === backendType + } - if (isDefault) { + function onCreateCredentialSecretChange() { + const createCredentialSecret = getValue(discriminator, '/createBackendCredentialSecret') + if (createCredentialSecret === 'createNew') { + commit('wizard/model$delete', '/spec/backend/credentialSecret/name') + } else { commit('wizard/model$update', { - path: path, - value: name, + path: '/spec/backend/credentialSecret', + value: { name: '' }, force: true, }) } - - item.text = name - item.value = name - return true - }) - return resources -} - -async function getVaultServerVersions({ axios, storeGet }, group, version, resource) { - const owner = storeGet('/route/params/user') - const cluster = storeGet('/route/params/cluster') - - const queryParams = { - filter: { - items: { - metadata: { name: null }, - spec: { version: null, deprecated: null }, - }, - }, } - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - { - params: queryParams, - }, - ) - - const resources = (resp && resp.data && resp.data.items) || [] + function showTlsExistingSecretField() { + const pathValue = getValue(discriminator, '/createTlsSecret') + return pathValue === 'useExisting' + } - // keep only non deprecated versions - const filteredRedisVersions = resources.filter((item) => item.spec && !item.spec.deprecated) + function showTlsCreateSecretField(backendType) { + const selectedBackendType = getValue(model, '/spec/backend/provider/type') + return !showTlsExistingSecretField() && selectedBackendType === backendType + } - filteredRedisVersions.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - const specVersion = (item.spec && item.spec.version) || '' - item.text = `${name} (${specVersion})` - item.value = name - return true - }) - return filteredRedisVersions -} + function onCreateTlsSecretChange() { + const createTlsSecret = getValue(discriminator, '/createTlsSecret') + if (createTlsSecret === 'createNew') { + commit('wizard/model$delete', '/spec/backend/tlsSecret/name') + } else { + commit('wizard/model$update', { + path: '/spec/backend/tlsSecret', + value: { name: '' }, + force: true, + }) + } + } -async function getSecrets({ storeGet, axios, model, getValue, watchDependency }) { - const owner = storeGet('/route/params/user') - const cluster = storeGet('/route/params/cluster') - const namespace = getValue(model, '/metadata/release/namespace') - watchDependency('model#/metadata/release/namespace') + function showUnsealerCredentialExistingSecretField() { + const pathValue = getValue(discriminator, '/createUnsealerCredentialSecret') + return pathValue === 'useExisting' + } - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/core/v1/namespaces/${namespace}/secrets`, - { - params: { - filter: { items: { metadata: { name: null }, type: null } }, - }, - }, - ) + function showUnsealerCredentialCreateSecretField(unsealerMode) { + const selectedUnsealerMode = getValue(model, '/spec/unsealer/mode/type') + return !showUnsealerCredentialExistingSecretField() && selectedUnsealerMode === unsealerMode + } - const secrets = (resp && resp.data && resp.data.items) || [] + function onCreateUnsealerCredentialSecretChange() { + const createCredentialSecret = getValue(discriminator, '/createUnsealerCredentialSecret') + if (createCredentialSecret === 'createNew') { + commit('wizard/model$delete', '/spec/unsealer/credentialSecret/name') + } else { + commit('wizard/model$update', { + path: '/spec/unsealer/credentialSecret', + value: { name: '' }, + force: true, + }) + } + } - const filteredSecrets = secrets.filter((item) => { - const validType = ['kubernetes.io/service-account-token', 'Opaque'] - return validType.includes(item.type) - }) + function showCredentialSecret() { + const type = getValue(model, '/spec/backend/provider/type') + const backendsForCredential = [ + 'azure', + 'consul', + 'dynamodb', + 'etcd', + 'gcs', + 'mysql', + 'postgresql', + 's3', + 'swift', + ] + return backendsForCredential.includes(type) + } - filteredSecrets.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - item.text = name - item.value = name - return true - }) - return filteredSecrets -} + function showTlsSecret() { + const type = getValue(model, '/spec/backend/provider/type') + const backendsForTls = ['consul', 'mysql'] + return backendsForTls.includes(type) + } -function disableLimit({ model, getValue, watchDependency }) { - const modelPathValue = getValue(model, '/spec/machine') - watchDependency('model#/spec/machine') - return modelPathValue !== 'custom' && !!modelPathValue -} + function onBackendTypeChange() { + if (isLowAvailableStorageBackendSelected()) { + commit('wizard/model$update', { path: '/spec/replicas', value: 1, force: true }) + } else { + commit('wizard/model$update', { path: '/spec/replicas', value: 3, force: true }) + } + } -function getMachineListForOptions() { - const array = machineList.map((item) => { - return { text: item, value: item } - }) - return array -} + function isLowAvailableStorageBackendSelected() { + const backendType = getValue(model, '/spec/backend/provider/type') + const lowAvailableStorageBackends = ['azure', 'inmem', 's3', 'swift'] + return lowAvailableStorageBackends.includes(backendType) + } -function setResourceLimit({ commit, model, getValue, watchDependency }) { - const modelPathValue = getValue(model, '/spec/machine') - watchDependency('model#/spec/machine') - if (modelPathValue && modelPathValue !== 'custom') { - // to avoiding set value by reference, cpu and memory set separately - commit('wizard/model$update', { - path: '/spec/resources/limits/cpu', - value: machines[modelPathValue].resources.limits.cpu, - force: true, - }) - commit('wizard/model$update', { - path: '/spec/resources/limits/memory', - value: machines[modelPathValue].resources.limits.memory, - force: true, + async function getResources(group, version, resource) { + const owner = storeGet('/route/params/user') + const cluster = storeGet('/route/params/cluster') + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + { params: { filter: { items: { metadata: { name: null } } } } }, + ) + const resources = (resp && resp.data && resp.data.items) || [] + resources.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + item.text = name + item.value = name + return true }) + return resources } -} -function setLimitsCpuOrMem({ model, getValue }, path) { - const modelPathValue = getValue(model, '/spec/machine') - if (modelPathValue && modelPathValue !== 'custom') { - return ( - machines[modelPathValue] && - machines[modelPathValue].resources && - machines[modelPathValue].resources.limits[path] + async function getStorageClassNames(path) { + const owner = storeGet('/route/params/user') + const cluster = storeGet('/route/params/cluster') + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/storage.k8s.io/v1/storageclasses`, + { params: { filter: { items: { metadata: { name: null, annotations: null } } } } }, ) - } else { - if (path === 'cpu') { - return '.5' - } else if (path === 'memory') { - return '1024Mi' - } + const resources = (resp && resp.data && resp.data.items) || [] + resources.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + const isDefault = + item.metadata && + item.metadata.annotations && + item.metadata.annotations['storageclass.kubernetes.io/is-default-class'] + if (isDefault) { + commit('wizard/model$update', { path: path, value: name, force: true }) + } + item.text = name + item.value = name + return true + }) + return resources } -} - -function setMachineToCustom() { - return 'custom' -} - -function showCredentialSecret({ model, getValue, watchDependency }) { - watchDependency('model#/spec/backend/provider/type') - const type = getValue(model, '/spec/backend/provider/type') - - const backendsForCredential = [ - 'azure', - 'consul', - 'dynamodb', - 'etcd', - 'gcs', - 'mysql', - 'postgresql', - 's3', - 'swift', - ] - return backendsForCredential.includes(type) -} - -function showTlsSecret({ model, getValue, watchDependency }) { - watchDependency('model#/spec/backend/provider/type') - const type = getValue(model, '/spec/backend/provider/type') - - const backendsForTls = ['consul', 'mysql'] - - return backendsForTls.includes(type) -} + async function getVaultServerVersions(group, version, resource) { + const owner = storeGet('/route/params/user') + const cluster = storeGet('/route/params/cluster') + const queryParams = { + filter: { + items: { metadata: { name: null }, spec: { version: null, deprecated: null } }, + }, + } + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + { params: queryParams }, + ) + const resources = (resp && resp.data && resp.data.items) || [] + const filteredVersions = resources.filter((item) => item.spec && !item.spec.deprecated) + filteredVersions.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + const specVersion = (item.spec && item.spec.version) || '' + item.text = `${name} (${specVersion})` + item.value = name + return true + }) + return filteredVersions + } -function onBackendTypeChange({ model, getValue, commit, watchDependency }) { - if (isLowAvailableStorageBackendSelected({ model, getValue, watchDependency })) { - commit('wizard/model$update', { - path: '/spec/replicas', - value: 1, - force: true, + async function getSecrets() { + const owner = storeGet('/route/params/user') + const cluster = storeGet('/route/params/cluster') + const namespace = getValue(model, '/metadata/release/namespace') + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/core/v1/namespaces/${namespace}/secrets`, + { params: { filter: { items: { metadata: { name: null }, type: null } } } }, + ) + const secrets = (resp && resp.data && resp.data.items) || [] + const filteredSecrets = secrets.filter((item) => { + const validType = ['kubernetes.io/service-account-token', 'Opaque'] + return validType.includes(item.type) }) - } else { - commit('wizard/model$update', { - path: '/spec/replicas', - value: 3, - force: true, + filteredSecrets.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + item.text = name + item.value = name + return true }) + return filteredSecrets } -} - -function isLowAvailableStorageBackendSelected({ model, getValue, watchDependency }) { - watchDependency('model#/spec/backend/provider/type') - const backendType = getValue(model, '/spec/backend/provider/type') - - const lowAvailableStorageBackends = ['azure', 'inmem', 's3', 'swift'] - return lowAvailableStorageBackends.includes(backendType) -} + function disableLimit() { + const modelPathValue = getValue(model, '/spec/machine') + return modelPathValue !== 'custom' && !!modelPathValue + } -function getCreateNameSpaceUrl({ model, getValue, storeGet }) { - const user = storeGet('/route/params/user') - const cluster = storeGet('/route/params/cluster') + function getMachineListForOptions() { + const array = machineList.map((item) => { + return { text: item, value: item } + }) + return array + } - const domain = storeGet('/domain') || '' - if (domain.includes('bb.test')) { - return `http://console.bb.test:5990/${user}/kubernetes/${cluster}/core/v1/namespaces/create` - } else { - const editedDomain = domain.replace('kubedb', 'console') - return `${editedDomain}/${user}/kubernetes/${cluster}/core/v1/namespaces/create` + function setResourceLimit() { + const modelPathValue = getValue(model, '/spec/machine') + if (modelPathValue && modelPathValue !== 'custom') { + commit('wizard/model$update', { + path: '/spec/resources/limits/cpu', + value: machines[modelPathValue].resources.limits.cpu, + force: true, + }) + commit('wizard/model$update', { + path: '/spec/resources/limits/memory', + value: machines[modelPathValue].resources.limits.memory, + force: true, + }) + } } -} -function isVariantAvailable({ storeGet }) { - const variant = storeGet('/route/query/variant') - return variant ? true : false -} + function setLimitsCpuOrMem(path) { + const modelPathValue = getValue(model, '/spec/machine') + if (modelPathValue && modelPathValue !== 'custom') { + return ( + machines[modelPathValue] && + machines[modelPathValue].resources && + machines[modelPathValue].resources.limits[path] + ) + } else { + if (path === 'cpu') return '.5' + else if (path === 'memory') return '1024Mi' + } + } -async function fetchJsons({ axios, itemCtx }) { - let ui = {} - let language = {} - let functions = {} - const { name, sourceRef, version, packageviewUrlPrefix } = itemCtx.chart + function setMachineToCustom() { + return 'custom' + } - try { - ui = await axios.get( - `${packageviewUrlPrefix}/create-ui.yaml?name=${name}&sourceApiGroup=${sourceRef.apiGroup}&sourceKind=${sourceRef.kind}&sourceNamespace=${sourceRef.namespace}&sourceName=${sourceRef.name}&version=${version}&format=json`, - ) - language = await axios.get( - `${packageviewUrlPrefix}/language.yaml?name=${name}&sourceApiGroup=${sourceRef.apiGroup}&sourceKind=${sourceRef.kind}&sourceNamespace=${sourceRef.namespace}&sourceName=${sourceRef.name}&version=${version}&format=json`, - ) - const functionString = await axios.get( - `${packageviewUrlPrefix}/functions.js?name=${name}&sourceApiGroup=${sourceRef.apiGroup}&sourceKind=${sourceRef.kind}&sourceNamespace=${sourceRef.namespace}&sourceName=${sourceRef.name}&version=${version}`, - ) - // declare evaluate the functionString to get the functions Object - const evalFunc = new Function(functionString.data || '') - functions = evalFunc() - } catch (e) { - console.log(e) + function getCreateNameSpaceUrl() { + const user = storeGet('/route/params/user') + const cluster = storeGet('/route/params/cluster') + const domain = storeGet('/domain') || '' + if (domain.includes('bb.test')) { + return `http://console.bb.test:5990/${user}/kubernetes/${cluster}/core/v1/namespaces/create` + } else { + const editedDomain = domain.replace('kubedb', 'console') + return `${editedDomain}/${user}/kubernetes/${cluster}/core/v1/namespaces/create` + } } return { - ui: ui.data || {}, - language: language.data || {}, - functions, + isVariantAvailable, + isEqualToModelPathValue, + isNotEqualToModelPathValue, + showCredentialExistingSecretField, + showCredentialCreateSecretField, + onCreateCredentialSecretChange, + showTlsExistingSecretField, + showTlsCreateSecretField, + onCreateTlsSecretChange, + showUnsealerCredentialExistingSecretField, + showUnsealerCredentialCreateSecretField, + onCreateUnsealerCredentialSecretChange, + showCredentialSecret, + showTlsSecret, + onBackendTypeChange, + isLowAvailableStorageBackendSelected, + getResources, + getStorageClassNames, + getVaultServerVersions, + getSecrets, + disableLimit, + getMachineListForOptions, + setResourceLimit, + setLimitsCpuOrMem, + setMachineToCustom, + getCreateNameSpaceUrl, } } - -return { - isVariantAvailable, - isEqualToModelPathValue, - isNotEqualToModelPathValue, - getResources, - getStorageClassNames, - getVaultServerVersions, - getSecrets, - disableLimit, - getMachineListForOptions, - setResourceLimit, - setLimitsCpuOrMem, - setMachineToCustom, - isEqualToDiscriminatorPathValue, - showTlsCreateSecretField, - showTlsExistingSecretField, - onCreateTlsSecretChange, - showCredentialCreateSecretField, - showCredentialExistingSecretField, - onCreateCredentialSecretChange, - showUnsealerCredentialCreateSecretField, - showUnsealerCredentialExistingSecretField, - onCreateUnsealerCredentialSecretChange, - showCredentialSecret, - showTlsSecret, - onBackendTypeChange, - isLowAvailableStorageBackendSelected, - getCreateNameSpaceUrl, - fetchJsons, -} diff --git a/charts/kubevaultcom-vaultserver-editor-options/values.yaml b/charts/kubevaultcom-vaultserver-editor-options/values.yaml index 85452ed7ee..805a4a6383 100644 --- a/charts/kubevaultcom-vaultserver-editor-options/values.yaml +++ b/charts/kubevaultcom-vaultserver-editor-options/values.yaml @@ -150,7 +150,7 @@ spec: default: "" backup: - tool: Stash + tool: KubeStash kubestash: schedule: "0 */2 * * *"