Skip to content

Commit 4abaa11

Browse files
Adapt the getting started guide
1 parent f8c2fea commit 4abaa11

15 files changed

Lines changed: 314 additions & 328 deletions

docs/modules/opensearch/examples/getting_started/getting_started.sh

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ set -euo pipefail
1010
# This script contains all the code snippets from the guide, as well as some assert tests
1111
# to test if the instructions in the guide work. The user *could* use it, but it is intended
1212
# for testing only.
13-
# The script will install the operators, create a superset instance and briefly open a port
14-
# forward and connect to the superset instance to make sure it is up and running.
13+
# The script will install the operators, create a OpenSearch instance and briefly open a port
14+
# forward and connect to the OpenSearch instance to make sure it is up and running.
1515
# No running processes are left behind (i.e. the port-forwarding is closed at the end)
1616

1717
if [ $# -eq 0 ]
@@ -29,7 +29,7 @@ echo "Installing Operators with Helm"
2929
helm install --wait commons-operator oci://oci.stackable.tech/sdp-charts/commons-operator --version 0.0.0-dev
3030
helm install --wait secret-operator oci://oci.stackable.tech/sdp-charts/secret-operator --version 0.0.0-dev
3131
helm install --wait listener-operator oci://oci.stackable.tech/sdp-charts/listener-operator --version 0.0.0-dev
32-
helm install --wait superset-operator oci://oci.stackable.tech/sdp-charts/superset-operator --version 0.0.0-dev
32+
helm install --wait opensearch-operator oci://oci.stackable.tech/sdp-charts/opensearch-operator --version 0.0.0-dev
3333
# end::helm-install-operators[]
3434
;;
3535
"stackablectl")
@@ -39,7 +39,7 @@ stackablectl operator install \
3939
commons=0.0.0-dev \
4040
secret=0.0.0-dev \
4141
listener=0.0.0-dev \
42-
superset=0.0.0-dev
42+
opensearch=0.0.0-dev
4343
# end::stackablectl-install-operators[]
4444
;;
4545
*)
@@ -48,67 +48,65 @@ exit 1
4848
;;
4949
esac
5050

51-
echo "Installing bitnami PostgreSQL"
52-
# tag::install-bitnami-psql[]
53-
helm install superset oci://registry-1.docker.io/bitnamicharts/postgresql \
54-
--version 16.5.0 \
55-
--set auth.username=superset \
56-
--set auth.password=superset \
57-
--set auth.database=superset \
58-
--wait
59-
# end::install-bitnami-psql[]
60-
61-
echo "Creating credentials secret"
62-
# tag::apply-superset-credentials[]
63-
kubectl apply -f superset-credentials.yaml
64-
# end::apply-superset-credentials[]
65-
66-
echo "Creating Superset cluster"
67-
# tag::apply-superset-cluster[]
68-
kubectl apply -f superset.yaml
69-
# end::apply-superset-cluster[]
51+
echo "Creating OpenSearch security plugin configuration"
52+
# tag::apply-security-config[]
53+
kubectl apply -f opensearch-security-config.yaml
54+
# end::apply-security-config[]
55+
56+
echo "Creating OpenSearch cluster"
57+
# tag::apply-cluster[]
58+
kubectl apply -f opensearch.yaml
59+
# end::apply-cluster[]
7060

7161
sleep 5
7262

7363
for (( i=1; i<=15; i++ ))
7464
do
75-
echo "Waiting for SupersetCluster to appear ..."
76-
if eval kubectl get statefulset simple-superset-node-default; then
65+
echo "Waiting for OpenSearchCluster to appear ..."
66+
if eval kubectl get statefulset simple-opensearch-nodes-default; then
7767
break
7868
fi
7969

8070
sleep 1
8171
done
8272

83-
echo "Waiting on superset StatefulSet ..."
84-
# tag::wait-superset[]
85-
kubectl rollout status --watch statefulset/simple-superset-node-default --timeout 300s
86-
# end::wait-superset[]
73+
echo "Waiting on OpenSearch StatefulSet ..."
74+
# tag::await-cluster[]
75+
kubectl rollout status --watch statefulset/simple-opensearch-nodes-default --timeout 300s
76+
# end::await-cluster[]
8777

8878
# wait a bit for the port to open
8979
sleep 10
9080

91-
echo "Starting port-forwarding of port 8088"
81+
echo "Starting port-forwarding of port 9200"
9282
# tag::port-forwarding[]
93-
kubectl port-forward service/simple-superset-node 8088 > /dev/null 2>&1 &
83+
kubectl port-forward services/simple-opensearch 9200 > /dev/null 2>&1 &
9484
# end::port-forwarding[]
9585
PORT_FORWARD_PID=$!
9686
# shellcheck disable=2064 # we want the PID evaluated now, not at the time the trap is
9787
trap "kill $PORT_FORWARD_PID" EXIT
9888
sleep 5
9989

