Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dremio coder user #127

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 3 additions & 3 deletions charts/digitalhub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
36 changes: 21 additions & 15 deletions charts/digitalhub/confs/coder/dremio-main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions charts/digitalhub/confs/dashboard/env.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions charts/digitalhub/confs/dremio/add_source_with_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"'"
}'
2 changes: 1 addition & 1 deletion charts/digitalhub/templates/dashboard/oidcconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down