Skip to content

Commit 45ddb31

Browse files
Merge branch 'main' of github.com:fetch-rewards/streamlit-operator
2 parents 0814548 + cd82a09 commit 45ddb31

File tree

5 files changed

+28
-31
lines changed

5 files changed

+28
-31
lines changed

README.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,45 @@ With a minimal amount of config for each app, it handles deployment, plus ingres
66
It will also install a "Streamlit Hub" app in your cluster, that allows you to view all running apps as well as launch
77
new apps from the UI.
88

9-
## Installation
10-
11-
Details to come
12-
139
## Prerequisites
1410

1511
This app has been developed under the assumption that you're running a cluster on EKS in AWS. It will likely work on other clusters
1612
with minimal changes, but this has not been tested.
1713

18-
## Usage
19-
20-
The operator is built around one StreamlitApp CRD that takes required configuration for each app.
14+
## Installation
2115

22-
Currently users must specify four pieces of config:
16+
The Streamlit Operator comes prepackaged as a Helm chart. If you've never used helm, please refer to
17+
Helm's [documentation](https://helm.sh/docs) to get started.
2318

24-
- `name`: The name of the app. This will be used as the name of the deployment, service, ingress, and DNS record.
25-
- `repo`: The git style URL of the repo containing the app code. This is used to clone the repo into the container. e.g. `[email protected]:MyOrg/my-app.git`
26-
- `branch`: The branch of the repo to use. Typical usecase will be to track main, but users can also work off development branches.
27-
- `code_dir`: The directory within the repo that contains the app code. This is used to run `streamlit run` within the container. e.g. `my-app`
28-
- Note that the operator assumes your app's entrypoint is `main.py` within this directory. This will be configurable in the future.
19+
Once Helm has been set up correctly, add the repo as follows:
2920

30-
## Architecture
21+
helm repo add streamlit-operator https://fetch-rewards.github.io/streamlit-operator/
3122

32-
![Architecture](docs/imgs/architecture.png)
23+
If you had already added this repo earlier, run `helm repo update` to retrieve
24+
the latest versions of the packages. You can then run `helm search repo
25+
<alias>` to see the charts.
3326

27+
To install the chart run:
3428

29+
helm install streamlit-operator streamlit-operator/streamlit-chart --set baseDnsRecord=<YOUR-COMPANY>.com
3530

36-
## Helm Usage
31+
To uninstall the chart:
3732

38-
[Helm](https://helm.sh) must be installed to use the charts. Please refer to
39-
Helm's [documentation](https://helm.sh/docs) to get started.
33+
helm delete streamlit-operator
4034

41-
Once Helm has been set up correctly, add the repo as follows:
4235

43-
helm repo add <alias> https://<orgname>.github.io/helm-charts
36+
## Usage
4437

45-
If you had already added this repo earlier, run `helm repo update` to retrieve
46-
the latest versions of the packages. You can then run `helm search repo
47-
<alias>` to see the charts.
38+
The operator is built around one StreamlitApp CRD that takes required configuration for each app.
4839

49-
To install the <chart-name> chart:
40+
Currently users must specify four pieces of config:
5041

51-
helm install my-<chart-name> <alias>/<chart-name>
42+
- `name`: The name of the app. This will be used as the name of the deployment, service, ingress, and DNS record.
43+
- `repo`: The git style URL of the repo containing the app code. This is used to clone the repo into the container. e.g. `[email protected]:MyOrg/my-app.git`
44+
- `branch`: The branch of the repo to use. Typical usecase will be to track main, but users can also work off development branches.
45+
- `code_dir`: The directory within the repo that contains the app code. This is used to run `streamlit run` within the container. e.g. `my-app`
46+
- Note that the operator assumes your app's entrypoint is `main.py` within this directory. This will be configurable in the future.
5247

53-
To uninstall the chart:
48+
## Architecture
5449

55-
helm delete my-<chart-name>
50+
![Architecture](docs/imgs/architecture.png)

charts/streamlit-chart/templates/operator-configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
data:
77
config.yaml: |
88
baseDnsRecord: {{ .Values.baseDnsRecord }}
9+
suffix: {{ .Values.suffix }}
910
ingressAnnotations:
1011
{{- range $key, $value := .Values.ingressAnnotations }}
1112
{{ $key }} : {{ tpl $value $ }}

charts/streamlit-chart/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#baseDnsRecord: "this-is-a-test"
22
#ingressAnnotations:
33
# annotation1: "value1"
4-
# annotation2: "value2"
4+
# annotation2: "value2"
5+
suffix: "-streamlit"

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def create_fn(spec, name, namespace, logger, **kwargs):
4343
kopf.adopt(service_data)
4444

4545
# Template the ingress
46-
ingress_data = template_ingress(name, config["baseDnsRecord"], config["ingressAnnotations"])
46+
ingress_data = template_ingress(name, config["baseDnsRecord"], config["ingressAnnotations"], config["suffix"])
4747
kopf.adopt(ingress_data)
4848

4949
api = kubernetes.client.CoreV1Api()

src/templating.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def template_service(name):
106106
return service_dict
107107

108108

109-
def template_ingress(name, base_dns_path, ingress_annotations):
110-
dns_name = f"{name}-streamlit.{base_dns_path}"
109+
def template_ingress(name, base_dns_path, ingress_annotations, suffix):
110+
dns_name = f"{name}{suffix}.{base_dns_path}"
111111
ingress_dict = {
112112
"apiVersion": "networking.k8s.io/v1",
113113
"kind": "Ingress",

0 commit comments

Comments
 (0)