100-
echo "Checking if web interface is reachable ..."
101-
return_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8088/login/)
102-
if [ "$return_code" == 200 ]; then
103-
echo "Web interface reachable!"
104-
else
105-
echo "Could not reach web interface."
106-
exit 1
107-
fi
108-
109-
echo "Loading examples ..."
110-
# tag::load-examples[]
111-
kubectl apply -f superset-load-examples-job.yaml
112-
sleep 5
113-
kubectl wait --for=condition=complete --timeout=1500s job/superset-load-examples
114-
# end::load-examples[]
90+
echo "Using the REST API"
91+
# tag::rest-api[]
92+
export CREDENTIALS=admin:AJVFsGJBbpT6mChn
93+
94+
curl \
95+
--insecure \
96+
--user $CREDENTIALS \
97+
--request PUT \
98+
--json '{"name": "Stackable"}' \
99+
https://localhost:9200/sample_index/_doc/1
100+
101+
# Output:
102+
# {"_index":"sample_index","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}
103+
104+
curl \
105+
--insecure \
106+
--user $CREDENTIALS \
107+
--request GET \
108+
https://localhost:9200/sample_index/_doc/1
109+
110+
# Output:
111+
# {"_index":"sample_index","_id":"1","_version":1,"_seq_no":0,"_primary_term":1,"found":true,"_source":{"name": "Stackable"}}
112+
# end::rest-api[]

docs/modules/opensearch/examples/getting_started/getting_started.sh.j2

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ set -euo pipefail
1010
# This script contains all the code snippets from the guide, as well as some assert tests
1111
# to test if the instructions in the guide work. The user *could* use it, but it is intended
1212
# for testing only.
13-
# The script will install the operators, create a superset instance and briefly open a port
14-
# forward and connect to the superset instance to make sure it is up and running.
13+
# The script will install the operators, create a OpenSearch instance and briefly open a port
14+
# forward and connect to the OpenSearch instance to make sure it is up and running.
1515
# No running processes are left behind (i.e. the port-forwarding is closed at the end)
1616

1717
if [ $# -eq 0 ]
@@ -29,7 +29,7 @@ echo "Installing Operators with Helm"
2929
helm install --wait commons-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/commons-operator --version {{ versions.commons }}
3030
helm install --wait secret-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/secret-operator --version {{ versions.secret }}
3131
helm install --wait listener-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/listener-operator --version {{ versions.listener }}
32-
helm install --wait superset-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/superset-operator --version {{ versions.superset }}
32+
helm install --wait opensearch-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/opensearch-operator --version {{ versions.opensearch }}
3333
# end::helm-install-operators[]
3434
;;
3535
"stackablectl")
@@ -39,7 +39,7 @@ stackablectl operator install \
3939
commons={{ versions.commons }} \
4040
secret={{ versions.secret }} \
4141
listener={{ versions.listener }} \
42-
superset={{ versions.superset }}
42+
opensearch={{ versions.opensearch }}
4343
# end::stackablectl-install-operators[]
4444
;;
4545
*)
@@ -48,67 +48,65 @@ exit 1
4848
;;
4949
esac
5050

51-
echo "Installing bitnami PostgreSQL"
52-
# tag::install-bitnami-psql[]
53-
helm install superset oci://registry-1.docker.io/bitnamicharts/postgresql \
54-
--version 16.5.0 \
55-
--set auth.username=superset \
56-
--set auth.password=superset \
57-
--set auth.database=superset \
58-
--wait
59-
# end::install-bitnami-psql[]
60-
61-
echo "Creating credentials secret"
62-
# tag::apply-superset-credentials[]
63-
kubectl apply -f superset-credentials.yaml
64-
# end::apply-superset-credentials[]
65-
66-
echo "Creating Superset cluster"
67-
# tag::apply-superset-cluster[]
68-
kubectl apply -f superset.yaml
69-
# end::apply-superset-cluster[]
51+
echo "Creating OpenSearch security plugin configuration"
52+
# tag::apply-security-config[]
53+
kubectl apply -f opensearch-security-config.yaml
54+
# end::apply-security-config[]
55+
56+
echo "Creating OpenSearch cluster"
57+
# tag::apply-cluster[]
58+
kubectl apply -f opensearch.yaml
59+
# end::apply-cluster[]
7060

7161
sleep 5
7262

7363
for (( i=1; i<=15; i++ ))
7464
do
75-
echo "Waiting for SupersetCluster to appear ..."
76-
if eval kubectl get statefulset simple-superset-node-default; then
65+
echo "Waiting for OpenSearchCluster to appear ..."
66+
if eval kubectl get statefulset simple-opensearch-nodes-default; then
7767
break
7868
fi
7969

8070
sleep 1
8171
done
8272

83-
echo "Waiting on superset StatefulSet ..."
84-
# tag::wait-superset[]
85-
kubectl rollout status --watch statefulset/simple-superset-node-default --timeout 300s
86-
# end::wait-superset[]
73+
echo "Waiting on OpenSearch StatefulSet ..."
74+
# tag::await-cluster[]
75+
kubectl rollout status --watch statefulset/simple-opensearch-nodes-default --timeout 300s
76+
# end::await-cluster[]
8777

