This is an automated email from the ASF dual-hosted git repository.

bsalzano pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-admin-api.git


The following commit(s) were added to refs/heads/main by this push:
     new cc0f9fe  chore: olaris api
cc0f9fe is described below

commit cc0f9fe753e3a5e586c81b0e132048445a440cfe
Author: Bruno Salzano <[email protected]>
AuthorDate: Sun Jul 27 14:52:12 2025 +0200

    chore: olaris api
    
    fixed olaris-api. aligned with tasks
---
 olaris-api/api-template.yaml   |  52 +++++--------------
 olaris-api/k3s-template.yaml   |   6 +--
 olaris-api/nginx-template.yaml |   6 +--
 olaris-api/opsfile.yml         | 115 +++++++++++++++++++----------------------
 4 files changed, 73 insertions(+), 106 deletions(-)

diff --git a/olaris-api/api-template.yaml b/olaris-api/api-template.yaml
index 4fbcf74..582019b 100644
--- a/olaris-api/api-template.yaml
+++ b/olaris-api/api-template.yaml
@@ -22,76 +22,50 @@
 apiVersion: apps/v1
 kind: StatefulSet
 metadata:
-  name: ${USERNAME:-nuvolaris}-system-api
+  name: nuvolaris-system-api
   namespace: nuvolaris
   labels:
-    app: ${USERNAME:-nuvolaris}-system-api
+    app: nuvolaris-system-api
 spec:  
   replicas: 1
   selector:
     matchLabels:
-      app: ${USERNAME:-nuvolaris}-system-api
+      app: nuvolaris-system-api
   template:
     metadata:
       labels:
-        name: ${USERNAME:-nuvolaris}-system-api
-        app: ${USERNAME:-nuvolaris}-system-api
+        name: nuvolaris-system-api
+        app: nuvolaris-system-api
     spec:
       serviceAccount: nuvolaris-wsku
       containers:
-        - name: ${USERNAME:-nuvolaris}-system-api
-          image: 
registry.hub.docker.com/nuvolaris/nuvolaris-system-api:${IMAGE_TAG:-1.3.0-mastrogpt.2405061820}
-          imagePullPolicy: Always
+        - name: nuvolaris-system-api
+          image: ${IMAGES_SYSTEMAPI}
+          imagePullPolicy: IfNotPresent
           command: ["./run.sh"]
           ports:
             - containerPort: 5000
               name: api
           env:
           - name: "APIHOST"
-            value: "${APIHOST:-localhost}"
-          - name: "AUTH0_DOMAIN"
-            value: "${AUTH0_DOMAIN}"
-          - name: "AUTH0_CLIENT"
-            value: "${AUTHO_CLIENT}"
-          - name: "AUTH0_SECRET"
-            value: "${AUTH0_SECRET}"
-          - name: "AUTH0_ENABLED"
-            value: "${AUTH0_ENABLED}"             
-          - name: "REDIS_PREFIX"
-            value: "${REDIS_PREFIX}"
-          - name: "REDIS_URL"
-            value: "${REDIS_URL}"
-          - name: "RECAPTCHA_SECRET"
-            value: "${RECAPTCHA_SECRET}"  
-          - name: "RECAPTCHA_VALID_DOMAINS"
-            value: "${RECAPTCHA_VALID_DOMAINS}" 
-          - name: "RECAPTCHA_VALIDATE"
-            value: "${RECAPTCHA_VALIDATE}"            
+            value: "${SYS_API_HOSTNAME:-localhost}"
           - name: "COUCHDB_SERVICE_PORT"
             value: "5984" 
           - name: "COUCHDB_SERVICE_HOST"
             value: "couchdb" 
           - name: "COUCHDB_ADMIN_USER"
-            value: "${CDB_USER}"  
+            value: "${SYS_API_CDB_USER}"  
           - name: "COUCHDB_ADMIN_PASSWORD"
-            value: "${CDB_PASSWORD}"
-          - name: "DEFAULT_MINIO_QUOTA"
-            value: "${SYS_API_MINIO_QUOTA:-100}"
-          - name: "DEFAULT_REDIS_QUOTA"
-            value: "${SYS_API_REDIS_QUOTA:-1}" 
-          - name: "DEFAULT_MONGO_QUOTA"
-            value: "${SYS_API_MONGO_QUOTA:-100}" 
-          - name: "DEFAULT_POSTGRES_QUOTA"
-            value: "${SYS_API_MONGO_QUOTA:-100}"                               
                                                                                
                                          
+            value: "${SYS_API_CDB_PASSWORD}"
 ---
 apiVersion: v1
 kind: Service
 metadata:
