Skip to content

Commit cc0f9fe

Browse files
committed
chore: olaris api
fixed olaris-api. aligned with tasks
1 parent 9ddf072 commit cc0f9fe

4 files changed

Lines changed: 73 additions & 106 deletions

File tree

olaris-api/api-template.yaml

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,76 +22,50 @@
2222
apiVersion: apps/v1
2323
kind: StatefulSet
2424
metadata:
25-
name: ${USERNAME:-nuvolaris}-system-api
25+
name: nuvolaris-system-api
2626
namespace: nuvolaris
2727
labels:
28-
app: ${USERNAME:-nuvolaris}-system-api
28+
app: nuvolaris-system-api
2929
spec:
3030
replicas: 1
3131
selector:
3232
matchLabels:
33-
app: ${USERNAME:-nuvolaris}-system-api
33+
app: nuvolaris-system-api
3434
template:
3535
metadata:
3636
labels:
37-
name: ${USERNAME:-nuvolaris}-system-api
38-
app: ${USERNAME:-nuvolaris}-system-api
37+
name: nuvolaris-system-api
38+
app: nuvolaris-system-api
3939
spec:
4040
serviceAccount: nuvolaris-wsku
4141
containers:
42-
- name: ${USERNAME:-nuvolaris}-system-api
43-
image: registry.hub.docker.com/nuvolaris/nuvolaris-system-api:${IMAGE_TAG:-1.3.0-mastrogpt.2405061820}
44-
imagePullPolicy: Always
42+
- name: nuvolaris-system-api
43+
image: ${IMAGES_SYSTEMAPI}
44+
imagePullPolicy: IfNotPresent
4545
command: ["./run.sh"]
4646
ports:
4747
- containerPort: 5000
4848
name: api
4949
env:
5050
- name: "APIHOST"
51-
value: "${APIHOST:-localhost}"
52-
- name: "AUTH0_DOMAIN"
53-
value: "${AUTH0_DOMAIN}"
54-
- name: "AUTH0_CLIENT"
55-
value: "${AUTHO_CLIENT}"
56-
- name: "AUTH0_SECRET"
57-
value: "${AUTH0_SECRET}"
58-
- name: "AUTH0_ENABLED"
59-
value: "${AUTH0_ENABLED}"
60-
- name: "REDIS_PREFIX"
61-
value: "${REDIS_PREFIX}"
62-
- name: "REDIS_URL"
63-
value: "${REDIS_URL}"
64-
- name: "RECAPTCHA_SECRET"
65-
value: "${RECAPTCHA_SECRET}"
66-
- name: "RECAPTCHA_VALID_DOMAINS"
67-
value: "${RECAPTCHA_VALID_DOMAINS}"
68-
- name: "RECAPTCHA_VALIDATE"
69-
value: "${RECAPTCHA_VALIDATE}"
51+
value: "${SYS_API_HOSTNAME:-localhost}"
7052
- name: "COUCHDB_SERVICE_PORT"
7153
value: "5984"
7254
- name: "COUCHDB_SERVICE_HOST"
7355
value: "couchdb"
7456
- name: "COUCHDB_ADMIN_USER"
75-
value: "${CDB_USER}"
57+
value: "${SYS_API_CDB_USER}"
7658
- name: "COUCHDB_ADMIN_PASSWORD"
77-
value: "${CDB_PASSWORD}"
78-
- name: "DEFAULT_MINIO_QUOTA"
79-
value: "${SYS_API_MINIO_QUOTA:-100}"
80-
- name: "DEFAULT_REDIS_QUOTA"
81-
value: "${SYS_API_REDIS_QUOTA:-1}"
82-
- name: "DEFAULT_MONGO_QUOTA"
83-
value: "${SYS_API_MONGO_QUOTA:-100}"
84-
- name: "DEFAULT_POSTGRES_QUOTA"
85-
value: "${SYS_API_MONGO_QUOTA:-100}"
59+
value: "${SYS_API_CDB_PASSWORD}"
8660
---
8761
apiVersion: v1
8862
kind: Service
8963
metadata:
90-
name: ${USERNAME:-nuvolaris}-system-api
64+
name: nuvolaris-system-api
9165
namespace: nuvolaris
9266
spec:
9367
ports:
9468
- name: api
9569
port: 5000
9670
selector:
97-
app: ${USERNAME:-nuvolaris}-system-api
71+
app: nuvolaris-system-api