8878
# wait a bit for the port to open
8979
sleep 10
9080

91-
echo "Starting port-forwarding of port 8088"
81+
echo "Starting port-forwarding of port 9200"
9282
# tag::port-forwarding[]
93-
kubectl port-forward service/simple-superset-node 8088 > /dev/null 2>&1 &
83+
kubectl port-forward services/simple-opensearch 9200 > /dev/null 2>&1 &
9484
# end::port-forwarding[]
9585
PORT_FORWARD_PID=$!
9686
# shellcheck disable=2064 # we want the PID evaluated now, not at the time the trap is
9787
trap "kill $PORT_FORWARD_PID" EXIT
9888
sleep 5
9989

100-
echo "Checking if web interface is reachable ..."
101-
return_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8088/login/)
102-
if [ "$return_code" == 200 ]; then
103-
echo "Web interface reachable!"
104-
else
105-
echo "Could not reach web interface."
106-
exit 1
107-
fi
108-
109-
echo "Loading examples ..."
110-
# tag::load-examples[]
111-
kubectl apply -f superset-load-examples-job.yaml
112-
sleep 5
113-
kubectl wait --for=condition=complete --timeout=1500s job/superset-load-examples
114-
# end::load-examples[]
90+
echo "Using the REST API"
91+
# tag::rest-api[]
92+
export CREDENTIALS=admin:AJVFsGJBbpT6mChn
93+
94+
curl \
95+
--insecure \
96+
--user $CREDENTIALS \
97+
--request PUT \
98+
--json '{"name": "Stackable"}' \
99+
https://localhost:9200/sample_index/_doc/1
100+
101+
# Output:
102+
# {"_index":"sample_index","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}
103+
104+
curl \
105+
--insecure \
106+
--user $CREDENTIALS \
107+
--request GET \
108+
https://localhost:9200/sample_index/_doc/1
109+
110+
# Output:
111+
# {"_index":"sample_index","_id":"1","_version":1,"_seq_no":0,"_primary_term":1,"found":true,"_source":{"name": "Stackable"}}
112+
# end::rest-api[]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Installed commons=0.0.0-dev operator
22
Installed secret=0.0.0-dev operator
33
Installed listener=0.0.0-dev operator
4-
Installed superset=0.0.0-dev operator
4+
Installed opensearch=0.0.0-dev operator
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Installed commons={{ versions.commons }} operator
22
Installed secret={{ versions.secret }} operator
33
Installed listener={{ versions.listener }} operator
4-
Installed superset={{ versions.superset }} operator
4+
Installed opensearch={{ versions.opensearch }} operator
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: opensearch-security-config
6+
stringData:
7+
action_groups.yml: |
8+
---
9+
_meta:
10+
type: actiongroups
11+
config_version: 2
12+
allowlist.yml: |
13+
---
14+
_meta:
15+
type: allowlist
16+
config_version: 2
17+
18+
config:
19+
enabled: false
20+
audit.yml: |
21+
---
22+
_meta:
23+
type: audit
24+
config_version: 2
25+
26+
config:
27+
enabled: false
28+
config.yml: |
29+
---
30+
_meta:
31+
type: config
32+
config_version: 2
33+
34+
config:
35+
dynamic:
36+
authc:
37+
basic_internal_auth_domain:
38+
description: Authenticate via HTTP Basic against internal users database
39+
http_enabled: true
40+
transport_enabled: true
41+
order: 1
42+
http_authenticator:
43+
type: basic
44+
challenge: true
45+
authentication_backend:
46+
type: intern
47+
authz: {}
48+
internal_users.yml: |
49+
---
50+
_meta:
51+
type: internalusers
52+
config_version: 2
53+
54+
admin:
55+
hash: $2y$10$xRtHZFJ9QhG9GcYhRpAGpufCZYsk//nxsuel5URh0GWEBgmiI4Q/e
56+
reserved: true
57+
backend_roles:
58+
- admin
59+
description: OpenSearch admin user
60+
61+
kibanaserver:
62+
hash: $2y$10$vPgQ/6ilKDM5utawBqxoR.7euhVQ0qeGl8mPTeKhmFT475WUDrfQS
63+
reserved: true
64+
description: OpenSearch Dashboards user
65+
nodes_dn.yml: |
66+
---
67+
_meta:
68+
type: nodesdn
69+
config_version: 2
70+
roles.yml: |
71+
---
72+
_meta:
73+
type: roles
74+
config_version: 2
75+
roles_mapping.yml: |
76+
---
77+
_meta:
78+
type: rolesmapping
79+
config_version: 2
80+
81+
all_access:
82+
reserved: false
83+
backend_roles:
84+
- admin
85+
86+
kibana_server:
87+
reserved: true
88+
users:
89+
- kibanaserver
90+
tenants.yml: |
91+
---
92+
_meta:
93+
type: tenants
94+
config_version: 2

0 commit comments

Comments
 (0)