-  name: ${USERNAME:-nuvolaris}-system-api
+  name: nuvolaris-system-api
   namespace: nuvolaris
 spec:
   ports:
     - name: api
       port: 5000
   selector:
-    app: ${USERNAME:-nuvolaris}-system-api
\ No newline at end of file
+    app: nuvolaris-system-api
\ No newline at end of file
diff --git a/olaris-api/k3s-template.yaml b/olaris-api/k3s-template.yaml
index 9ab7dee..8950f25 100644
--- a/olaris-api/k3s-template.yaml
+++ b/olaris-api/k3s-template.yaml
@@ -28,16 +28,16 @@ metadata:
     traefik.ingress.kubernetes.io/transport.respondingTimeouts.idleTimeout: 
"600"
     traefik.ingress.kubernetes.io/transport.respondingTimeouts.readTimeout: 
"600"
     traefik.ingress.kubernetes.io/transport.respondingTimeouts.writeTimeout: 
"600"
-  name:${USERNAME:-nuvolaris}-system-api-ingress
+  name: nuvolaris-system-api-ingress
   namespace: nuvolaris
 spec:
   rules:
-  - host: localhost
+  - host: ${SYS_API_HOSTNAME:-localhost}
     http:
       paths:
       - backend:
           service:
-            name: ${USERNAME:-nuvolaris}-system-api
+            name: nuvolaris-system-api
             port:
               number: 5000
         path: /system
diff --git a/olaris-api/nginx-template.yaml b/olaris-api/nginx-template.yaml
index 23726f1..2255702 100644
--- a/olaris-api/nginx-template.yaml
+++ b/olaris-api/nginx-template.yaml
@@ -27,17 +27,17 @@ metadata:
     nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
     nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
     nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
-  name: ${USERNAME:-nuvolaris}-system-api-ingress
+  name: nuvolaris-system-api-ingress
   namespace: nuvolaris
 spec:
   rules:
   - #
-    host: localhost
+    host: ${SYS_API_HOSTNAME:-localhost}
     http:
       paths:
       - backend:
           service:
-            name: ${USERNAME:-nuvolaris}-system-api
+            name: nuvolaris-system-api
             port:
               number: 5000
         path: /system
diff --git a/olaris-api/opsfile.yml b/olaris-api/opsfile.yml
index 83f3346..e0c9902 100644
--- a/olaris-api/opsfile.yml
+++ b/olaris-api/opsfile.yml
@@ -14,83 +14,76 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+version: '3'
 
-version: "3"
+vars:
+  VAR: ""
+  MSG: ""
+  VAL: ""
+  RETRY: 100
+  TIMEOUT: 15s
+  CONTEXT: ""
 
 env:
+
   KUBECONFIG:
-    sh: |-
-      if test -e $OPS_TMP/kubeconfig
-      then echo $OPS_TMP/kubeconfig
+    sh: |
+      if test -e "$OPS_TMP/kubeconfig"
+      then echo "$OPS_TMP/kubeconfig"
       else echo ~/.kube/config
       fi
 
-  IMAGE_TAG:
-    sh: git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short 
HEAD     
-
-  CDB_HOST: couchdb  
+  SYS_API_CDB_HOST: couchdb
 
-  CDB_USER:
-    sh: nuv debug kube ctl CMD="-n nuvolaris get wsk/controller -o 
jsonpath='{.spec.couchdb.admin.user}'"
+  SYS_API_CDB_USER:
+    sh: $OPS debug kube ctl CMD="-n nuvolaris get wsk/controller -o 
jsonpath='{.spec.couchdb.admin.user}'"
 
-  CDB_PASSWORD:
-    sh: nuv debug kube ctl CMD="-n nuvolaris get wsk/controller -o 
jsonpath='{.spec.couchdb.admin.password}'"
+  SYS_API_CDB_PASSWORD:
+    sh: $OPS debug kube ctl CMD="-n nuvolaris get wsk/controller -o 
jsonpath='{.spec.couchdb.admin.password}'"
 
