From 47d5fb59dcd39ad8fa07a7c049a6b8e2cf14e9b6 Mon Sep 17 00:00:00 2001 From: wbsong111 Date: Fri, 20 Dec 2024 18:23:08 +0900 Subject: [PATCH] Add custom-values.yaml, CUSTOM-README.md --- charts/superset/CUSTOM-README.md | 259 +++++++++++++++++++++++++++++ charts/superset/custom-values.yaml | 150 +++++++++++++++++ 2 files changed, 409 insertions(+) create mode 100644 charts/superset/CUSTOM-README.md create mode 100644 charts/superset/custom-values.yaml diff --git a/charts/superset/CUSTOM-README.md b/charts/superset/CUSTOM-README.md new file mode 100644 index 0000000..53e21e0 --- /dev/null +++ b/charts/superset/CUSTOM-README.md @@ -0,0 +1,259 @@ + +# Superset 배포 + +## 1. 배포 방법 +- 명령어 + ``` sh + $ helm upgrade superset ../superset --install \ + -n superset --create-namespace \ + -f ./custom-values.yaml + ``` + + + +## 2. custom-values.yaml 설명 + +- custom-values.yaml에 정의된 값에 대한 설명이다. + +### 1) 이미지 설정 +- private 환경 배포시 사용한다. +- 해당 이미지 설정은 superset 서버, Celery worker, beat, flower에서 사용된다. + +| Name | 설명 | 기본값 | +| ---------------------- | ------------------------------------------------------------ | ------ | +| `image.repository` | 오프라인 설치 시에 설정 변경 필요.
paasup 설치시에는 "paasup.io/apache/superset"로 설정 | `"apachesuperset.docker.scarf.sh/apache/superset"` | +| `image.tag` | 이미지의 태그 설정. 기본값은 차트의 앱 버전으로 설정된다. | `""` | + + + +### 2) pod 공통 설정 +- pod의 수, tolerations, nodeSelector 리소스 등을 설정한다. + +| Name | 설명 | 기본값 | +| ------------------------ | ---------------------------------- | --------- | +| `tolerations` | Superset 차트에서 배포되는 pod의 공통 toleration 설정. | `[]` | +| `nodeSelector` | Superset 차트에서 배포되는 pod의 공통 nodeSelector 설정. | `{}` | +| `resources` | Superset 차트에서 배포되는 pod의 기본 resource 설정.
개별 컴포넌트에 설정이 되어 있지 않을 때 사용. | `{}` | + + + +### 3) Suerset 설정 + +- 아래 설정에서 Superset의 설정을 추가할 수 있다. +- SSO를 위히서는 아래 설정에 추가 + +#### 3.1) 배포를 위한 최소 설정 + +- Superset 배포 및 실행을 위해서는 다음 설정이 필요하다. + +``` yaml +configOverrides: + ## Superset 실행을 위해서는 SECRET_KEY를 설정해야 한다. + secret: | + SECRET_KEY = '{openssl rand -base64 42 실행 값}' + +# 접속할 DB에 대한 드라이버를 별도 설치해야함. +## 4.1.0 이상 버전부터 필요한 패키지를 추가하여 설치하거나 이미지 빌드가 필요하다. +bootstrapScript: | + #!/bin/bash + pip install sqlalchemy-drill psycopg2-binary +``` + +#### 3.2) Keycloak SSO 설정 + +- Keycloak SSO 설정을 위해서는 `configOverrides.enable_oauth` 설정을 추가해야 한다. + 또한 `bootstrapScript`에서 python의 `Authlib` 패키지 설치도 필요하다. + +``` yaml +configOverrides: + # Generate your own secret key for encryption. Use `openssl rand -base64 42` to generate a good key + secret: | + SECRET_KEY = '{openssl rand -base64 42 실행 값}' + enable_oauth: | + from flask_appbuilder.security.manager import (AUTH_DB, AUTH_OAUTH) + AUTH_TYPE = AUTH_OAUTH + OAUTH_PROVIDERS = [ + { + "name": "keycloak", + "icon": "fa-key", + "token_key": "access_token", + "remote_app": { + "client_id": "superset", + "client_secret": "{keycloak client secret}", + "client_kwargs": { + "scope": "openid email profile", + 'verify': False + }, + 'server_metadata_url': 'https://keycloak.example.org/auth/realms/paasxpert/.well-known/openid-configuration', + 'api_base_url': 'https://keycloak.example.org/auth/realms/paasxpert/protocol/' + } + } + ] + # Map Authlib roles to superset roles + AUTH_ROLE_ADMIN = 'Admin' + AUTH_ROLE_PUBLIC = 'Public' + # Will allow user self registration, allowing to create Flask users from Authorized User + AUTH_USER_REGISTRATION = True + # The default user self registration role + AUTH_USER_REGISTRATION_ROLE = "Gamma" + + +# 접속할 DB에 대한 드라이버를 별도 설치해야함. +bootstrapScript: | + #!/bin/bash + pip install sqlalchemy-drill psycopg2-binary Authlib +``` + + + +### 4) 컴포넌트 설정 + +#### 4.1) Suerset 서버 + +- Superset의 서버에 대한 설정이다. + +| Name | 설명 | 기본값 | +| ------------------------------------ | ------------------------------------------------------------ | ------------------------- | +| `supersetNode.replicas.replicaCount` | Superset 서버의 pod 수를 설정. | `1` | +| `supersetNode.connections` | Superset 서버에서 사용할 DB 및 Redis 연결에 대한 설정.
subchart의 postgresql과 redis에 설정한 값으로 설정. | `custom-values.yaml` 참고 | +| `supersetNoderesources` | Superset 서버의 resource 설정. | `{}` | + +#### 4.2) Suerset worker + +- Superset Worker는 비동기 쿼리 작업을 처리한다. +- 스케쥴링 작업 실행이 필요할 때 Superset Beat를 배포해야 한다. + +| Name | 설명 | 기본값 | +| -------------------------------------- | --------------------------------- | ------ | +| `supersetWorker.replicas.replicaCount` | Superset Worker의 pod 수를 설정. | `1` | +| `supersetWorker.resources` | Superset Worker의 resource 설정. | `{}` | + + +#### 4.3) Celery Beat + +- Worker의 작업 스케줄러 역할을 하는 Celerry Beat에 대한 설정으로 기본은 `false`로 배포되지 않는다. + +| Name | 설명 | 기본값 | +| ------------------------------ | ----------------------------- | ------- | +| `supersetCeleryBeat.enabled` | Celery Beat에 대함 배포 여부. | `false` | +| `supersetCeleryBeat.resources` | Celery Beat의 resource 설정. | `{}` | + + +#### 4.4) Celery Flower + +- Celery Worker의 작업에 대한 모니터링 대시보드로 기본은 `false`로 배포되지 않는다. + +| Name | 설명 | 기본값 | +| ----------------------------------- | ------------------------------ | ------- | +| `supersetCeleryFlower.enable` | Celery Flower의 배포 여부. | `false` | +| `supersetCeleryFlower.replicaCount` | Celery Flower의 pod 수를 설정. | `{}` | +| `supersetCeleryFlower.resource` | Celery Flower의 resource 설정. | `{}` | + +### 5) Ingress 설정 + +#### 5.1) tls 시크릿 직접 생성 + + +- Rancher에서 ingress 사용을 위해서는 다음과 같이 설정할 수 있다. + ``` yaml + ingress: + enabled: true + path: / + pathType: ImplementationSpecific + hosts: + - superset.example.org + tls: + - hosts: + - superset.example.org + secretName: superset-tls-secret + ``` + +- ingress 사용을 위해서는 인증서를 secret으로 제공해야한다. 로컬 파일을 이용해 secret을 생성하는 방법은 다음과 같다. + ``` sh + kubectl create secret tls superset-tls-secret --cert= --key= -n + ``` + + +#### 5.2) cert-manager를 이용한 자동 생성 + +- cert manager를 통해 인증서 자동 생성 시 `custom-values.yaml` 수정한다. +- `ingress.annotations.cert-manager.io/cluster-issuer`에 미리 배포된 Cluster Issuer의 이름으로 변경한다. + ``` yaml + ingress: + enabled: true + annotations: + cert-manager.io/cluster-issuer: "selfsigned-issuer" + cert-manager.io/duration: 8760h + cert-manager.io/renew-before: 720h + path: / + pathType: ImplementationSpecific + hosts: + - superset.example.org + tls: + - hosts: + - superset.example.org + secretName: superset-tls-secret + ``` + +### 6) postgresql + +- subchart로 포함된 postgresql을 배포하기 위한 설정이다. + +``` yaml +postgresql: + enabled: true + auth: + # DB의 계정 및 기본 생성되는 database를 설정한다. + username: superset + password: superset + database: superset + image: + # private 환경에서 배포할 때 사용할 registry로 설정을 변경한다. + registry: docker.io + primary: + # DB의 리소스를 설정한다. + resources: + limits: {} + requests: + memory: 256Mi + cpu: 250m + # DB에서 사용할 Disk 설정으로 StorageClass와 사이즈를 설정한다. + persistence: + enabled: true + storageClass: "" + accessModes: + - ReadWriteOnce + size: 8Gi +``` + + + +### 7) redis + +subchart로 포함된 reids을 배포하기 위한 설정이다. + +``` yaml +redis: + enabled: true + # HA 설정을 위해서는 'replication'으로 변경이 필요하다. + architecture: standalone + # redis에서 인증애 대한 설정이다. + auth: + ## 사용을 원할 시 enabled를 true로 변경한다. + enabled: false + password: superset + image: + # private 환경에서 배포할 때 사용할 registry로 설정을 변경한다. + registry: docker.io + master: + # redis의 리소스를 설정한다. + resources: + limits: {} + requests: {} + # redis에서사용할 Disk 설정으로 StorageClass와 사이즈를 설정한다. + persistence: + enabled: true + storageClass: "" + size: 8Gi +``` + diff --git a/charts/superset/custom-values.yaml b/charts/superset/custom-values.yaml new file mode 100644 index 0000000..2f2e44e --- /dev/null +++ b/charts/superset/custom-values.yaml @@ -0,0 +1,150 @@ + +configOverrides: + # Generate your own secret key for encryption. Use `openssl rand -base64 42` to generate a good key + secret: | + SECRET_KEY = '{openssl rand -base64 42 실행 값}' + enable_oauth: | + from flask_appbuilder.security.manager import (AUTH_DB, AUTH_OAUTH) + AUTH_TYPE = AUTH_OAUTH + OAUTH_PROVIDERS = [ + { + "name": "keycloak", + "icon": "fa-key", + "token_key": "access_token", + "remote_app": { + "client_id": "superset", + "client_secret": "{keycloak client secret}", + "client_kwargs": { + "scope": "openid email profile", + 'verify': False + }, + 'server_metadata_url': 'https://keycloak.example.org/auth/realms/paasxpert/.well-known/openid-configuration', + 'api_base_url': 'https://keycloak.example.org/auth/realms/paasxpert/protocol/' + } + } + ] + # Map Authlib roles to superset roles + AUTH_ROLE_ADMIN = 'Admin' + AUTH_ROLE_PUBLIC = 'Public' + # Will allow user self registration, allowing to create Flask users from Authorized User + AUTH_USER_REGISTRATION = True + # The default user self registration role + AUTH_USER_REGISTRATION_ROLE = "Gamma" + + +# 접속할 DB에 대한 드라이버를 별도 설치해야함. +bootstrapScript: | + #!/bin/bash + pip install sqlalchemy-drill psycopg2-binary Authlib + +# superset 공통 사용 이미지 +# 워커, 플라워, +image: + repository: apachesuperset.docker.scarf.sh/apache/superset + tag: ~ + pullPolicy: IfNotPresent +resources: {} +nodeSelector: {} +tolerations: [] + + +ingress: + enabled: true + annotations: + cert-manager.io/cluster-issuer: "selfsigned-issuer" + cert-manager.io/duration: 8760h + cert-manager.io/renew-before: 720h + path: / + pathType: ImplementationSpecific + hosts: + - superset.example.org + tls: + - hosts: + - superset.example.org + secretName: superset-tls-secret + + + +# Superset node configuration +supersetNode: + replicas: + enabled: true + replicaCount: 1 + + connections: + # -- Change in case of bringing your own redis and then also set redis.enabled:false + redis_host: '{{ .Release.Name }}-redis-headless' + redis_port: "6379" + redis_user: "" + # redis_password: superset + redis_cache_db: "1" + redis_celery_db: "0" + # Or SSL port is usually 6380 + # Update following for using Redis with SSL + redis_ssl: + enabled: false + ssl_cert_reqs: CERT_NONE + # You need to change below configuration incase bringing own PostgresSQL instance and also set postgresql.enabled:false + db_host: '{{ .Release.Name }}-postgresql' + db_port: "5432" + db_user: superset + db_pass: superset + db_name: superset + resources: {} + +# Superset Celery worker configuration +supersetWorker: + replicas: + enabled: true + replicaCount: 1 + resources: {} + + +# Superset beat configuration (to trigger scheduled jobs like reports) +supersetCeleryBeat: + enabled: false + resources: {} + +supersetCeleryFlower: + enabled: false + replicaCount: 1 + resources: {} + +postgresql: + enabled: true + auth: + username: superset + password: superset + database: superset + image: + registry: docker.io + primary: + resources: + limits: {} + requests: + memory: 256Mi + cpu: 250m + persistence: + enabled: true + storageClass: "" + size: 8Gi + +redis: + enabled: true + architecture: standalone + auth: + enabled: false + password: superset + image: + registry: docker.io + master: + resources: + limits: {} + requests: {} + persistence: + enabled: true + storageClass: "" + size: 8Gi + + +