Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #23 from xtellurian/doc/databricks-token
Browse files Browse the repository at this point in the history
Doc/databricks token
  • Loading branch information
Azadehkhojandi authored May 31, 2019
2 parents 4faed48 + 7a882ea commit 6a4a776
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
52 changes: 34 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ Basic commands to check your cluster

1. Download [latest release.zip](https://github.com/microsoft/azure-databricks-operator/releases)

2. Create the `databricks-operator-system` Namespace
2. Create the `databricks-operator-system` namespace

```shell
```yaml
apiVersion: v1
kind: Namespace
metadata:
Expand All @@ -67,27 +67,42 @@ metadata:
name: databricks-operator-system
```
3. Create Kubernetes secrets with values for `DATABRICKS_HOST` and `DATABRICKS_TOKEN`
3. [Generate a databricks token](https://docs.databricks.com/api/latest/authentication.html#generate-a-token), and create Kubernetes secrets with values for `DATABRICKS_HOST` and `DATABRICKS_TOKEN`

```shell
kubectl --namespace databricks-operator-system create secret generic dbrickssettings --from-literal=DatabricksHost="https://xxxx.azuredatabricks.net" --from-literal=DatabricksToken="xxxxx"
```

4. Install the NotebookJob CRD and Operators in the configured Kubernetes cluster in ~/.kube/config
4. Apply the manifests for the CRD and Operator in `release/config`:

`kubectl apply -f release/config`
```sh
kubectl apply -f release/config
```

5. Create a test secret, you can pass the value of Kubernetes secrets into your notebook as Databricks secrets
`kubectl create secret generic test --from-literal=my_secret_key="my_secret_value"`

6. Define your Notebook job and apply it
6. In Databricks, [create a new Python Notebook](https://docs.databricks.com/user-guide/notebooks/notebook-manage.html#create-a-notebook) called `testnotebook` in the root of your [Workspace](https://docs.databricks.com/user-guide/workspace.html#folders). Put the following in the first cell of the notebook:

```shell
```py
dbutils.widgets.text("secret_scope", "", "value from CRD")
secret_scope = dbutils.widgets.get("secret_scope")
secret_value = dbutils.secrets.get(scope=secret_scope, key="dbricks_secret_key") # this will come from a kubernetes secret
print(secret_value) # will be redacted
dbutils.widgets.text("flag", "", "value from CRD")
value = dbutils.widgets.get("flag")
print(value) # 'true'
```

7. Define your Notebook job and apply it

```yaml
apiVersion: microsoft.k8s.io/v1beta1
kind: NotebookJob
metadata:
annotations:
microsoft.k8s.io/prd-id: 2ae31bc5-ad0a-447d-8c26-29ac2a6b4c39
microsoft.k8s.io/author: [email protected]
name: samplejob1
spec:
Expand All @@ -110,17 +125,18 @@ spec:
nodeTypeId: "Standard_DS12_v2"
numWorkers: 1
```
7. Basic commands to check the new Notebookjob

8. Basic commands to check the new Notebookjob

```shell
kubectl get crd
kubectl -n databricks-operator-system get svc
kubectl -n databricks-operator-system get pod
kubectl -n databricks-operator-system describe pod databricks-operator-controller-manager-0
kubectl -n databricks-operator-system logs databricks-operator-controller-manager-0 -c dbricks -f
kubectl get notebookjob
kubectl describe notebookjob kubectl samplejob1
```
```shell
kubectl get crd
kubectl -n databricks-operator-system get svc
kubectl -n databricks-operator-system get pod
kubectl -n databricks-operator-system describe pod databricks-operator-controller-manager-0
kubectl -n databricks-operator-system logs databricks-operator-controller-manager-0 -c dbricks -f
kubectl get notebookjob
kubectl describe notebookjob kubectl samplejob1
```

### Run Souce Code

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: microsoft.k8s.io/v1beta1
kind: NotebookJob
metadata:
annotations:
microsoft.k8s.io/prd-id: 2ae31bc5-ad0a-447d-8c26-29ac2a6b4c39
microsoft.k8s.io/author: [email protected]
name: sample1run1
spec:
Expand Down

0 comments on commit 6a4a776

Please sign in to comment.