olaris-api/k3s-template.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ metadata:
2828
traefik.ingress.kubernetes.io/transport.respondingTimeouts.idleTimeout: "600"
2929
traefik.ingress.kubernetes.io/transport.respondingTimeouts.readTimeout: "600"
3030
traefik.ingress.kubernetes.io/transport.respondingTimeouts.writeTimeout: "600"
31-
name:${USERNAME:-nuvolaris}-system-api-ingress
31+
name: nuvolaris-system-api-ingress
3232
namespace: nuvolaris
3333
spec:
3434
rules:
35-
- host: localhost
35+
- host: ${SYS_API_HOSTNAME:-localhost}
3636
http:
3737
paths:
3838
- backend:
3939
service:
40-
name: ${USERNAME:-nuvolaris}-system-api
40+
name: nuvolaris-system-api
4141
port:
4242
number: 5000
4343
path: /system

olaris-api/nginx-template.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ metadata:
2727
nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
2828
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
2929
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
30-
name: ${USERNAME:-nuvolaris}-system-api-ingress
30+
name: nuvolaris-system-api-ingress
3131
namespace: nuvolaris
3232
spec:
3333
rules:
3434
- #
35-
host: localhost
35+
host: ${SYS_API_HOSTNAME:-localhost}
3636
http:
3737
paths:
3838
- backend:
3939
service:
40-
name: ${USERNAME:-nuvolaris}-system-api
40+
name: nuvolaris-system-api
4141
port:
4242
number: 5000
4343
path: /system

olaris-api/opsfile.yml

Lines changed: 54 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -14,83 +14,76 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17+
version: '3'
1718

18-
version: "3"
19+
vars:
20+
VAR: ""
21+
MSG: ""
22+
VAL: ""
23+
RETRY: 100
24+
TIMEOUT: 15s
25+
CONTEXT: ""
1926

2027
env:
28+
2129
KUBECONFIG:
22-
sh: |-
23-
if test -e $OPS_TMP/kubeconfig
24-
then echo $OPS_TMP/kubeconfig
30+
sh: |
31+
if test -e "$OPS_TMP/kubeconfig"
32+
then echo "$OPS_TMP/kubeconfig"
2533
else echo ~/.kube/config
2634
fi
2735
28-
IMAGE_TAG:
29-
sh: git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD
30-
31-
CDB_HOST: couchdb
36+
SYS_API_CDB_HOST: couchdb
3237

33-
CDB_USER:
34-
sh: nuv debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}'"
38+
SYS_API_CDB_USER:
39+
sh: $OPS debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}'"
3540

36-
CDB_PASSWORD:
37-
sh: nuv debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}'"
41+
SYS_API_CDB_PASSWORD:
42+
sh: $OPS debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}'"
3843

39-
APIHOST:
40-
sh: nuv debug kube ctl CMD="-n nuvolaris get cm/config -o jsonpath='{.metadata.annotations.apihost}'"
44+
SYS_API_HOSTNAME:
45+
sh: $OPS debug kube ctl CMD="-n nuvolaris get ingress/apihost -o jsonpath='{.spec.rules[0].host}'"
4146

42-
REDIS_PREFIX:
43-
sh: echo "nuvolaris:"
44-
45-
REDIS_URL:
46-
sh: |
47-
echo redis://nuvolaris:$(kubectl -n nuvolaris get wsk/controller -o jsonpath='{.spec.redis.nuvolaris.password}')@redis:6379
48-
49-
dotenv:
50-
- .env
47+
INGRESS_TYPE:
48+
sh: $OPS util ingress-type
5149

