Skip to content

Commit

Permalink
Merge pull request #112 from francescotimperi/static-web-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
francescotimperi authored Sep 21, 2023
2 parents 09c4104 + acc6d2d commit 31b9ed0
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 7 deletions.
2 changes: 1 addition & 1 deletion actions/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ tasks:
upload:webtest2:
- >
curl -X PUT -T ../nuvolaris/templates/index.html -H "minioauth: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" {{.APIHOST}}/api/v1/web/whisk-system/nuv/upload/nuvolaris/.well-known/index2.html
curl -X PUT -T ../nuvolaris/templates/content.html -H "minioauth: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" {{.APIHOST}}/api/v1/web/whisk-system/nuv/upload/nuvolaris/content.html
login:all:
Expand Down
4 changes: 3 additions & 1 deletion nuvolaris/minio_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ def create(owner=None):
"name":"nuvolaris-static",
"container":"nuvolaris-static",
"size":1,
"storageClass": cfg.get('nuvolaris.storageclass'),
"dir":"/var/cache/nginx",
"minio_host": cfg.get('minio.host') or "minio",
"minio_port": cfg.get('minio.port') or "9000",
"applypodsecurity": util.get_enable_pod_security(),
"applypodsecurity": util.get_enable_pod_security()
}

tplp = ["nginx-static-cm.yaml","nginx-static-sts.yaml","security-set-attach.yaml","set-attach.yaml"]
Expand Down Expand Up @@ -103,6 +104,7 @@ def deploy_content_ingress_template(namespace, bucket, url):
content.with_ingress_name(static_ingress_name(namespace))
content.with_secret_name(static_secret_name(namespace))
content.with_context_path("/")
content.with_context_regexp("(.*)")
content.with_prefix_target(f"/{bucket}")
content.with_service_name("nuvolaris-static-svc")
content.with_service_port("8080")
Expand Down
27 changes: 27 additions & 0 deletions nuvolaris/templates/content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
~
-->
<html>
<head>
<title>Welcome to Nuvolaris Content Example</title>
</head>
<body>
<h1>This is another HTML page uploaded via upload action</h1>
</body>
</html>
1 change: 1 addition & 0 deletions nuvolaris/templates/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
image: postgres:14.1
database:
size: {{size}}Gi
storageClassName: {{storageClass}}
customConfig: nuvolaris-postgres-conf
env:
- name: POSTGRES_PASSWORD
Expand Down
14 changes: 9 additions & 5 deletions nuvolaris/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ def get_postgres_config_data():
'postgres_nuvolaris_user': "nuvolaris",
'postgres_nuvolaris_password': cfg.get('postgres.nuvolaris.password') or "s0meP@ass3",
'size': cfg.get('postgres.volume-size') or 10,
'replicas': cfg.get('postgres.admin.replicas') or 2
'replicas': cfg.get('postgres.admin.replicas') or 2,
'storageClass': cfg.get('nuvolaris.storageclass')
}
return data