-  APIHOST:
-    sh: nuv debug kube ctl CMD="-n nuvolaris get cm/config -o 
jsonpath='{.metadata.annotations.apihost}'"
+  SYS_API_HOSTNAME:
+    sh: $OPS debug kube ctl CMD="-n nuvolaris get ingress/apihost -o 
jsonpath='{.spec.rules[0].host}'"
 
-  REDIS_PREFIX:
-    sh: echo "nuvolaris:"
-
-  REDIS_URL:
-    sh: |
-      echo redis://nuvolaris:$(kubectl -n nuvolaris get wsk/controller -o 
jsonpath='{.spec.redis.nuvolaris.password}')@redis:6379  
-
-dotenv:
-  - .env       
+  INGRESS_TYPE:
+    sh: $OPS util ingress-type
 
 tasks:
 
-  api:deploy:
-    ignore_error: false
-    cmds:
-    - envsubst -i api-template.yaml -o _api-template.yaml
-    - kubectl -n nuvolaris apply -f _api-template.yaml
-
-  api:undeploy:
+  deploy:
+    silent: true
     ignore_error: false
+    desc: deploy the admin api 
     cmds:
-    - envsubst -i api-template.yaml -o _api-template.yaml
-    - kubectl -n nuvolaris delete -f _api-template.yaml    
-
-  nginx:deploy:
-    desc: deploy nuvolaris admin api on an nginx based deployment (Kind or 
similar)
+    - test -e ${INGRESS_TYPE}-template.yaml || die "No avalable template for 
ingress type ${INGRESS_TYPE}."
+    - test -n "$IMAGES_SYSTEMAPI" || die "IMAGES_SYSTEMAPI is not set. Please 
set it to the desired image version."
+    - envsubst -i api-template.yaml -o _api.yaml > /dev/null 2>&1
+    - envsubst -i ${INGRESS_TYPE}-template.yaml -o _ingress.yaml > /dev/null 
2>&1
+    - kubectl -n nuvolaris apply -f _api.yaml
+    #- cat _ingress.yaml
+    - kubectl -n nuvolaris apply -f _ingress.yaml
+    - |
+      echo "Admin API deployed with HOSTNAME: ${SYS_API_HOSTNAME}/system"
+  
+  undeploy:
+    silent: true
+    desc: undeploy the admin api
     ignore_error: true
     cmds:
-    - task: api:deploy
-    - envsubst -i nginx-template.yaml -o _nginx-template.yaml
-    - kubectl -n nuvolaris apply -f _nginx-template.yaml
-
-  nginx:undeploy:
-    desc: undeploy nuvolaris admin api on an nginx based deployment (Kind or 
similar)
-    ignore_error: true
-    cmds:
-    - task: api:undeploy
-    - envsubst -i nginx-template.yaml -o _nginx-template.yaml
-    - kubectl -n nuvolaris delete -f _nginx-template.yaml 
-
-  k3s:deploy:
-    desc: deploy nuvolaris admin api on an nginx based deployment (Kind or 
similar)
-    ignore_error: true
-    cmds:
-    - task: api:deploy
-    - envsubst -i k3s-template.yaml -o _k3s-template.yaml
-    - kubectl -n nuvolaris apply -f _k3s-template.yaml
-
-  k3s:undeploy:
-    desc: undeploy nuvolaris admin api on an nginx based deployment (Kind or 
similar)
-    ignore_error: true
+    - kubectl -n nuvolaris delete sts/nuvolaris-system-api 
ing/nuvolaris-system-api-ingress
+    - |
+      echo "System API undeployed"
+  
+
+  update:
+    silent: true
+    desc: update the OpenServerless Admin Api stateful set
     cmds:
-    - task: api:undeploy
-    - envsubst -i k3s-template.yaml -o _k3s-template.yaml
-    - kubectl -n nuvolaris delete -f _k3s-template.yaml        
\ No newline at end of file
+      - task: deploy
+      - kubectl -n nuvolaris rollout restart statefulset nuvolaris-system-api
+    preconditions:      
+      - sh: '[ $IMAGES_SYSTEMAPI != $CURRENT_API_VERSION ]'
+        msg: "Current OpenServerless system API stateful set it is already 
updated to newest version. Request ignored."
+    env:
+      CURRENT_API_VERSION:
+        sh: |
+          echo $(kubectl -n nuvolaris get pod/nuvolaris-system-api-0 
-ojsonpath='{.spec.containers[0].image}')
\ No newline at end of file

Reply via email to