diff --git a/charts/digitalhub/Chart.yaml b/charts/digitalhub/Chart.yaml index 5789cfd0..2f1e21e8 100644 --- a/charts/digitalhub/Chart.yaml +++ b/charts/digitalhub/Chart.yaml @@ -7,7 +7,7 @@ maintainers: url: https://github.com/ffais - name: calcagiara url: https://github.com/Calcagiara -version: "0.8.0-beta1" +version: "0.8.0-beta2" appVersion: "0.8.0" dependencies: - name: apigw-operator @@ -19,11 +19,11 @@ dependencies: repository: https://helm.coder.com/v2 condition: coder.enabled - name: core - version: "0.2.14" + version: "0.2.16" repository: https://scc-digitalhub.github.io/digitalhub/ condition: core.enabled - name: kubernetes-resource-manager - version: "0.2.3" + version: "0.2.4" repository: https://scc-digitalhub.github.io/digitalhub/ condition: kubernetes-resource-manager.enabled - name: dremio-rest-server-operator diff --git a/charts/digitalhub/confs/coder/dremio-main.tf b/charts/digitalhub/confs/coder/dremio-main.tf index 79c434a2..42faa056 100644 --- a/charts/digitalhub/confs/coder/dremio-main.tf +++ b/charts/digitalhub/confs/coder/dremio-main.tf @@ -105,19 +105,6 @@ variable "minio_digitalhub_user_secret" { type = string } -data "coder_parameter" "admin_password" { - name = "admin_password" - display_name = "Dremio Admin Password" - description = "Choose a password for Dremio admin account must be at least 8 letters long, must contain at least one number and one letter" - type = "string" - icon = "/emojis/1f510.png" - mutable = false - # validation { - # regex = "[a-zA-Z][0-9][a-zA-Z0-9]{6,}|[a-zA-Z]{2}[0-9][a-zA-Z0-9]{5,}|[a-zA-Z]{3}[0-9][a-zA-Z0-9]{4,}|[a-zA-Z]{5}[0-9][a-zA-Z0-9]{3,}|[a-zA-Z]{6}[0-9][a-zA-Z0-9]{2,}|[a-zA-Z]{7,}[0-9][a-zA-Z0-9]*|[0-9][a-zA-Z][a-zA-Z0-9]{6,}|[0-9]{2}[a-zA-Z][a-zA-Z0-9]{5,}|[0-9]{3}[a-zA-Z][a-zA-Z0-9]{4,}|[0-9]{5}[a-zA-Z][a-zA-Z0-9]{3,}|[0-9]{6}[a-zA-Z][a-zA-Z0-9]{2,}|[0-9]{7,}[a-zA-Z][a-zA-Z0-9]*" - # error = "Invalid password: must be at least 8 letters long, must contain at least one number and one letter" - # } -} - provider "kubernetes" { # Authenticate via ~/.kube/config or a Coder-specific ServiceAccount, depending on admin preferences config_path = var.use_kubeconfig == true ? "~/.kube/config" : null @@ -127,6 +114,12 @@ data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} +resource "random_password" "password" { + length = 16 + special = true + override_special = "!%&*()-_=+:?" +} + resource "coder_agent" "dremio" { os = "linux" arch = "amd64" @@ -199,6 +192,11 @@ resource "coder_metadata" "dremio" { key = "URL" value = local.dremio_url } + item { + key = "Password" + value = random_password.password.result + sensitive = true + } } resource "kubernetes_persistent_volume_claim" "dremio-data" { @@ -319,7 +317,7 @@ resource "kubernetes_job" "source-init" { command = ["/bin/sh", "/init-files/add_source_with_api.sh"] env { name = "ADMIN_PASSWORD" - value = data.coder_parameter.admin_password.value + value = random_password.password.result } env { name = "DREMIO_URL" @@ -377,6 +375,14 @@ resource "kubernetes_job" "source-init" { } } } + env { + name = "DREMIO_CODER_USERNAME" + value = data.coder_workspace_owner.me.name + } + env { + name = "DREMIO_CODER_EMAIL" + value = data.coder_workspace_owner.me.email + } volume_mount { name = "init-files" mount_path = "/init-files" @@ -459,7 +465,7 @@ resource "kubernetes_deployment" "dremio" { command = ["/bin/bash", "/tmp/init/init-data.sh"] env { name = "ADMIN_PASSWORD" - value = data.coder_parameter.admin_password.value + value = random_password.password.result } volume_mount { mount_path = "/opt/dremio/data" diff --git a/charts/digitalhub/confs/dashboard/env.js b/charts/digitalhub/confs/dashboard/env.js index 42a334cf..c19b7455 100644 --- a/charts/digitalhub/confs/dashboard/env.js +++ b/charts/digitalhub/confs/dashboard/env.js @@ -1,5 +1,5 @@ {{ if .Values.dashboard.oidc.enabled -}} -window.env = {"VITE_OIDC_CONFIG":JSON.stringify({"accessTokenExpiringNotificationTime": "3570", "authority": "{{ .Values.dashboard.oidc.config.issuer }}", "clientId": "{{ .Values.dashboard.oidc.audience.clientId }}", "redirectUri": "http://{{ include "digitalhub.oidcDashboardEndpoint" . }}/oidc-callback", "responseType": "code", "scope": "openid profile email", "automaticSilentRenew": "false", "automaticSilentSignin": "false", "post_logout_redirect_uri": "http://{{ include "digitalhub.oidcDashboardEndpoint" . }}"}), "VITE_PLATFORM_TITLE": "OltreAI", "VITE_PLATFORM_VERSION": "0.7"} +window.env = {"VITE_OIDC_CONFIG":JSON.stringify({"accessTokenExpiringNotificationTime": "3570", "authority": "{{ .Values.dashboard.oidc.config.issuer }}", "clientId": "{{ .Values.dashboard.oidc.audience.clientId }}", "redirectUri": "http://{{ include "digitalhub.oidcDashboardEndpoint" . }}/oidc-callback", "responseType": "code", "scope": "openid profile email", "automaticSilentRenew": "false", "automaticSilentSignin": "false", "post_logout_redirect_uri": "http://{{ include "digitalhub.oidcDashboardEndpoint" . }}"}), "VITE_PLATFORM_TITLE": "OltreAI", "VITE_PLATFORM_VERSION": "0.8"} {{- else -}} -window.env = {"VITE_OIDC_CONFIG": null, "VITE_PLATFORM_TITLE": "OltreAI", "VITE_PLATFORM_VERSION": "0.7"} +window.env = {"VITE_OIDC_CONFIG": null, "VITE_PLATFORM_TITLE": "OltreAI", "VITE_PLATFORM_VERSION": "0.8"} {{- end }} diff --git a/charts/digitalhub/confs/dremio/add_source_with_api.sh b/charts/digitalhub/confs/dremio/add_source_with_api.sh index f22f7690..74568cdc 100644 --- a/charts/digitalhub/confs/dremio/add_source_with_api.sh +++ b/charts/digitalhub/confs/dremio/add_source_with_api.sh @@ -12,3 +12,14 @@ curl -v -s -X POST "http://${DREMIO_URL}:9047/api/v3/catalog" \ --header "Authorization: _dremio${TOKEN}" \ --header 'Content-Type: application/json' \ --data-raw "{\"entityType\":\"source\",\"config\":{\"credentialType\":\"ACCESS_KEY\",\"accessKey\":\"$MINIO_USERNAME\",\"accessSecret\":\"$MINIO_PASSWORD\",\"secure\":false,\"externalBucketList\":[],\"enableAsync\":true,\"compatibilityMode\":true,\"enableFileStatusCheck\":true,\"rootPath\":\"/\",\"defaultCtasFormat\":\"PARQUET\",\"propertyList\":[{\"name\":\"fs.s3a.endpoint\",\"value\":\"$MINIO_ENDPOINT\"},{\"name\":\"fs.s3a.path.style.access\",\"value\":\"true\"}],\"whitelistedBuckets\":[\"$MINIO_BUCKET\"],\"isCachingEnabled\":true,\"maxCacheSpacePct\":100},\"type\":\"S3\",\"name\":\"minio\",\"metadataPolicy\":{\"authTTLMs\":86400000,\"namesRefreshMs\":3600000,\"datasetRefreshAfterMs\":3600000,\"datasetExpireAfterMs\":10800000,\"datasetUpdateMode\":\"PREFETCH_QUERIED\",\"deleteUnavailableDatasets\":true,\"autoPromoteDatasets\":false},\"accelerationGracePeriodMs\":10800000,\"accelerationRefreshPeriodMs\":3600000,\"accelerationNeverExpire\":false,\"accelerationNeverRefresh\":false,\"allowCrossSourceSelection\":false,\"disableMetadataValidityCheck\":false,\"accessControlList\":{\"userControls\":[],\"roleControls\":[]}}" + +echo "create new admin" +DREMIO_API_URL="http://${DREMIO_URL}:9047/api/v3/user" +curl -v -s -X POST "$DREMIO_API_URL" -H "Authorization: _dremio${TOKEN}" -H "Content-Type: application/json" \ + -d '{ + "name": "'"$DREMIO_CODER_USERNAME"'", + "password": "'"$ADMIN_PASSWORD"'", + "firstName": "digitalhub", + "lastName": "digitalhub", + "email": "'"$DREMIO_CODER_EMAIL"'" + }' diff --git a/charts/digitalhub/templates/dashboard/oidcconfig.yaml b/charts/digitalhub/templates/dashboard/oidcconfig.yaml index cd9c87b2..a1cccb24 100644 --- a/charts/digitalhub/templates/dashboard/oidcconfig.yaml +++ b/charts/digitalhub/templates/dashboard/oidcconfig.yaml @@ -21,7 +21,7 @@ spec: name: dashboard-oidc-secret stringData: env.js: |- - window.env = {"VITE_OIDC_CONFIG":JSON.stringify({"accessTokenExpiringNotificationTime": "3570", "authority": "{{ .Values.dashboard.oidc.config.issuer }}", "clientId": "{{ "{{" }} matrix.aacdashboardsecret.data.clientid | b64decode {{ "}}" }}", "redirectUri": "https://{{ include "digitalhub.oidcDashboardEndpoint" . }}/oidc-callback", "responseType": "code", "scope": "openid profile email", "automaticSilentRenew": "false", "automaticSilentSignin": "false", "post_logout_redirect_uri": "https://{{ include "digitalhub.oidcDashboardEndpoint" . }}"}), "VITE_PLATFORM_TITLE": "OltreAI", "VITE_PLATFORM_VERSION": "0.7"} + window.env = {"VITE_OIDC_CONFIG":JSON.stringify({"accessTokenExpiringNotificationTime": "3570", "authority": "{{ .Values.dashboard.oidc.config.issuer }}", "clientId": "{{ "{{" }} matrix.aacdashboardsecret.data.clientid | b64decode {{ "}}" }}", "redirectUri": "https://{{ include "digitalhub.oidcDashboardEndpoint" . }}/oidc-callback", "responseType": "code", "scope": "openid profile email", "automaticSilentRenew": "false", "automaticSilentSignin": "false", "post_logout_redirect_uri": "https://{{ include "digitalhub.oidcDashboardEndpoint" . }}"}), "VITE_PLATFORM_TITLE": "OltreAI", "VITE_PLATFORM_VERSION": "0.8"} {{- else -}} {{- $v := tpl (.Files.Get "confs/dashboard/env.js") . }} apiVersion: v1