Expand Down Expand Up @@ -393,11 +394,14 @@ def get_value_from_config_map(namespace="nuvolaris", path='{.metadata.annotation
def get_enable_pod_security():
"""
Return true if there is the need to enable pod security context
for some specific pod. This is currently used for bitnami based images.
for some specific pod. This is currently used for bitnami based images
when using storage classes block based
"""
runtime = cfg.get('nuvolaris.kube')
storage_provisioner = cfg.get('nuvolaris.provisioner')
return runtime in ["eks","gke","aks","generic"] or "rook" in storage_provisioner
#runtime = cfg.get('nuvolaris.kube')
#return runtime in ["eks","gke","aks","generic"]
storage_class = cfg.get('nuvolaris.storageclass')
return storage_class not in ['standard','local-path','microk8s-hostpath']


def get_runtimes_json_from_config_map(namespace="nuvolaris", path='{.data.runtimes\.json}'):
""" Return the configured runtimes.json from the config map cm/openwhisk-runtimes
Expand Down
173 changes: 173 additions & 0 deletions tests/k3s/whisk-saas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
apiVersion: nuvolaris.org/v1
kind: Whisk
metadata:
name: controller
namespace: nuvolaris
spec:
nuvolaris:
apihost: 146.148.119.191
storageclass: rook-ceph-block
provisioner: rook-ceph.rbd.csi.ceph.com
components:
# start openwhisk controller
openwhisk: true
# start openwhisk invoker
invoker: false
# start couchdb
couchdb: true
# start kafka
kafka: false
# start mongodb
mongodb: true
# start redis
redis: true
# start cron based action parser
cron: true
# enable TLS
tls: false
# minio enabled or not
minio: true
# zookeeper enabled or not
zookeeper: false
# minio static enabled or not
static: true
# monitoring enabled or not
monitoring: false
# postgres enabled or not
postgres: true
openwhisk:
namespaces:
whisk-system: 789c46b1-71f6-4ed5-8c54-816aa4f8c502:abcfO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
nuvolaris: cbd68075-dac2-475e-8c07-d62a30c7e683:123zO3xKCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
couchdb:
host: couchdb
volume-size: 10
admin:
user: whisk_admin
password: some_passw0rd
controller:
user: invoker_admin
password: s0meP@ass1
invoker:
user: controller_admin
password: s0meP@ass2
kafka:
host: kafka
volume-size: 10
controller:
protocol: "http"
host : "controller"
port: "3233"
image: "ghcr.io/nuvolaris/openwhisk-controller"
tag: "0.3.0-morpheus.22122609"
invoker:
protocol: "http"
host : "invoker"
port: "8080"
image: "ghcr.io/nuvolaris/openwhisk-invoker"
tag: "0.3.0-morpheus.22122609"
scheduler:
schedule: "* * * * *"
tls:
acme-registered-email: [email protected]
acme-server-url: https://acme-v02.api.letsencrypt.org/directory
zookeeper:
host: zookeeper
data-volume-size: 10
log-volume-size: 5
configs:
limits:
actions:
sequence-maxLength: 500
invokes-perMinute: 9999
invokes-concurrent: 2500
triggers:
fires-perMinute: 5000
memory:
limit-min: 128m
limit-std: 256m
limit-max: 2048m
concurrency:
limit-min: 1
limit-std: 1
limit-max: 1
loadbalancer:
timeout-factor: 2
blackbox-fraction: 25%
controller:
javaOpts: "-Xmx2048M"
loggingLevel: "INFO"
invoker:
javaOpts: "-Xmx8192M"
loggingLevel: "INFO"
containerPool:
userMemory: "51200m"
redis:
volume-size: 5
default:
password: s0meP@ass3
nuvolaris:
prefix: nuv
password: s0meP@ass3
mongodb:
host: mongodb
volume-size: 10
admin:
user: whisk_admin
password: 0therPa55
nuvolaris:
user: nuvolaris
password: s0meP@ass3
exposedExternally: False
useOperator: False
minio:
volume-size: 10
admin:
user: minioadmin
password: minioadmin
nuvolaris:
user: nuvolaris
password: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
monitoring:
prometheus:
volume-size: 10
alert-manager:
enabled: true
volume-size: 2
slack:
enabled: true
default: true
slack_channel_name: '#monitoring-nuvolaris'
slack_api_url: ${SLACK_API_URL}
gmail:
enabled: true
default: false
from: ${ALERT_EMAIL_FROM}
to: ${ALERT_EMAIL_TO}
username: ${GMAIL_USERNAME}
password: ${GMAIL_PASSWORD}
postgres:
volume-size: 5
replicas: 2
admin:
password: 0therPa55
replica-password: 0therPa55RR
nuvolaris:
password: s0meP@ass3

0 comments on commit 31b9ed0

Please sign in to comment.