5250
tasks:
5351

54-
api:deploy:
55-
ignore_error: false
56-
cmds:
57-
- envsubst -i api-template.yaml -o _api-template.yaml
58-
- kubectl -n nuvolaris apply -f _api-template.yaml
59-
60-
api:undeploy:
52+
deploy:
53+
silent: true
6154
ignore_error: false
55+
desc: deploy the admin api
6256
cmds:
63-
- envsubst -i api-template.yaml -o _api-template.yaml
64-
- kubectl -n nuvolaris delete -f _api-template.yaml
65-
66-
nginx:deploy:
67-
desc: deploy nuvolaris admin api on an nginx based deployment (Kind or similar)
57+
- test -e ${INGRESS_TYPE}-template.yaml || die "No avalable template for ingress type ${INGRESS_TYPE}."
58+
- test -n "$IMAGES_SYSTEMAPI" || die "IMAGES_SYSTEMAPI is not set. Please set it to the desired image version."
59+
- envsubst -i api-template.yaml -o _api.yaml > /dev/null 2>&1
60+
- envsubst -i ${INGRESS_TYPE}-template.yaml -o _ingress.yaml > /dev/null 2>&1
61+
- kubectl -n nuvolaris apply -f _api.yaml
62+
#- cat _ingress.yaml
63+
- kubectl -n nuvolaris apply -f _ingress.yaml
64+
- |
65+
echo "Admin API deployed with HOSTNAME: ${SYS_API_HOSTNAME}/system"
66+
67+
undeploy:
68+
silent: true
69+
desc: undeploy the admin api
6870
ignore_error: true
6971
cmds:
70-
- task: api:deploy
71-
- envsubst -i nginx-template.yaml -o _nginx-template.yaml
72-
- kubectl -n nuvolaris apply -f _nginx-template.yaml
73-
74-
nginx:undeploy:
75-
desc: undeploy nuvolaris admin api on an nginx based deployment (Kind or similar)
76-
ignore_error: true
77-
cmds:
78-
- task: api:undeploy
79-
- envsubst -i nginx-template.yaml -o _nginx-template.yaml
80-
- kubectl -n nuvolaris delete -f _nginx-template.yaml
81-
82-
k3s:deploy:
83-
desc: deploy nuvolaris admin api on an nginx based deployment (Kind or similar)
84-
ignore_error: true
85-
cmds:
86-
- task: api:deploy
87-
- envsubst -i k3s-template.yaml -o _k3s-template.yaml
88-
- kubectl -n nuvolaris apply -f _k3s-template.yaml
89-
90-
k3s:undeploy:
91-
desc: undeploy nuvolaris admin api on an nginx based deployment (Kind or similar)
92-
ignore_error: true
72+
- kubectl -n nuvolaris delete sts/nuvolaris-system-api ing/nuvolaris-system-api-ingress
73+
- |
74+
echo "System API undeployed"
75+
76+
77+
update:
78+
silent: true
79+
desc: update the OpenServerless Admin Api stateful set
9380
cmds:
94-
- task: api:undeploy
95-
- envsubst -i k3s-template.yaml -o _k3s-template.yaml
96-
- kubectl -n nuvolaris delete -f _k3s-template.yaml
81+
- task: deploy
82+
- kubectl -n nuvolaris rollout restart statefulset nuvolaris-system-api
83+
preconditions:
84+
- sh: '[ $IMAGES_SYSTEMAPI != $CURRENT_API_VERSION ]'
85+
msg: "Current OpenServerless system API stateful set it is already updated to newest version. Request ignored."
86+
env:
87+
CURRENT_API_VERSION:
88+
sh: |
89+
echo $(kubectl -n nuvolaris get pod/nuvolaris-system-api-0 -ojsonpath='{.spec.containers[0].image}')

0 commit comments

Comments
 (0)