Skip to content

Commit 77836c9

Browse files
committed
feat: slim mode
When slim: true is set, Operator will deploy a minimal set of resources allowing OpenServerless to run with less RAM and CPU usage
1 parent cc71248 commit 77836c9

16 files changed

+924
-23
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ deploy.tar
5555
actions/github/callback/common
5656
actions/github/webhook/common
5757
.direnv/
58-
.idea/**
58+
.idea/**
59+
.vscode/**

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ trigger a creation of the image.
6363
2. With VSCode, access the development VM, open the workspace `openserverless/openserverless.code-workspace` and then
6464
open a terminal with `operator` subproject: this will enable the `nix` environment with direnv (provided by the VM).
6565

66-
3. Create a fork of `githbub.com/apache/openserverless-operator`
66+
3. Create a fork of `github.com/apache/openserverless-operator`
6767

6868
4. Copy .env.dist in .env and put your GitHub username in it
6969

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
apiVersion: v1
20+
kind: ConfigMap
21+
metadata:
22+
name: nuvolaris-milvus
23+
namespace: nuvolaris
24+
data:
25+
default.yaml: |+
26+
# Copyright (C) 2019-2021 Zilliz. All rights reserved.
27+
#
28+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
29+
# with the License. You may obtain a copy of the License at
30+
#
31+
# http://www.apache.org/licenses/LICENSE-2.0
32+
#
33+
# Unless required by applicable law or agreed to in writing, software distributed under the License
34+
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
35+
# or implied. See the License for the specific language governing permissions and limitations under the License.
36+
37+
etcd:
38+
rootPath: milvus
39+
auth:
40+
enabled: true
41+
userName: root
42+
password: 0therPa55
43+
endpoints:
44+
- nuvolaris-etcd-0.nuvolaris-etcd-headless.nuvolaris.svc.cluster.local:2379
45+
46+
metastore:
47+
type: etcd
48+
49+
minio:
50+
address: nuvolaris-minio
51+
port: 9000
52+
accessKeyID: {{milvus_s3_username}}
53+
secretAccessKey: {{milvus_s3_password}}
54+
useSSL: false
55+
bucketName: vectors
56+
rootPath: files
57+
useIAM: false
58+
useVirtualHost: false
59+
60+
mq:
61+
type: rocksmq
62+
63+
messageQueue: rocksmq
64+
65+
rootCoord:
66+
address: localhost
67+
port: 53100
68+
enableActiveStandby: false # Enable rootcoord active-standby
69+
maxDatabaseNum: {{milvus_max_database_num}}
70+
71+
proxy:
72+
port: 19530
73+
internalPort: 19529
74+
maxRoleNum: {{milvus_max_role_num}}
75+
maxUserNum: {{milvus_max_user_num}}
76+
77+
queryCoord:
78+
address: localhost
79+
port: 19531
80+
81+
enableActiveStandby: false # Enable querycoord active-standby
82+
83+
queryNode:
84+
port: 21123
85+
enableDisk: true # Enable querynode load disk index, and search on disk index
86+
87+
indexCoord:
88+
address: localhost
89+
port: 31000
90+
enableActiveStandby: false # Enable indexcoord active-standby
91+
92+
indexNode:
93+
port: 21121
94+
enableDisk: true # Enable index node build disk vector index
95+
96+
dataCoord:
97+
address: localhost
98+
port: 13333
99+
enableActiveStandby: false # Enable datacoord active-standby
100+
101+
dataNode:
102+
port: 21124
103+
104+
log:
105+
level: info
106+
file:
107+
rootPath: ""
108+
maxSize: 300
109+
maxAge: 10
110+
maxBackups: 20
111+
format: text
112+
user.yaml: |-
113+
# For example enable rest http for milvus proxy
114+
# proxy:
115+
# http:
116+
# enabled: true
117+
# maxUserNum: 100
118+
# maxRoleNum: 10
119+
## Enable tlsMode and set the tls cert and key
120+
# tls:
121+
# serverPemPath: /etc/milvus/certs/tls.crt
122+
# serverKeyPath: /etc/milvus/certs/tls.key
123+
# common:
124+
# security:
125+
# tlsMode: 1
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
apiVersion: v1
20+
kind: ConfigMap
21+
metadata:
22+
name: nuvolaris-milvus-minio
23+
data:
24+
initialize: |-
25+
#!/bin/sh
26+
set -e ; # Have script exit in the event of a failed command.
27+
MC_CONFIG_DIR="/etc/minio/mc/"
28+
MC="/usr/bin/mc --insecure --config-dir ${MC_CONFIG_DIR}"
29+
30+
# connectToMinio
31+
# Use a check-sleep-check loop to wait for Minio service to be available
32+
connectToMinio() {
33+
SCHEME=$1
34+
ATTEMPTS=0 ; LIMIT=29 ; # Allow 30 attempts
35+
set -e ; # fail if we can't read the keys.
36+
ACCESS=$(cat /config/accesskey) ; SECRET=$(cat /config/secretkey) ;
37+
set +e ; # The connections to minio are allowed to fail.
38+
echo "Connecting to Minio server: $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT" ;
39+
MC_COMMAND="${MC} config host add myminio $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT $ACCESS $SECRET" ;
40+
$MC_COMMAND ;
41+
STATUS=$? ;
42+
until [ $STATUS = 0 ]
43+
do
44+
ATTEMPTS=`expr $ATTEMPTS + 1` ;
45+
echo \"Failed attempts: $ATTEMPTS\" ;
46+
if [ $ATTEMPTS -gt $LIMIT ]; then
47+
exit 1 ;
48+
fi ;
49+
sleep 2 ; # 1 second intervals between attempts
50+
$MC_COMMAND ;
51+
STATUS=$? ;
52+
done ;
53+
set -e ; # reset `e` as active
54+
return 0
55+
}
56+
57+
# checkBucketExists ($bucket)
58+
# Check if the bucket exists, by using the exit code of `mc ls`
59+
checkBucketExists() {
60+
BUCKET=$1
61+
CMD=$(${MC} ls myminio/$BUCKET > /dev/null 2>&1)
62+
return $?
63+
}
64+
65+
# createBucket ($bucket, $policy, $purge)
66+
# Ensure bucket exists, purging if asked to
67+
createBucket() {
68+
BUCKET=$1
69+
POLICY=$2
70+
PURGE=$3
71+
VERSIONING=$4
72+
73+
# Purge the bucket, if set & exists
74+
# Since PURGE is user input, check explicitly for `true`
75+
if [ $PURGE = true ]; then
76+
if checkBucketExists $BUCKET ; then
77+
echo "Purging bucket '$BUCKET'."
78+
set +e ; # don't exit if this fails
79+
${MC} rm -r --force myminio/$BUCKET
80+
set -e ; # reset `e` as active
81+
else
82+
echo "Bucket '$BUCKET' does not exist, skipping purge."
83+
fi
84+
fi
85+
86+
# Create the bucket if it does not exist
87+
if ! checkBucketExists $BUCKET ; then
88+
echo "Creating bucket '$BUCKET'"
89+
${MC} mb myminio/$BUCKET
90+
else
91+
echo "Bucket '$BUCKET' already exists."
92+
fi
93+
94+
95+
# set versioning for bucket
96+
if [ ! -z $VERSIONING ] ; then
97+
if [ $VERSIONING = true ] ; then
98+
echo "Enabling versioning for '$BUCKET'"
99+
${MC} version enable myminio/$BUCKET
100+
elif [ $VERSIONING = false ] ; then
101+
echo "Suspending versioning for '$BUCKET'"
102+
${MC} version suspend myminio/$BUCKET
103+
fi
104+
else
105+
echo "Bucket '$BUCKET' versioning unchanged."
106+
fi
107+
108+
# At this point, the bucket should exist, skip checking for existence
109+
# Set policy on the bucket
110+
echo "Setting policy of bucket '$BUCKET' to '$POLICY'."
111+
${MC} policy set $POLICY myminio/$BUCKET
112+
}
113+
114+
# Try connecting to Minio instance
115+
scheme=http
116+
connectToMinio $scheme
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
apiVersion: v1
20+
kind: Secret
21+
type: Opaque
22+
metadata:
23+
name: nuvolaris-milvus-etcd-secret
24+
namespace: nuvolaris
25+
data:
26+
username: ZXRjZG1pbHZ1cw==
27+
password: MHRoZXJQYTU1
28+
29+
30+

deploy/milvus-slim/milvus-pvc.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
apiVersion: v1
20+
kind: PersistentVolumeClaim
21+
metadata:
22+
name: nuvolaris-milvus
23+
namespace: nuvolaris
24+
labels:
25+
app.kubernetes.io/name: milvus
26+
app.kubernetes.io/instance: nuvolaris-milvus
27+
spec:
28+
storageClassName: standard
29+
accessModes:
30+
- "ReadWriteOnce"
31+
resources:
32+
requests:
33+
storage: 10Gi
34+
35+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
apiVersion: v1
20+
kind: Secret
21+
type: Opaque
22+
metadata:
23+
name: nuvolaris-milvus-s3-secret
24+
namespace: nuvolaris
25+
stringData:
26+
accesskey: miniomilvus
27+
secretkey: miniomilvuspwd
28+
29+
30+

0 commit comments

Comments
 (0)